Exposing virtual pin value via API only

In my app, I’m exposing time in state (on/off) via formatted time on Labeled Value widget. I can request the value through the API /get/V2 at it returns value like 0:05:12
I added unformatted time in milliseconds on V3, but I do not want to show in the app, only scrape the value to monitoring system.
I’m using BLYNK_READ for both V2 and V3. Right now, requesting /get/V3 comes back with “Requested pin doesn’t exist in the app.”
Is it not possible to get value from Virtual Pin if it is not added to app as a widget? As an alternative, I can’t see the option to hide widget either.
Any suggestions?

It is possible.

This error means you didn’t put any value into pin.

To test this I requested output that I know is generating data:
curl xxx:8080/auth/get/V3
Requested pin doesn't exist in the app.

After adding widget to the app:
curl xxx:8080/auth/get/V3

And after removing widget from the app:
curl xxx:8080/auth/get/V3
Requested pin doesn't exist in the app.

I wonder if the issue is that I’m only getting the value on read rather than writing it with timer?

Blynk.virtualWrite(V3, millis() - timeInState);

Correct, BLYNK_READ(vPIN) is triggered by the App, therefore when you delete the Pin the function is never callled again.

1 Like