How to control Ui elements (e.g. Switch Node) by code (Function Node)?

Hey ho ppl,
I try to switch the state of a switch node (restore status after reboot) by using a function node
but failed. I ve no Idea what the switch awaits for a msg object to only switch the state.
These are my switch settings: click
thx :slight_smile:

You have to send msg.payload with a value of on

You can use an inject node and check the checkbox to inject it once (this will also be triggered when you deploy the flows).

Actually I think you have to send exactly the string you have specified for on payload or off payload.

Yes but I only want to set the switch state without sending the string. Sending the string will cause an action which I want avoid.

In that case clear the box that says to pass the message on if it matches.

@WhiteLion Did that help?

No, I made a more ore less complicated solution using function nodes with multiple outputs and setted the switch to true / false.
click

So with that checkbox cleared it still passed on an input message to the output?

the checkbox of the switch is cleared too, thats right :slight_smile:
But for my case it was just a part of the solution. Like I said the flow is totaly reworked and the switch node has to be changed from string to bool.