Skip to content
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

Create device for LWT messages. #40

Open
Reidid92 opened this issue Oct 1, 2023 · 4 comments
Open

Create device for LWT messages. #40

Reidid92 opened this issue Oct 1, 2023 · 4 comments

Comments

@Reidid92
Copy link

Reidid92 commented Oct 1, 2023

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.

@joba-1
Copy link
Owner

joba-1 commented Oct 1, 2023

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.

@Reidid92
Copy link
Author

Reidid92 commented Oct 1, 2023

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.

@joba-1
Copy link
Owner

joba-1 commented Oct 1, 2023

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.

@Reidid92
Copy link
Author

Reidid92 commented Oct 1, 2023

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 Reidid92 changed the title Create device for LWT messges. Create device for LWT messages. Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants