Show/Hide switch with msg.payload

Hey guys,

I think my original Post under General was in the wrong place. So here again :slight_smile:

Is it possible to Show/Hide a switch with a msg.payload or anything else?
I just want to enter a PIN before I'm able to turn on or off a switch for a few seconds after I entered the correct PIN.

Thank you in advance.

No you can’t easily show/hide it. But you can disable and enable it.

1 Like

Mhhh maybe that could be a solution as well :slight_smile:
Can you give me short example how to achive this?

I think I know how to change the color of a modified switch but not from the original/default ones.

If that is possible I could change the color to red if the PIN isn't entered and the switch is disabled?

Ah ok... found it out by myself after reading the information for the switch node till the end :smiley:
grafik

So because it is faded it out a bit the feature with color the switch red or normal isn't needed anymore <3

Thank you very much!

Can you please share an example flow?

@Squirrelbd I was just able to get it to work with this example

[{"id":"9ecb7341.656e","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"9afd158c.c9dc58","type":"ui_dropdown","z":"9ecb7341.656e","name":"","label":"","tooltip":"","place":"Select option","group":"adddc3f9.8fb54","order":2,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":750,"y":520,"wires":[[]]},{"id":"26248949.1fe1b6","type":"change","z":"9ecb7341.656e","name":"","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"options","pt":"msg","to":"[\"option1\",\"option2\",\"option3\"]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":400,"wires":[["803da111.ebebe","9afd158c.c9dc58"]]},{"id":"803da111.ebebe","type":"delay","z":"9ecb7341.656e","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":540,"y":400,"wires":[["a44722b.9ca4be"]]},{"id":"8e8c5927.251188","type":"inject","z":"9ecb7341.656e","name":"Press Me","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":400,"wires":[["26248949.1fe1b6"]]},{"id":"a44722b.9ca4be","type":"change","z":"9ecb7341.656e","name":"","rules":[{"t":"set","p":"enabled","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":400,"wires":[["9afd158c.c9dc58"]]},{"id":"ad6e2dee.8b78c","type":"comment","z":"9ecb7341.656e","name":"Dropdown greyed/disabled until delay timer completes","info":"","x":240,"y":360,"wires":[]},{"id":"adddc3f9.8fb54","type":"ui_group","z":"","name":"Test","tab":"321a0aed.9d57e6","order":1,"disp":true,"width":"6","collapse":false},{"id":"321a0aed.9d57e6","type":"ui_tab","z":"","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]
1 Like