Skip to content

Configuring the switch via input messages

bartbutenaers edited this page Aug 31, 2021 · 1 revision

As described on the readme page, there are some input message fields that can be used to configure the switch:

  • User input field
  • Passthrough field
  • Input msg field

The following example flow shows how to use those messages:

image

[{"id":"2caf0b8cc68d33e0","type":"ui_multistate_switch","z":"3e329e777a5729f1","name":"","group":"774738a84f4fdff0","order":2,"width":0,"height":0,"label":"Label {{label}}","stateField":"state","enableField":"enable","rounded":false,"useThemeColors":true,"hideSelectedLabel":false,"multilineLabel":false,"passThrough":"always","inputMsg":"all","userInput":"invisible","options":[{"label":"On","value":"ON","valueType":"str","color":"#009933"},{"label":"Off","value":"OFF","valueType":"str","color":"#999999"}],"x":580,"y":840,"wires":[["a5dbe552ef553aa9"]]},{"id":"074b92ae8c92c6f5","type":"inject","z":"3e329e777a5729f1","name":"ON","props":[{"p":"state","v":"ON","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":370,"y":840,"wires":[["2caf0b8cc68d33e0"]]},{"id":"af28e843a6af502a","type":"inject","z":"3e329e777a5729f1","name":"OFF","props":[{"p":"state","v":"OFF","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":370,"y":880,"wires":[["2caf0b8cc68d33e0"]]},{"id":"a5dbe552ef553aa9","type":"debug","z":"3e329e777a5729f1","name":"Selected state","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":810,"y":840,"wires":[]},{"id":"ca91b95808f3599c","type":"inject","z":"3e329e777a5729f1","name":"Enabled and show","props":[{"p":"enable","v":"enabled_show","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":330,"y":980,"wires":[["2caf0b8cc68d33e0"]]},{"id":"1b2cddfdd42e1362","type":"inject","z":"3e329e777a5729f1","name":"Enabled but don't show","props":[{"p":"enable","v":"enabled_not_show","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":320,"y":1020,"wires":[["2caf0b8cc68d33e0"]]},{"id":"822dfe84ae9d3b22","type":"comment","z":"3e329e777a5729f1","name":"User input mode","info":"","x":340,"y":940,"wires":[]},{"id":"0c25b8a23bf5e9ed","type":"inject","z":"3e329e777a5729f1","name":"Disabled","props":[{"p":"enable","v":"disabled","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":360,"y":1060,"wires":[["2caf0b8cc68d33e0"]]},{"id":"6300681b1246d96c","type":"inject","z":"3e329e777a5729f1","name":"Never","props":[{"p":"passthrough","v":"never","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":370,"y":1160,"wires":[["2caf0b8cc68d33e0"]]},{"id":"945d864ab5732836","type":"inject","z":"3e329e777a5729f1","name":"Always","props":[{"p":"passthrough","v":"always","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":370,"y":1200,"wires":[["2caf0b8cc68d33e0"]]},{"id":"c68aaff55194b807","type":"comment","z":"3e329e777a5729f1","name":"Passthrough mode","info":"","x":330,"y":1120,"wires":[]},{"id":"e74f7e3cd9efd991","type":"inject","z":"3e329e777a5729f1","name":"If state changes","props":[{"p":"passthrough","v":"change","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":340,"y":1240,"wires":[["2caf0b8cc68d33e0"]]},{"id":"16afe297f34980f9","type":"inject","z":"3e329e777a5729f1","name":"None","props":[{"p":"inputmsg","v":"none","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":370,"y":1340,"wires":[["2caf0b8cc68d33e0"]]},{"id":"539d0b300f5155c9","type":"inject","z":"3e329e777a5729f1","name":"All","props":[{"p":"inputmsg","v":"all","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":370,"y":1380,"wires":[["2caf0b8cc68d33e0"]]},{"id":"14039553b99dab8f","type":"comment","z":"3e329e777a5729f1","name":"Input msg mode","info":"","x":340,"y":1300,"wires":[]},{"id":"774738a84f4fdff0","type":"ui_group","name":"Passthrough tests","tab":"3f2769b2ddbf7633","order":1,"disp":true,"width":"6","collapse":false},{"id":"3f2769b2ddbf7633","type":"ui_tab","name":"Multistate switch","icon":"dashboard","disabled":false,"hidden":false}]