Tasmoticz icon indicating copy to clipboard operation
Tasmoticz copied to clipboard

Create device for LWT messages.

Open Reidid92 opened this issue 1 year ago • 4 comments

It would be useful to create a device to process LWT messages. The "Last Will and Testament" feature of MQTT is used by Tasmota to signal when the IOT is online, and MQTT automatically reports when the IOT is offline, for any reason (intentional or not). Creating a Text or Alarm device would be appropriate.

Reidid92 avatar Oct 01 '23 08:10 Reidid92

Domoticz already has a feature like this:

Sensor Timeout If the device is not seen for a long time (timed out), the highlight color will be Red. Set timeout time it in minutes This setting only checks Sensors (temperature, humidity, lux etc), not Switches/Lights. Also a notification can be set on sensors through the device notification button.

joba-1 avatar Oct 01 '23 09:10 joba-1

What you are talking about is an indirect strategy, deducing accessibility to the IOT from the non-reception of unrelated cyclic messages. It's not exactly the same thing. LWT offers a direct, immediate and independent expression of the accessibility status, uncorrelated from the frequency of emission of sensors values. We can then adapt the sensors status period to application needs using the Tasmota "Teleperiod" parameter, without impacting the detection of loss of accessibility. Then, there may be faster or slower POWER emission period, or even infinite (messages sent only when values change). We know independently of that and without delay whether the IOT is accessible or not. And this, with a minimum of messages exchanges (only when online/ofline transitions). All of this being intentionaly provided by Tasmota, why not exploit it.

Reidid92 avatar Oct 01 '23 14:10 Reidid92

I think I understand your point, but I must admit it has very low prio for me: I don’t need or want to know if a tasmota device is online or not. I am only interested if I get the sensor values I expect (which already includes tasmota device and network problems). Still, if you provide a PR it is likely I‘ll accept it.

joba-1 avatar Oct 01 '23 16:10 joba-1

I understand your priorities. I am working on a patch for that. When done I will submit it to you. I am working by reusing your updateXXXDevice, createXXXDevice code and what I understand of it. But I am not very familiar with python so my code will probably not be the best way and it will need your informed criticism.

Reidid92 avatar Oct 01 '23 16:10 Reidid92