Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add implementation details and other things #200
Add implementation details and other things #200
Changes from 6 commits
7a64558
039449a
e7743ff
5a46528
4a6ea00
05c5279
99101a8
e52a297
8f60c74
0ee5450
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a device connects with a non clean session it is assumed to "know" what happend in the last connection (mqtt kind of defines this). This means it should still know the retained values sent. If there is no persistence it should really be connecting with clean session set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, but I don't understand. What exactly is a "clean session"? What exactly is wrong about the paragraph and what should a more correct version?
My motivation behind this was to say that this approach at restoring state is a bad idea, and to explain why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MQTT supports keeping sessions while the device is offline.
If you connect and request a clean session you will get one that looks as if you never connected before.
However if you dont request a clean session the broker will restore all subscriptions you had the last you where connected. It will also deliver all messages sent to a subscription with qos 1 or higher while the device was offline.
You would normally connect with a clean session if your device state is lost (like after a reboot without persistent storage, or after a reset) and connect to an existing session otherwise if you're device still knows what state its world is in (like a connection drop/reconnect).
The only difference is that with an existing session you dont get retained topics unless you unsubscribe and resubscribe them again or they changed while the device was offline. Also there is no need to subscribe if you have an existing session as the broker keeps subscriptions alive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@homieiot/involved in my implementations, the Homie devices know their state ie on/off, dimmer percentage, temperature etc. Is there a situation where a device would not know it's own state and need to restore a value?
As part of other discussion regarding QoS, the Homie spec probably needs to address controller set messages that are not delivered in a timely fashion. Part of our discussion in #150
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mjcumming The section I wrote about this is limited to settable properties that can't easily be recovered. Think of music players for example. Or in my case, a light effects controller.