I have APC UPS and I monitor it state using this thread scripts ( https://www.domoticz.com/forum/viewtopic.php?t=3673 ). It report state every minute, not just if state changes
Code: Select all
2017-04-09 19:27:01 On
2017-04-09 19:26:02 On
2017-04-09 19:25:03 On
2017-04-09 19:24:01 On
Code: Select all
-- Variables
devicename = "UPS state" --Name of the device
tempSensorName = "Living room" --Name of the temperature sensor
tempSensorName2 = "Garden" --Name of the outside temperature sensor
insideTemperature = otherdevices_temperature[tempSensorName] --Temperature is stored to the variable
outsideTemperature = otherdevices_temperature[tempSensorName2]
commandArray = {}
if (devicechanged[devicename]) then
print(devicename.." power supply script running...")
if (devicechanged[devicename] == "Off") then
bodytext = string.format("Power outage detected. Temperature inside of the house is now %.1f°C and outside %.1f°C", insideTemperature, outsideTemperature)
print(bodytext)
commandArray['SendNotification']="Domoticz - Power outage detected#"..bodytext.."#0"
elseif (devicechanged[devicename] == "On") then
bodytext = string.format("Power outage has ended. Temperature inside of the house is now %.1f°C and outside %.1f°C", insideTemperature, outsideTemperature)
print(bodytext)
commandArray['SendNotification']="Domoticz - Power outage has ended#"..bodytext.."#0"
end
end
return commandArray