stefanbode / Sonoff-Tasmota

Provide ESP8266 based itead Sonoff with Web, MQTT and OTA firmware using Arduino IDE, enhanced with I2C options
GNU General Public License v3.0
127 stars 41 forks source link

Shutters close after reconnect to MQTT Broker #82

Closed electrontube closed 5 years ago

electrontube commented 5 years ago

With MQTT being configured there is an issue with „Shutter Mode“: If connection to the MQTT Broker is lost and re-established, all Stutter Modules are triggered and Shutters fully close (regardless of the previous position of the shutter).

This is really critical, imagine you are in your Garden... a glitch in your WiFi could lock you out of your house.

B1G1 commented 5 years ago

You have to set retain false on the mqtt side to prevent this kind of issue

electrontube commented 5 years ago

Thanks for the hint, but retain is already set to false, that doesn't solve the problem.

B1G1 commented 5 years ago

May be there is already a retained message. In my case i had to reset the mqtt broker

electrontube commented 5 years ago

There shouldn't be any retained messages, as everything was working fine before and there were no outstanding tasks at the point in time the Connection to the broker was reestablished. Edit: The last message send to the unit was either SHUTTERPOSITION 50 or SHUTTERPOSITION 100, but never SHUTTERPOSITION 0, so it should definitely not be set to zero after reconnect

electrontube commented 5 years ago

Thanks @B1G1 , purging the persistence database helped for the moment, but I still feel there is more to be investigated.

stefanbode commented 5 years ago

Please can you set loglevel 5 and send the log after restart. We should easily find out where a command comes from and what happen in detail. The log is your friend

electrontube commented 5 years ago

@stefanbode The problem appears to be gone after purging the persistence database on the broker. I will keep an eye on it and report if it occurs again.

stefanbode commented 5 years ago

Yes, that sounds reasonable. We do not have this problem elsewhere and the MQTT retain stuff also creates some confusion in the Forum of the TASMOTA main forum. There you will find in the MQTT session also some commands how to delete values. I'm using MQTT-SPY for browsing my values and this works great. But there are also other tools available.