How to monitor my devices (last update, value,...)
Moderators: leecollings, remb0
-
- Posts: 1
- Joined: Sunday 04 January 2015 12:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
How to monitor my devices (last update, value,...)
I would like to be informed when a device is no logger updated by domotics.
For example if a temperature device has not been updated for the past 4 hours I would like it to display a red title on my home page or in the temperature tab.
I have noticed that one of my fibaro plug which is not plugged is displayng a red title in the utility tab for energy monitoring.
I would like to have the same for all devices.
How can I do this ?
Thank a lot for your help
For example if a temperature device has not been updated for the past 4 hours I would like it to display a red title on my home page or in the temperature tab.
I have noticed that one of my fibaro plug which is not plugged is displayng a red title in the utility tab for energy monitoring.
I would like to have the same for all devices.
How can I do this ?
Thank a lot for your help
- Siewert308SW
- Posts: 290
- Joined: Monday 29 December 2014 15:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
Re: How to monitor my devices (last update, value,...)
I only can mention you that the widgets are red colored when a device isn't seen for a long period.
Domoticz lost the connection with a 433mhz temp device in my fridge.
And after two days i noticed the widget top bar was colored red and saw it wasn't updated for two days.
As for a notification you could use a lua script to send you a notification if a device is offline for a longer period of time.
Domoticz lost the connection with a 433mhz temp device in my fridge.
And after two days i noticed the widget top bar was colored red and saw it wasn't updated for two days.
As for a notification you could use a lua script to send you a notification if a device is offline for a longer period of time.
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
-
- Posts: 43
- Joined: Saturday 06 August 2016 9:53
- Target OS: Windows
- Domoticz version:
- Location: Sweden
- Contact:
Re: How to monitor my devices (last update, value,...)
Hi,
I have been looking at this code but I'm little confused...
In the if statement it will check if (uservariables[cmd] == 0) but where does this script create these variables?
Do I have to add them in Domoticz --> Setup --> User variables?
As of of now the script will never go through the if statements because these variables doesn't seem to exists...
I have been looking at this code but I'm little confused...
In the if statement it will check if (uservariables[cmd] == 0) but where does this script create these variables?
Do I have to add them in Domoticz --> Setup --> User variables?
As of of now the script will never go through the if statements because these variables doesn't seem to exists...
Code: Select all
commandArray = {}
local function update(cmd)
vari = "Variable:" .. cmd --add Variable: before device
t1 = os.time() --get date/time right now in seconds
t3 = os.date("%Y-%m-%d %H:%M:%S") --get date/time right now in normal format
s = otherdevices_lastupdate[cmd] --read last date/time for device
--print(cmd)
--print(s)
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2)) --compare right now with device
if (difference > 2400) and (uservariables[cmd] == 0) then --if device date/time is more than 30 minutes
commandArray['SendEmail']=''..cmd..' äldre än 40 min#'..s..' är senaste tid#[email protected]' --send mail
commandArray[vari] = "1" --set variable to 1
elseif (difference < 2400) and (uservariables[cmd] == 1) then --if device date/time is less than 30 minutes
commandArray[vari] = "0"
commandArray['SendEmail']=''..cmd..' ok igen#'..s..' är senaste tid#[email protected]'
end
end
update ('OutsideTemp') --device name can be temperature or voltage
update ('InsideTemp)
return commandArray
-
- Posts: 279
- Joined: Sunday 03 January 2016 14:55
- Target OS: -
- Domoticz version:
- Location: Sweden
- Contact:
How to monitor my devices (last update, value,...)
You have not copied the whole the code.
At the bottom there is Update ('xxxxx').
Update is calling a function called Update and the name between brackets is you device name, which will be used in the function Update and the variable name inside this Function is named cmd.
You need to use whole code and rename the devices so it fits your setup
At the bottom there is Update ('xxxxx').
Update is calling a function called Update and the name between brackets is you device name, which will be used in the function Update and the variable name inside this Function is named cmd.
You need to use whole code and rename the devices so it fits your setup
Last edited by Flopp on Tuesday 01 November 2016 8:41, edited 1 time in total.
-
- Posts: 43
- Joined: Saturday 06 August 2016 9:53
- Target OS: Windows
- Domoticz version:
- Location: Sweden
- Contact:
Re: How to monitor my devices (last update, value,...)
Hi,
In the last part in the code I do have the update code.
In my example it's
But don't I have to set either "0" or "1" to these variable somehow when the script starts (uservariables[cmd])?
Because if I don't it will none of the if statements will work...
if (difference > 2400) and (uservariables[cmd] == 0)
elseif (difference < 2400) and (uservariables[cmd] == 1)
In the last part in the code I do have the update code.
In my example it's
Code: Select all
update ('OutsideTemp') --device name can be temperature or voltage
update ('InsideTemp)
Because if I don't it will none of the if statements will work...
if (difference > 2400) and (uservariables[cmd] == 0)
elseif (difference < 2400) and (uservariables[cmd] == 1)
-
- Posts: 279
- Joined: Sunday 03 January 2016 14:55
- Target OS: -
- Domoticz version:
- Location: Sweden
- Contact:
Re: How to monitor my devices (last update, value,...)
Sorry, you are correct. I have almost forgot how it worked.
You need to create a User Variable with the same name as your device/s you are using in this script.
You need to create a User Variable with the same name as your device/s you are using in this script.
-
- Posts: 43
- Joined: Saturday 06 August 2016 9:53
- Target OS: Windows
- Domoticz version:
- Location: Sweden
- Contact:
Re: How to monitor my devices (last update, value,...)
Thank you!
Added a User Variable with same name as my temp sensor and it started working immediately
Added a User Variable with same name as my temp sensor and it started working immediately

-
- Posts: 279
- Joined: Sunday 03 January 2016 14:55
- Target OS: -
- Domoticz version:
- Location: Sweden
- Contact:
Re: How to monitor my devices (last update, value,...)
Greatanasazi wrote:Thank you!
Added a User Variable with same name as my temp sensor and it started working immediately
Who is online
Users browsing this forum: No registered users and 1 guest