How to read directly from hardware with the HTTP API

I’m trying to read directly from hardware V-pin using the HTTP API from Alexa’s developer written in js.

I have 3 things that do NOT work:

  1. If I read the value with “/auth/get/V2” I simply get the last value the hardware wrote to the server. (I don’t want to constantly be writing the value to the server)

  2. BLYNK_READ(V2) on my ESP32 doesn’t seem to get called from any API Function (which is what the app calls)

  3. I created a BLYNK_WRITE(V6) which causes a virtualWrite on V2:
    Blynk.virtualWrite(V2, val);

    Then I call /auth/update/V6?value=0 followed by /auth/get/V2, cascaded with promises to insure the first returns before the second starts. However this doesn’t necessarily give the actual hardware update to the server time to finish before the next call reads, so usually I get an old value.

How do I reliably trigger a hardware refresh before the value is returned to me? (like the App does)

You don’t have any choice. The server is where the data that is being returned by the Blynk API lives.
You can do upto 10 virtual writes per second without flooding the server, but it sounds like you should be triggering a virtual write whenever the value of your variable that you want to share with Alexa changes, so you always have the latest value on the server, but you’re not updating it unnecessarily.


Understood. But I don’t want to do necessary writes thru the server… and all the way to my hardware.
So I do a write (V6) via http, wait for that http to return, then immediately do a read (V2) via http. The problem I see is that even though the write HTTP returned, the server has not yet completed the loop with the hardware, and the value isn’t yet updated by the time the read hits. The next time I do a read the value is of course there.
I’m looking for a way to do exactly what the app does via the BLYNK_READ() functions. No way to call the BLYNK_READ functions from the HTTP API?

I did one other experiment. I inserted a 1000 ms delay between the write/read calls. That gives it enough time to get the hardware update.