On Sat, 15 Apr 2017, Nelis Willers wrote:
>
> The tele/ messages are published every 300 to 400 seconds, which is a bit
> slow for near real time? tele messages are fine for logging, but not for
> quick response:
Yes, the default is every 300 seconds for tele/ messages (this is configurable).
I have my devices set to 60 seconds.
> 23:05:12 MQTT: tele/sonoff3935/STATE = {"Time":"2017-04-15T23:05:11",
> "Uptime":1, "Vcc":3.139, "POWER":"OFF", "Wifi":{"AP":1, "SSID":"CJMSW",
> "RSSI":100}}
> 23:10:52 MQTT: tele/sonoff3935/STATE = {"Time":"2017-04-15T23:10:52",
> "Uptime":1, "Vcc":3.138, "POWER":"OFF", "Wifi":{"AP":1, "SSID":"CJMSW",
> "RSSI":100}}
> 23:16:36 MQTT: tele/sonoff3935/STATE = {"Time":"2017-04-15T23:16:36",
> "Uptime":1, "Vcc":3.137, "POWER":"OFF", "Wifi":{"AP":1, "SSID":"CJMSW",
> "RSSI":100}}
>
> My limited understanding, looking at the MQTT message stream, is that the
> cmnd messages issue the command and the stat messages then respond with a
> confirmation of the executed command.
> In this context, should one then not rather publish and look out for stat
> messages, rather than tele messages?
You were asking for a message from the device to your home automation software
to let you know that it's on after a 'power outage'
That's different than looking for a response to a command.
You are correct that if you are looking for feedback to know that a command has
been executed, you should look for the stat/ messages
But when you want to make sure that the home automation system has the correct
status of a device after a power outage (or restart of the home automation
system), then you should also look for the tele/ messages as well as the stat/
messages.
It could be argued either way as to what should happen after a power outage. But
with the principal that the home automation software is the ultimate authority,
you normally don't want to send a stat/ message (since that indicates that the
user changed the setting of the light), and so you have to wait for the tele/
message.
In your use case, you are hacking the process to use the power failure response
mode as a control action, so in your case a stat/ message would be appropriate,
but you should be able to get by with the tele/ message
On my system (using openhab), I was experimenting and restarting openhab
frequently and was annoyed that it didn't show me the correct status for the
lights until after they had been switched, so I have openhab configured to watch
for either the stat/ or the tele/ message to update it's internal status on the
light, and set the loginterval to 60 seconds so that within a minute of powering
a device on or restarting openhab, it has the correct status for all the
devices.
David Lang