I’m not sure the best place to put this but I think this is the best category since the issue in the topic has to do with autoupdate.
There are acks, but it is between the broker and the client, not between clients, and then only if using QOS 1 or 2.
The specific behavior you are seeing has to do with autoupdate. All Items by default have autoupdate turned on. When autoupdate is turned on OH “predicts” what the new state for the Item will be based on a given command.
If you turn off autoupdate, the state of the Item will not update until something explicitly tells it to. In this case when the device pubishes on home/deviceid/node/property
.
I don’t know what a Homie Thing looks like. With a Generic Thing you can set up a single Channel that pub/sub to both of these topics. Then you can link that Channel to an Item with autoupdate set to off and you will get the behavior I think you are after. If Homie uses two different Channels, one for the command and one for the status then you would link both Channels to the same Item and set autoupdate to off.
One nice thing the binding does is set all your linked Items to UNDEF when the connection to the Broker is lost. So that is one part of the “how do I tell if the device is reachable”. Unfortunately the other part is going to take some Rules. I do the following (can post the rules if asked):
- Item linked to a Channel subscribed to the LWT topic
- When OFFLINE (or whatever Homie uses) is published, all the Items linked to that Thing get set to UNDEF using a Rule. The Rule can be made generic using Groups.
I believe Homie uses retained messages for LWT so OH doesn’t necessarily need to be online and connected to the broker to get the LWT message and know the device is offline.
I don’t think that’s necessary here. It isn’t necessary for the old MQTT 1.x style configs like
{ mqtt="<[broker:testing/mqtt/topic:state:default], >[broker:testing/mqtt/back-topic:command:*:default]" autoupdate=false }
From what I know about how Homie is described to work, yes you are correct that every command does not necessarily mean that an ack gets published to the property topic. And maybe the working in Leif’s OP is slightly misleading.
The set topic is where you tell the device you want it to achieve a given state (it might already be in that state). The property topic gets published to every time the device changes it’s state. If every state change doesn’t get populated to the property topic, it’s a pretty lousy standard (OK, for stuff like sensors an update every so often, but thinking about something like a Switch, it has to publish the state changes).
So if I configure commands to go to the set topic, turn off autoupdate, and subscribe to the property topic, doesn’t that do what @leif is asking for? The Item only changes state on a command when the device reports that it has changed state?
As rossko57 has said, the behavior you are seeing is outside of the binding. By default openHAB turns on autoupdate which causes OH (or the binding) to predict what the state will become in response to the command. For example, a Dimmer Item will receive an INCREASE command and autoupdate may predict the Item to become 55.
autoupdate is turned on by default because it is actually the minority of technologues (at least when autoupdate was created) that provides feedback when they’ve been commanded. Heck, even older (before 2016) Zwave switches didn’t report their state back except for those from two vendors because of a patent. Homie and most MQTT type implementations are in the minority in that they report their state updates.
For most technologies supported by OH, pessimistic feed back is impossible because there is no feedback. OH has to assume that the command was reacted upon. So that is the default.