Node-red: Reading a virtual pin on demand?

I think this one is for @tzapulica whose excellent node-red library I’m using the hell out of (thanks!!!).

I have a situation where I’d like to be able to “poll” a virtual pin from node-red to get its status.

The problem domain is the following: I have a remote-controlled tent. I can currently bring it up and down using two push-buttons (push config, connected to a virtual pin that generates a Blynk write event in my node-red flow). I also have two LEDs connected to their own virtual pins to which node-red writes when the tent goes up and down. This lets me visually see whether my tent is up or down.

What I’d like to do now is to automatically bring the tent up if the wind speed picks up to above 8 m/sec. And that also works fine.

However, that basically sends a “go up” signal to the system (and hence the motor) every time the wind speed is read (every X minutes). I can currently avoid that by using a context variable in the flow, but I feel it’s rather inelegant.

Is there a way to “read” the status of a Blynk virtual pin from within node-red on demand?

Thanks again for the awesome work you’ve done!

Best,

hi, and thanks

i think it s better to decide where to keep the state (i d keep it in node red) and make everything work from there on.

what i do to represent states usually involves trying to make the controlled endpoint (either esp8266 or node red) as independent as possible and use blynk to just issue commands and display stuff. it works out pretty well and seems reliable so far. reading the state of an led from blynk and deciding on that spells trouble to me as the states might be out of sync.

if you do want to read on demand, the quickest now i guess is making an https request to the blynk api, that should give you what you need on demand.

good luck

Thanks for the help :slight_smile:

You’re right, it makes more sense to maintain the state in the node-red environment in this setup, so I’ll keep on doing
so. Honestly, wonderful work on the node-red lib.

On a completely unrelated note, I just ordered some sonoff modules today and trawling the web, who did I find integrating them with Blynk? :smiley: – you’re quite prolific, mate!

thanks, good little modules they are
btw, do use the websockets version of the lib, it s much better.

wish i had more time for hobbies though, i haven t been able to find time for this stuff in the last few months

I feel you. I played around during my holidays. Now that I’m back to the office… Well. Let’s just say I don’t think I’ll be able to do this for much longer (which is why I want it done and finished asap :slight_smile: ).

I’m already using the websockets version, btw.