MacWyznawca / homebridge-mqtt-switch-tasmota

Plugin to HomeBridge optimized to work with firmware Sonoff-Tasmota, MQTT.
MIT License
57 stars 18 forks source link

No status updated after some time #49

Open Kepete opened 5 years ago

Kepete commented 5 years ago

I have a physical switch connected to the Sonoff. If I turn it ON or OFF from the physical switch it instantly shows the right status in the home app. Everything works fine until some time and then the status stops updating in the home app. Sometimes it is few hours until it doesn't update the status anymore. Sometime few days. Always a restart to homebridge helps and it starts working again.

My config should be right, because it is working nicely at the beginning. But here it is anyway:

{
            "accessory": "mqtt-switch-tasmota",
            "switchType": "lightbulb",
            "name": "Room light",
            "url": "mqtt://192.168.1.1",
            "username": "***",
            "password": "***",
            "topics": {
                "statusGet": "stat/sonoff_test/POWER2",
                "statusSet": "cmnd/sonoff_test/POWER2",
                "stateGet": "tele/sonoff_test/STATE"
            },
            "onValue": "ON",
            "offValue": "OFF",
            "activityTopic": "tele/sonoff_test/LWT",
            "activityParameter": "Online",
            "startCmd": "cmnd/sonoff_test/TelePeriod",
            "startParameter": "60",
            "manufacturer": "ITEAD",
            "model": "Sonoff",
            "serialNumberMAC": "sonoff_test"
        },

I also checked my Mosquitto MQTT broker and it receives always correctly the state on the topic.

peros550 commented 5 years ago

Hi, I have exactly the same issue. The plugin unpredictably stops updating the status back to the home app. I also subscribed for the relevant messages in the Mosquitto broker and I can see them coming. The issue was resolved by reloading the Homebridge which also isolotes the problem to the plugin side of things.

Kepete commented 5 years ago

@peros550 What do you mean by reloading homebridge?

peros550 commented 5 years ago

I have setup homebridge to run as a service. Here is what I do to reload Homebridge in my case:

sudo systemctl stop homebridge
sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge
Kepete commented 5 years ago

In my experience this helps for a while, but the problem reoccurs always. Sometime it is working fine for 1 week sometimes for few hours.

peros550 commented 5 years ago

Yes, what I mentioned is just a work around, not a solution. :) I'm considering to put these commands on a script and run it every ... 12 hours. This will make homebridge unavailable for a few seconds. As said, not a very clean solution, just a workaround.

I hope @MacWyznawca have time to address this issue,

Thanks,

Lubanski commented 5 years ago

I have the same issue. I paste in crontab: 0 6 sudo systemctl restart homebridge 0 8 sudo systemctl restart homebridge 0 10 sudo systemctl restart homebridge 0 12 sudo systemctl restart homebridge ....... etc

every 2 hours homebridge reload.

Kepete commented 5 years ago

Lately I discovered that not always all Sonoff's seem to encounter the problem. I have 10 Sonoffs around the house and just now everything was working fine except one Sonoff. This one Sonoff had 4 different channels and all of them where not updating the state. But every channel is configured separately in the config.json. MQTT commands from Sonoff where sent correctly.

Kepete commented 5 years ago

The other thing I discovered was that the temperature plugin from @MacWyznawca has the same problem. The temperature sensor connected to Sonoff wouldn't update the state either.

iandronowicz commented 5 years ago

same here, I have 12 Sonoffs, and it happens randomly on most of them... never could figured it out...