node-red / node-red-dashboard

A dashboard UI for Node-RED
Other
1.3k stars 450 forks source link

Ui switch after restart #815

Closed keukenrol closed 10 months ago

keukenrol commented 10 months ago

Hi

When you add a switch to a flow or after restarting node-red, the switch is physically in its default off state. However it does not pass trough any message nor does it show its actual state. Only when you touch the switch it will start passing messages.

Also posted here: https://www.reddit.com/r/nodered/comments/9fgesh/initial_state_of_a_switch/

What can you do about it? I would like to have a default/init state for the switch to be set.

Thanks!

dceejay commented 10 months ago

You can use an inject node set to fire at start time to set whatever state you wish.

keukenrol commented 10 months ago

Ok great, I used the inject node with the inject once option, configured to set msg.payload boolean false. This works!