-
Notifications
You must be signed in to change notification settings - Fork 61
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
QoS for non-retained properties #166
Comments
Yes, that would make sense. Also think of a GUI, where the user presses a button, to trigger a specific action on a remote device. This should be triggered exactly once. |
Let's continue the discussion from the PR review thread here, so it won't be hidden once the topic is resolved. @Thalhammer wrote:
|
@mjcumming You are making the assumption that all (or most) events are of a time critical nature. This may not be true for everything, but I also can't think of good counter examples. This leads me to the idea to send non-retained properties with a QoS of 0 (at most once). An alternative solution could be to ignore the fact that messages with QoS 2 may arrive at a later time. Handling that case for time-ciritical events would then be implementation defined, e.g. by passing some time stamps as value for the property. |
Perhaps the logic for dealing with this should reside on the controller. The controller would know if the set command was not acted on/received as the value of the property would not change. |
How about an attribute similar to $settable to indicate if the controller should use retained or non retained set ? |
I think that would work, but before we do that and change the protocol we need to understand the use case. I am trying to think of a scenario where a device reconnects to a broker and the set command is always valid - at some point in time acting on a delayed set command is not a desired behavior. Ie. if a set command is sent to change a light how long is that valid for? It might different for a set command to change a heat/cool setpoint. I can't think of a scenario where delivering a set command hours later would be a desired behavior. We need to consider scenarios where the connection between the device and controller is broken and how they reconnect (ie new session, clean session) and expected behavior - as you mentioned in the PR. Before we change anything lets brainstorm some more to think of the use case and desired behavior and where the logic (controller/device) for dealing with delayed set commands should reside. |
One example would be the way I use it in my homeautomation. My Controller always publishes the current state it thinks the world is in to the set command no matter if the device is online or not. Example: This is how I use it in my home and it worked fine so far. IMHO the same goes for e.g. a thermostate. |
This is why we need to enumerate different situations. In your scenario, the controller is the source of "truth" about the state of the device. But this ignores the possibility of other controllers, most likely local control of a device. Consider the situation where I ask the controller to turn on light but for some reason that connection is broken. So, I manually turn the light on and then later turn it off when done. Then the light reconnects and gets turned on. Not a desired behavior from my perspective. Its not that one behavior or scenario is right, we just need to understand them and discuss how to solve. |
Also, this discussion is mixing the discussion about non-retained properties and the set command. |
The more I think about it, the more I like the idea of using QoS 0 for all events where non-duplicated arrival and a certain time criticality are more important than reliable delivery:
|
@piegamesde your comments expand on the spec at 5.3.2 where properties update their value which notifies the controller, ie closes the loop. This is keeps the logic on the device side to a minimum which is desirable since the protocol is designed to be lightweight. |
I think the real question is where you consider your truth to be. In my case the (single) controller is the single point of truth. |
@Thalhammer @piegamesde lets move the set issue to this thread We do need to solve for the QoS issue for non-retained properties |
Hi!
Would it make sense to specify QoS 2 for non-retained properties, or mention it as a option/reminder for those?
For event based things (doorbell, ish, think more pushbutton) the amount of events might matter. In which case QoS 2 becomes significant.
The text was updated successfully, but these errors were encountered: