Hardware delay - how to sync button state plus transient mode (mqtt + node.red + blynk)

Hi Folks,

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!


There are quite a few ways to so this, but preventing the Blynk button widget from being pressed during the “switching on” phase is the most challenging.

Use a Styled Buton widget and when it switches from off to on, update it’s colour/message to maybe orange and “Starting”.
When a confirmatory message is received on the data topic then update the Blynk button to maybe red and “Charging”.

The process of ignoring further button presses during the “Starting” phase is probably best achieved by using a variable to store the status (off/starting/charging) and if an off or on message is received from the button widget during the starting phase then it is ignored, and the button state changed back to “Starting”.

Try implementing the first part and get tat working, then if you get stuck share what you’ve done so far.


Hi Pete,

thank you very much for your response.
So, I gather that fiddling with the button-widget properties is the way to go.
Based on what you described, I was just thinking to use a contrib-dsm node to cater for the different state modes, feeding either clicks from the button or direct values from the subscribed topic into it.
I think that I have an idea now, thank you very much!
I’ll report back when this has developed further.