I have thought this through and also searched the docs and forum, but did not succeed to find a sufficient answer. Maybe because english is not my native tongue as well…
I am controlling a Wallbox for my Electric Vehicle with Blynk.
The Wallbox offers a mqtt interface and I have connected a Blynk Project via node-red just fine.
However, for reasons internal to that Wallbox, when issuing a command the hardware will follow with a certain delay only (switching on an EV is not as instantaneous as switching on a light bulb).
Question is, how can I make a blynk button/switch display the correct state of the hardware switch.
Best even by displaying a transient state (during the event when the blynk switch gets pushed until hardware has followed).
There are two mqqt topics for the same physical element (like a remote switch for supplying power/current to the EV - switch on/off EV charging).
Topic one is for relaying the state (value on|off) and a second one for changing the state (value on|off).
Topic 1: data/switch1
Topic 2: set/switch1
When pushing the blynk switch (VPIN-1), values (0|1) are published to topic set/switch1.
On the hardware (wallbox switch for EV), the command gets exceuted on that hardware and a few seconds later, the topic data/switch1 will (hopefully) change to the respective value that has been published via set/switch1.
By subscribing to data/switch1, the VPIN-1 value gets updated.
How can I make it happen, that in Blynk app
- the switch will always show the correct on|off value (like color for on|off) of topic data/switch1, despite the fact, that the Blynk app will change the state of the switch immediately when being pressed?
- after the Blynk switch has been pressed/pushed (once) prevent it from being pushed/pressed more often (preventing a race condition / storm towards the hardware switch - maybe using a simple-gate node can do this or disabling the button temporarily?)
- displaying the transient state of the switch/button after being pressed and until the hardware has followed to execute the command. Maybe by flashing the button or changing the color to a transient one (on=green, off=blue, transient=orange) for the delay introduced by the hardware.
Many thanks in advance for your efforts and feedback!