Thanks for reading.
I have an Arduino setup as a light switch controller for my OpenHAB installation. With each press of a button the Arduino publishes an MQTT message with the topic “buttons” and the payload containing the button number, ie “10-01”, This broadcast is stateless, just a button number and not off or on.
Can I use this to toggle a switch in OpenHAB on and off? Furthermore, if the switch is toggled in OpenHAB will it keep track of the state.
This is controlling a customized Sonoff Basic that responds on the topic of “Sonoff_01/cmd” with a payload of 1 or 0. I will eventually be also deploying addtional Sonoff Basic’s and either Pi Zero or Arduino to control a relay board.
I have been researching this for weeks and getting nowhere.
I’m not sure if this is the best way to go, but I have resorted to writing a python script running on my RPi server that takes the Arduino Switch controller’s stateless broadcast and re-broadcasts using the Topic “buttons/10-01” with the payload 1 or 0 and keeping track of its state. Although I have this working, I have, however not been successful in getting this to update as the switch is changed in OpenHAB, or any of the OpenHAB clients (IOS and Windows 10 App).
Many thanks for your help.