I'm trying to capture devices such as PIR, door sensors etc. where potentially the battery has died
Check last seen? [Solved]
Moderator: leecollings
-
Calzor Suzay
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Check last seen?
Does anyone have a script written that would check a list of given devices for their 'Last seen' status of say more than 5 days then report it somehow?
I'm trying to capture devices such as PIR, door sensors etc. where potentially the battery has died
I'm trying to capture devices such as PIR, door sensors etc. where potentially the battery has died
- Siewert308SW
- Posts: 294
- Joined: Monday 29 December 2014 15:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
Re: Check last seen?
Wiki has a fewCalzor Suzay wrote:Does anyone have a script written that would check a list of given devices for their 'Last seen' status of say more than 5 days then report it somehow?
I'm trying to capture devices such as PIR, door sensors etc. where potentially the battery has died
Setup:
- DS923+ Docker
Domoticz Latest Stable
Mosquitto / ZwaveJSUI @ Aeotec Z-Stick Gen5+ / PiHole Unbound
P1 USB Gas/Power, HW watermeter
- A lot of Zwave switches, contacts, plugs, smoke/Co2 ect
- DiY 7.5kWh Solar Storage @ GitHuB
- DS923+ Docker
Domoticz Latest Stable
Mosquitto / ZwaveJSUI @ Aeotec Z-Stick Gen5+ / PiHole Unbound
P1 USB Gas/Power, HW watermeter
- A lot of Zwave switches, contacts, plugs, smoke/Co2 ect
- DiY 7.5kWh Solar Storage @ GitHuB
-
Calzor Suzay
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Re: Check last seen?
I couldn't find a Wiki for dzVents only the Github and the examples there seem to be about 'pinging' devices to see if they are alive.
Unless I missed something?
Unless I missed something?
- Siewert308SW
- Posts: 294
- Joined: Monday 29 December 2014 15:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
Re: Check last seen?
You didn't mention you want info for Dz, then ask there.Calzor Suzay wrote:I couldn't find a Wiki for dzVents only the Github and the examples there seem to be about 'pinging' devices to see if they are alive.
Unless I missed something?
As for Lua, you could amend this one:
https://www.domoticz.com/wiki/Get_Sensors_Status
Setup:
- DS923+ Docker
Domoticz Latest Stable
Mosquitto / ZwaveJSUI @ Aeotec Z-Stick Gen5+ / PiHole Unbound
P1 USB Gas/Power, HW watermeter
- A lot of Zwave switches, contacts, plugs, smoke/Co2 ect
- DiY 7.5kWh Solar Storage @ GitHuB
- DS923+ Docker
Domoticz Latest Stable
Mosquitto / ZwaveJSUI @ Aeotec Z-Stick Gen5+ / PiHole Unbound
P1 USB Gas/Power, HW watermeter
- A lot of Zwave switches, contacts, plugs, smoke/Co2 ect
- DiY 7.5kWh Solar Storage @ GitHuB
-
elmortero
- Posts: 248
- Joined: Sunday 29 November 2015 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.9639
- Location: Spain
- Contact:
Re: Check last seen?
I think what are looking for is in the dzvents examples.
https://github.com/dannybloe/dzVents/tr ... s/examples
Look for check dead devices.lua
That script checks for device that have not been updated for x minutes
https://github.com/dannybloe/dzVents/tr ... s/examples
Look for check dead devices.lua
That script checks for device that have not been updated for x minutes
-
Calzor Suzay
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Re: Check last seen?
This post is in the specific dzVents Lua Framework sub forum so one could assume I'm asking about thatSiewert308SW wrote:You didn't mention you want info for Dz, then ask there.
As for Lua, you could amend this one:
- Siewert308SW
- Posts: 294
- Joined: Monday 29 December 2014 15:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
Re: Check last seen?
My mistake, didn't notice that.Calzor Suzay wrote:This post is in the specific dzVents Lua Framework sub forum so one could assume I'm asking about thatSiewert308SW wrote:You didn't mention you want info for Dz, then ask there.
As for Lua, you could amend this one:
But nevermind hope someone with dzvent knowledge can help.
Setup:
- DS923+ Docker
Domoticz Latest Stable
Mosquitto / ZwaveJSUI @ Aeotec Z-Stick Gen5+ / PiHole Unbound
P1 USB Gas/Power, HW watermeter
- A lot of Zwave switches, contacts, plugs, smoke/Co2 ect
- DiY 7.5kWh Solar Storage @ GitHuB
- DS923+ Docker
Domoticz Latest Stable
Mosquitto / ZwaveJSUI @ Aeotec Z-Stick Gen5+ / PiHole Unbound
P1 USB Gas/Power, HW watermeter
- A lot of Zwave switches, contacts, plugs, smoke/Co2 ect
- DiY 7.5kWh Solar Storage @ GitHuB
-
Calzor Suzay
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Re: Check last seen?
Think I got this working by taking the sample and swopping my devices and timing etc. 
-
MikeF
- Posts: 350
- Joined: Sunday 19 April 2015 0:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.2
- Location: UK
- Contact:
Re: Check last seen?
This is exactly what I am looking for, as I have a couple of devices which stop sending from time to time - except that, as it stands, this script will keep sending every 5 minutes. Is there a way of changing this, so that it only sends once?elmortero wrote: Sunday 22 January 2017 3:29 I think what are looking for is in the dzvents examples.
https://github.com/dannybloe/dzVents/tr ... s/examples
Look for check dead devices.lua
That script checks for device that have not been updated for x minutes
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Check last seen?
This should send the notification once every 12 hours (adjustable)MikeF wrote: Friday 20 March 2020 9:46 This is exactly what I am looking for, as I have a couple of devices which stop sending from time to time - except that, as it stands, this script will keep sending every 5 minutes. Is there a way of changing this, so that it only sends once?
Code: Select all
--[[
Check dead device using their description
--]]
local repeatNotificationHours = 12
return
{
on =
{
timer =
{
'every 5 minutes during daytime',
},
},
data =
{
notifications =
{
initial = {},
},
},
execute = function(dz, item)
local function notify(device)
local message = 'Device ' .. device.name .. ' seems to be dead. No update for ' .. device.lastUpdate.minutesAgo .. ' minutes'
dz.log(message)
if dz.data.notifications[device.name] and dz.data.notifications[device.name] > dz.time.dDate then
dz.log('No notification needed now')
else
dz.notify('Dead devices', message, dz.PRIORITY_HIGH)
dz.data.notifications[device.name] = dz.time.dDate + repeatNotificationHours * 3600
end
end
local maxIdleTime
dz.devices().forEach(function(device)
if (device.description or ''):match('CDA:%s*%d+') then
maxIdleTime = (device.description):gsub('CDA:',''):gsub(' ','')
maxIdleTime = tonumber(maxIdleTime)
if device.lastUpdate.minutesAgo > maxIdleTime then
notify(device)
end
end
end)
end
}Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
MikeF
- Posts: 350
- Joined: Sunday 19 April 2015 0:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.2
- Location: UK
- Contact:
Re: Check last seen? [Solved]
Many thanks, @waaren - this is a very neat solution, and works nicely!
I had tried extending the check dead devices.lua script to update an alert sensor but only trigger an email if this had been set to red in less than 24 hours. However, this is much neater, as I don't need to edit the script to insert the names of the devices I want to check - instead, I can use the device description in the Domoticz GUI for the devices I want to monitor.
I had tried extending the check dead devices.lua script to update an alert sensor but only trigger an email if this had been set to red in less than 24 hours. However, this is much neater, as I don't need to edit the script to insert the names of the devices I want to check - instead, I can use the device description in the Domoticz GUI for the devices I want to monitor.
Who is online
Users browsing this forum: No registered users and 1 guest