Closed hjdhjd closed 6 months ago
There is already a query command available. A future release will add support for non sec+ 2.0 protocols.
The states are all retained by the mqtt broker, there is no reason to publish them on an interval.
Totally missed this one - my bad.
And as I stated in the other issue…not all brokers are created (or configured) equally. Relying on them to do so isn’t an assumption I’m prepared to make. 😄
Ehh I'm on the fence about that. If you have an mqtt broker that doesn't support retain correctly then you better use a different broker? It's a fundamental feature of mqtt...
Reopening this issue...the current query command doesn't actually publish all the current states - it sets everything to unknown and waits for the next event (whenever that may occur) to publish a state update. What I'd really like to see is a true query command that forces a publish of all known state information to MQTT. Any thoughts on that?
@hjdhjd I'm glad I stumbled upon this issue. I have been hunting the same type of functionality where a query command could force the re-publishing of current ratgdo state.
This is what the query command does (and what it has always done):
This is what the query command does (and what it has always done)
@PaulWieland Sorry I wasn't more clear in my post a bit ago. I have been trying unsuccessfully to get the query command to work. Given the examples you have here: https://paulwieland.github.io/ratgdo/01_features.html
Where am I going wrong?
If: Device Name = "MyGarageDoor" mqtt Prefix = "home/garage"
Then: mqtt.topic = "home/garage/MyGarageDoor/command" mqtt.payload = "query";
Is this not the proper way to query for all current statuses?
This is what the query command does (and what it has always done):
Yes and that’s part of the problem…it sets all the states to unknown and isn’t actually reporting on what ratgdo believes the current state is. What should happen is a publish of the current state. Those unknown states don’t belong there when the state is in fact known.
It's a little hard for me to interpret what is going on in the screen shot. It looks like some command (trying to get clarity on the proper syntax) was run which does reset all states to unknown
but then a second later current statuses were published.
If this is the behavior, this would work fine for my use-case. I just can't seem to get the query command to work.
It's a little hard for me to interpret what is going on in the screen shot. It looks like some command (trying to get clarity on the proper syntax) was run which does reset all states to
unknown
but then a second later current statuses were published.If this is the behavior, this would work fine for my use-case. I just can't seem to get the query command to work.
That’s essentially what it does…except what it should do is force a one-time republishing of state across the board.
Anything that’s listening for state changes will get an unnecessary (and incorrect given the state is known) message pushed with an unknown state.
Does the query command work for you? If so, what syntax do you use?
(Where are my assumptions wrong here? https://github.com/ratgdo/mqtt-ratgdo/issues/6#issuecomment-1869819930)
This is what the query command does (and what it has always done):
@PaulWieland Is it possible this behavior is different for those, like in my case, that are using the dry contact mode of operation?
I see where all states are set to unknown for a query
command, per @hjdhjd's callout:
https://github.com/ratgdo/mqtt-ratgdo/blob/2.5/src/ratgdo.cpp#L554-L562
Is it possible that dry contact doesn't get an update after those reset states until some other event occurs? (Door open/close, light toggle, etc)
While I realize this issue is closed, I just wanted to add a +1 for getting the query command to work for drycontact mode.
Another suggestion: it would be helpful if an additional command could be introduced:
/command/status
. When triggered with a payload oftrue
, it would force an immediate publish of the current state across all the other status topics (availability, door, light, lock, and obstruction) such as/status/door
. This is useful for applications/plugins that want to bootstrap state.At the moment, it doesn’t seem that ratgdo publishes state on a regular basis. State is only published in response to a command and its side effects.
Thanks again for a terrific solution.