Page 1 of 1

offline device

Posted: Friday 25 August 2023 9:27
by ssk17051980
Hello,

i use domoticz whit zigbee2mqtt with Sonoff dongle.
I want to know when a device it's offline .

what solution i have ?

thx

Re: offline device

Posted: Friday 25 August 2023 15:53
by waltervl
A sensor widget will become red (offline) if it did not send an update for X hours.
A switch you can check perhaps with a script.
Do you see an online/offline status in Zigbee2MQTT?
Do you use the MQTT AD gateway or the old python plugin to connect with Zigbee2mqtt?

Re: offline device

Posted: Saturday 26 August 2023 13:53
by ssk17051980
good idea, but i do not know how to doit =))
i'm using Zigbee2MQTT Plugin (v. 3.2.0-beta)

Re: offline device

Posted: Saturday 26 August 2023 14:42
by waltervl
So what is status offline? You have to check the plugin manual if it supports detecting the status and push that status to Domoticz.
In Domoticz you normally see a last seen date and time on each device. In Domoticz you can set a notification on sensors (not switches!) when a certain time has been passed without update.

You could also think why a zigbee device gets offline. My devices won't go offline. I do not use zigbee2MQTT so cannot help you in detail.

Re: offline device

Posted: Sunday 27 August 2023 14:42
by kimhav
waltervl wrote: Saturday 26 August 2023 14:42In Domoticz you can set a notification on sensors (not switches!) when a certain time has been passed without update.
Hi Walter, regarding the device specific notifications which allows one to receive quite quickly alerts when a critical sensor goes offline by ignoring the main interval settings in Domoticz and after defined value when it last was seen. Why this solves one issue another one occurs which is that Domoticz now keeps sending an email once per minute where it would be great if it just sent one (1) inital email based on the rules defined in the device notification and after that it could utilise for example the system defined interval. Is there any workaround or tweak to avoid getting the inbox flooded?

Re: offline device

Posted: Sunday 27 August 2023 22:29
by waltervl
I don't have that issue when using this function. I only get one notification when the last update is above a certain level.

Re: offline device

Posted: Monday 28 August 2023 9:08
by kimhav
waltervl wrote: Sunday 27 August 2023 22:29I don't have that issue when using this function. I only get one notification when the last update is above a certain level.
Ok, interesting, so either a bug or error 40 on my side; here is the settings for the device notification, either I overlooked something very obvisious or it's something else in the main Domoticz settings:
Domoticz_DeviceNotification_NotificationFlooding.png
Domoticz_DeviceNotification_NotificationFlooding.png (55.04 KiB) Viewed 1004 times

Re: offline device

Posted: Monday 28 August 2023 9:20
by ssk17051980
there was a case where I saw that a temperature sensor had not been updated for 4 days.
it's a Sonoff SNZB-02. I had to re-pair it. I want to know when I have such situations, with sensors blocked or no longer transmitting.

thx for the solution

Re: offline device

Posted: Monday 28 August 2023 10:22
by waltervl
kimhav wrote: Monday 28 August 2023 9:08
waltervl wrote: Sunday 27 August 2023 22:29I don't have that issue when using this function. I only get one notification when the last update is above a certain level.
Ok, interesting, so either a bug or error 40 on my side; here is the settings for the device notification, either I overlooked something very obvisious or it's something else in the main Domoticz settings:

Domoticz_DeviceNotification_NotificationFlooding.png
I see I have the "Ignore Interval" set to No. So perhaps that is the issue.

Re: offline device

Posted: Monday 28 August 2023 14:26
by Kedi
When you use zigbee2mqtt you could easily parse the file 'state.json' in the data dir below the zigbee2mqtt install dir.
In that file there is an field 'last_seen' which you could compare with the current time.
I found that when a device in that file has a last_seen of more then 1 day the device is not responding good anymore.
The 1 day is from my smoke sensor which only shows presence once a day to preserve battery.
The downside is that only has the ieeeAddr in it so you have to search for the right name of the device.
You could also parse the 'configuration.yaml' or 'devices.yaml' with the ieeeAddr for the right name.
Or just parse ALL the domoticz devices for a deviceId which starts with the ieeeAddr

Edit:
I meant parsing the file '/home/pi/zigbee2mqtt/data/database.db' and the field there is: lastSeen

Re: offline device

Posted: Monday 28 August 2023 21:43
by kimhav
waltervl wrote: Monday 28 August 2023 10:22I see I have the "Ignore Interval" set to No. So perhaps that is the issue.
Ok, I'll try chainging the "Ignore Interval" to No and let's see how it works out. :D Does this means that the the device notification will send an initial notification once the value has been meet, e.g no value for the last 15 min and then it will apply the system settings for notifications?

Re: offline device

Posted: Monday 28 August 2023 22:33
by waltervl
I did not these this for such a short offline tracking so I don't know. I use 2800 minutes. You can check the global setting in menu setup - settings, tab notifications