Getting started question

Hi all,

I am just beginning with Node red and I would like to understand the logic/data flow begind nodes and ui elements. I have a simple Innr 220 plug which I would like to be able to switch on/off directly from the device as well as from a switch element on the ui. I would like manual operation of the plug to be reflected on the ui (show if it is currently off or on)

What is the minimal config for such a setup? I have got it working with 3 elements:

zigbee2mqtt "in node" -> switch -> zigbee2mqtt "out node"

I have deactivated the option "Pass through msg if payload matches new state:" for the switch, and I have activated "Send value at start" for the "in node".

Is this the recommended way to do it or can it be done with just a switch and an "out node"? In my setup, what triggers the "in node" -> swittch message which updates the ui?

So I think I understand the content of the messages and that throwing the switch on the ui sends a message to the "out node" which sends a zigbee message to the device. But I don't quite understand how the ui should or can be updated from the device state, although my setup is working.

Thanx for any help!

PD. The flow, I am not sure if this is the correct way to share it. Thanx gerry!

[{"id":"d8de67d2.148978","type":"ui_switch","z":"212f5e84.1f33a2","name":"","label":"lampara","tooltip":"","group":"4df0bc74.0f8734","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"topic","topicType":"msg","style":"","onvalue":"ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"OFF","offvalueType":"str","officon":"","offcolor":"","animate":false,"x":260,"y":500,"wires":[["8a8a2d4c.9f10f"]]},{"id":"8a8a2d4c.9f10f","type":"zigbee2mqtt-out","z":"212f5e84.1f33a2","name":"lampara","server":"ca829626.711298","friendly_name":"lamparita","device_id":"0x847127fffe2e5106","command":"state","commandType":"z2m_cmd","payload":"payload","payloadType":"msg","transition":0,"x":420,"y":500,"wires":[]},{"id":"4c290919.cfcf58","type":"zigbee2mqtt-in","z":"212f5e84.1f33a2","name":"in: lamparita","server":"ca829626.711298","friendly_name":"lamparita","device_id":"0x847127fffe2e5106","state":"state","outputAtStartup":true,"x":90,"y":500,"wires":[["d8de67d2.148978"]]},{"id":"4df0bc74.0f8734","type":"ui_group","name":"Interruptores","tab":"cb424d9e.243b2","order":1,"disp":true,"width":"6","collapse":false},{"id":"ca829626.711298","type":"zigbee2mqtt-server","name":"local_zigbee2mqtt","host":"","mqtt_port":"1883","mqtt_username":"","mqtt_password":"","tls":"","usetls":false,"base_topic":"zigbee2mqtt"},{"id":"cb424d9e.243b2","type":"ui_tab","name":"Casa","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
1 Like

Typically posting whatever flow you have helps others in trying to visualize what you are doing

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.