Hi guys, i have an arduino button that reports to MQTT in a stateless form of 20-41 for example
How could i take this and check the current state of the switch in openhab and and do the opposite.
so if light is on turn it off etc. this is what i currently
Exported Node
[{"id":"4600abdd.2cc1a4","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"e59f80cd.a46ca","type":"debug","z":"4600abdd.2cc1a4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1170,"y":400,"wires":},{"id":"21cc5950.19ca86","type":"mqtt in","z":"4600abdd.2cc1a4","name":"Button 41","topic":"buttons","qos":"0","datatype":"auto","broker":"ba6907f8.d77f18","x":100,"y":260,"wires":[["547151b6.d72ce"]]},{"id":"1dccf447.34801c","type":"openhab2-in","z":"4600abdd.2cc1a4","name":"Office Light","controller":"f7d06c8e.b7d0a","itemname":"Office_Light","x":190,"y":140,"wires":[["a02aa14c.c0592"],]},{"id":"a02aa14c.c0592","type":"change","z":"4600abdd.2cc1a4","name":"SetPayload","rules":[{"t":"set","p":"payload","pt":"msg","to":"20-41","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":200,"wires":[["a6ae35d7.845978"]]},{"id":"a6ae35d7.845978","type":"mqtt out","z":"4600abdd.2cc1a4","name":"Button-41","topic":"buttons","qos":"","retain":"","broker":"ba6907f8.d77f18","x":820,"y":180,"wires":},{"id":"547151b6.d72ce","type":"openhab2-get","z":"4600abdd.2cc1a4","name":"","controller":"f7d06c8e.b7d0a","itemname":"Office_Light","x":370,"y":340,"wires":[["ad12df88.72105"]]},{"id":"ad12df88.72105","type":"split","z":"4600abdd.2cc1a4","name":"","splt":"\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":550,"y":300,"wires":[["55ac0071.81a63","ff453a1f.20a3b8"]]},{"id":"ff453a1f.20a3b8","type":"switch","z":"4600abdd.2cc1a4","name":"Light On","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":720,"y":420,"wires":[["67bf4990.f12398"]]},{"id":"55ac0071.81a63","type":"switch","z":"4600abdd.2cc1a4","name":"Light Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":720,"y":460,"wires":[["c84ace0e.8bcf5"]]},{"id":"c84ace0e.8bcf5","type":"change","z":"4600abdd.2cc1a4","name":"Change Status Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":480,"wires":[["e59f80cd.a46ca"]]},{"id":"67bf4990.f12398","type":"change","z":"4600abdd.2cc1a4","name":"Change Status On","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":420,"wires":[["e59f80cd.a46ca"]]},{"id":"ba6907f8.d77f18","type":"mqtt-broker","z":"","name":"Mosquitto","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"f7d06c8e.b7d0a","type":"openhab2-controller","z":"","name":"Openhab","protocol":"http","host":"localhost","port":"8080","path":"","username":"openhabian","password":"xxxx"}]
currently it will pass the state but thats coming off the openhab get node.
any help is appreciated
Cheers