Hi community!
First of all I apologize if this is some simple problem which is solved 100 times already on forum. I’m a beginner and possible problem is that I don’t recognize solution when I see one. I wasted 4 days already trying to make it work and nothing worked so I’m looking for your help.
I just started my home automation project using rPI Zero W with openHABian and some Sonoff smart switches flashed with ESPEasy firmware to support MQTT.
Problem I have is following… My OpenHAB seems to get stuck periodically every cca 5 seconds and stops responding on MQTT message. System seams to work in this period normally.
My first setup is very simple and falls under “Proof of concept” category. I have only one Sonoff switch. If you are familiar with Sonoff switch you will know what I talking about but if not here is short explanation:
Sonoff has one “manual” button on it and there is one relay which actually turns on the light. If you press the button it sends MQTT message with its state and when you release the button it send new state again. It also reacts to MQTT message which actually switches relay state.
Now on to openHAB config…
I have 1 switch defined like this, one item named “light.items” with following content
Switch light "light [%s]" {mqtt="<[mosquitto:Lights/Sonoff/Button/Pressed:state:ON:1], <[mosquitto:Lights/Sonoff/Button/Pressed:state:OFF:0], >[mosquitto:Lights/Sonoff/gpio/12:command:ON:1], >[mosquitto:Lights/Sonoff/gpio/12:command:OFF:0] "}
This should receive MQTT button state and if it is pressed “light” should indicate in BasicUI that is on and new MQTT message should be generated to change relay state and actually turn on the light.
This item is added to sitemap so it can be controlled from BasucUI
Additionally, I track all the MQTT messages with MQTT.fx.
So… now the to get back to what seams to be the problem.
This configuration works for few seconds and then it stops. After few seconds it starts to work again and then again stops. When it is working I can see MQTT message that button is pressed and OpenHAB send its message to switch the relay but when it stops working I can see only “Button pressed” messages and not OpenHAB response. So problem is not on the Sonoff side. All the Sonoff messages are generated correctly and Sonoff reacts on every “relay change” request so this problem is on OpenHAB side.
Sorry for the long post but I’m trying to give as much info as I can.
Thank you in advance!