Thanx for the flow, I tested it but ran into some problems because it didn't work
when a zigbee2mqtt/Keuken_Spot1/get/state
is published, zigbee2mqtt/Keuken_Spot1
will get the output. (group zigbee2mqtt/Keuken_Spots
can also be used to subscribe to)
zigbee2mqtt/Keuken_Spot1/get/state
or zigbee2mqtt/Keuken_Spot1/get
both return this json string {"state": "ON", "brightness": 200, "color_temp": 350}
Not "ON" or "OFF" which you may have expected.
As a result "set flow.light_state" change node returns
{"state":"OFF","brightness":200,"color_temp":350}
instead of ON or OFF
So the JSON string should be splitted up with some code in order to get ON or OFF I guess?
Where and how is that done?
I modified the flow to the correct topics:
[{"id":"4ff533af.0e6fbc","type":"inject","z":"f7ed534b.a4e54","name":"","topic":"","payload":"toggle","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":409.8833312988281,"y":195.88333129882812,"wires":[["a9174dcd.63141"]]},{"id":"9799f8fa.a0d96","type":"mqtt in","z":"f7ed534b.a4e54","name":"","topic":"zigbee2mqtt/Keuken_Spots","qos":"0","datatype":"json","broker":"1ec43ef1.2b0269","x":455.8833312988281,"y":267.8833312988281,"wires":[["5d19ba20.7f0cbc"]]},{"id":"5d19ba20.7f0cbc","type":"change","z":"f7ed534b.a4e54","name":"","rules":[{"t":"set","p":"light_state","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":761.8833312988281,"y":267.8833312988281,"wires":[["d0d45c46.1b2a98"]]},{"id":"49f621ee.a07268","type":"mqtt out","z":"f7ed534b.a4e54","name":"","topic":"zigbee2mqtt/Keuken_Spot1/get/state","qos":"","retain":"","broker":"1ec43ef1.2b0269","x":725.8833312988281,"y":507.8833312988281,"wires":[]},{"id":"fccc5630.5a0ef8","type":"inject","z":"f7ed534b.a4e54","name":"zigbee2mqtt/Keuken_Spot1/get/state","topic":"zigbee2mqtt/Keuken_Spot1/get/state","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":333.8833312988281,"y":507.8833312988281,"wires":[["49f621ee.a07268"]]},{"id":"a9174dcd.63141","type":"change","z":"f7ed534b.a4e54","name":"Toggle on/off","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext(\"light_state.state\") =\"OFF\" ? \"ON\" : \"OFF\" \t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":549.8833312988281,"y":195.88333129882812,"wires":[["c2639e15.36732"]]},{"id":"c2639e15.36732","type":"debug","z":"f7ed534b.a4e54","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":717.8833312988281,"y":195.88333129882812,"wires":[]},{"id":"f19a96d6.52b75","type":"comment","z":"f7ed534b.a4e54","name":"Ignore - emulation only","info":"","x":435.8833312988281,"y":435.8833312988281,"wires":[]},{"id":"d0d45c46.1b2a98","type":"debug","z":"f7ed534b.a4e54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":962.2666015625,"y":267.4499816894531,"wires":[]},{"id":"1ec43ef1.2b0269","type":"mqtt-broker","z":"","name":"Zigbee2mqtt","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"domoticz/bridge/state","birthQos":"0","birthPayload":"online","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]