I’m assuming the left node outputs true
/false
to msg.payload
depending on the state of the light.
[{"id":"7dd19c1ae6b3a809","type":"inject","z":"91a80f99.6180e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":226,"y":2176,"wires":[["c73eb5f6f4b2702d"]]},{"id":"8d79b218c1d33eed","type":"debug","z":"91a80f99.6180e","name":"on","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":754,"y":2144,"wires":[]},{"id":"6f625894a0e58ada","type":"ha-entity","z":"91a80f99.6180e","name":"","server":"","version":2,"debugenabled":false,"outputs":2,"entityType":"switch","config":[{"property":"name","value":""},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"msg","inputOverride":"allow","outputOnStateChange":true,"outputPayload":"$entity().state = \"on\" ? true : false","outputPayloadType":"jsonata","x":582,"y":2144,"wires":[["8d79b218c1d33eed"],["f2e1bda048b7e95f"]]},{"id":"03d092d287a898a3","type":"inject","z":"91a80f99.6180e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":228,"y":2144,"wires":[["c73eb5f6f4b2702d"]]},{"id":"c73eb5f6f4b2702d","type":"change","z":"91a80f99.6180e","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"enabled","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":394,"y":2144,"wires":[["6f625894a0e58ada"]]},{"id":"f2e1bda048b7e95f","type":"debug","z":"91a80f99.6180e","name":"off","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":754,"y":2192,"wires":[]}]
edit: the change node should be moving payload
to enable
not enabled