-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chaning Topic using MQTT keeps device online in old topic #436
Comments
what do you mean by "never takes the old topic offline"?
once you configure the sonoff for the new topic, it no longer uses the prior
topic and no longer sends or responds to any messages with the old topic (unless
the old topic gets set as the grouptopic)
|
I think this relates to the retained flag on the online/offline messages. When you change the topic I don't think it sends an offline message on the old topic. I guess ideally it would send an offline message and tell the broker to stop retaining the message so it falls off the broker. |
See ticket #417 |
Also it should not just send an empty message to broker in my opinion, because if the controller is not online at that stage for some reason, it will never get the offline message before the message is removed. Maybe the controller should clear the broker and Sonoff just send an offline as per ticket #417? |
Sending an empty message with previous topic will be implemented in next release (unless there is a majority voting for just sending an offline message...) |
In my opinion the device should be listed as offline, unsubscribed, or even removed if this is possible by MQTT standards? I am also not sure if it is a bug in the Sonoff firmware or a bug of the broker if the device does not respond for a long time and should list the device as offline after a timeout? Maybe a solution would be changing the topic after restart so the device will unsubscribe first. |
I believe the broker pings on client ID and not topic. The same client ID is still connected and that is why it is not taken offline. This is also not a subscribe issue, it is a publish of LWT problem. If it is possible to select offline message at topic change as arendst suggests that should be ok and if broker restarts in non persistent mode it should remove the LWT |
I've contacted the broker to see if this is the problem and asked to propose a solution (for the client ID check). I think they should de-list a topic that does not send a message for a week. |
5.0.7 20170511 * Fix possible exception 28 on empty command * Add command SetOption0 as replacement for SaveState * Add command SetOption1 as replacement for ButtonRestrict * Add command SetOption2 as replacement for Units * Add command SetOption4 as replacement for MqttResponse * Add command SetOption8 as replacement for TempUnit * Add command SetOption10 On|Off to select between Offline or Removing previous retained topic (#417, #436)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem. |
5.0.7 20170511 * Fix possible exception 28 on empty command * Add command SetOption0 as replacement for SaveState * Add command SetOption1 as replacement for ButtonRestrict * Add command SetOption2 as replacement for Units * Add command SetOption4 as replacement for MqttResponse * Add command SetOption8 as replacement for TempUnit * Add command SetOption10 On|Off to select between Offline or Removing previous retained topic (arendst#417, arendst#436)
Hi,
I am programming an control application in UWP for Windows 10 including voice commands support using Cortana. It is starting to get in shape but I am having one issue.
I am using MQTT (broker=cloudmqtt.com). When I restart a Sonoff it is immidiately shown as offline, but when I rename the topic using command: "cmnd/sonoff_standing/topic: sonoff_standing_aap" it starts listening to sonoff_standing_app but it never takes offline the old topic.
Any idea what I am doing wrong or is this a bug?
Kind regards,
Sander
The text was updated successfully, but these errors were encountered: