Re: Domoticz database check script
Posted: Wednesday 27 January 2021 16:32
hi, interesting script. should i place this within domoticz under events, or in the ~/domoticz/scripts/dzvents/scripts directory?
Open source Home Automation System
https://forum.domoticz.com/
You can save it using the event editor as a type dzVents script; it will then also be stored in the domoticz database.
Code: Select all
active = true, -- set to false if you don't want an Alert device set.
device = "dbCheck", -- Name of your alert device (only needed when you set active = true )
failText = "Problem in database",
OKText = "database OK",
Code: Select all
{
"ActTime" : 1660636045,
"AstrTwilightEnd" : "23:21",
"AstrTwilightStart" : "04:17",
"CivTwilightEnd" : "21:40",
"CivTwilightStart" : "05:58",
"DayLength" : "14:29",
"NautTwilightEnd" : "22:26",
"NautTwilightStart" : "05:12",
"ServerTime" : "2022-08-16 09:47:25",
"SunAtSouth" : "13:49",
"Sunrise" : "06:34",
"Sunset" : "21:04",
"app_version" : "2022.1",
"result" :
[
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "Hello World",
"Description" : "",
"Favorite" : 0,
"HardwareDisabled" : false,
"HardwareID" : 3,
"HardwareName" : "Virtuel",
"HardwareType" : "Dummy (Does nothing, use for virtual switches only)",
"HardwareTypeVal" : 15,
"HaveTimeout" : false,
"ID" : "00082498",
"LastUpdate" : "2022-08-16 09:44:37",
"Name" : "dbCheck",
"Notifications" : "false",
"PlanID" : "0",
"PlanIDs" :
[
0
],
"Protected" : false,
"ShowNotifications" : false,
"SignalLevel" : "-",
"SubType" : "Text",
"Timers" : "false",
"Type" : "General",
"TypeImg" : "text",
"Unit" : 1,
"Used" : 1,
"XOffset" : "0",
"YOffset" : "0",
"idx" : "498"
}
],
"status" : "OK",
"title" : "Devices"
}
Code: Select all
2022-08-16 14:47:00.652 Status: dzVents: Info: DB check: ------ Start external script: DBcheck.lua:, trigger: "at 14:47"
2022-08-16 14:47:00.752 Status: dzVents: Debug: DB check: Command select count(id) from deviceStatus; result ==>> OK
2022-08-16 14:47:00.858 Status: dzVents: Debug: DB check: Command .schema result ==>> OK
2022-08-16 14:47:01.258 Status: dzVents: Debug: DB check: Command pragma integrity_check; result ==>> OK
2022-08-16 14:47:01.358 Status: dzVents: Debug: DB check: Command pragma foreign_key_check; result ==>> OK
2022-08-16 14:47:01.391 Status: dzVents: Debug: DB check: Processing device-adapter for dbCheck: Text device
2022-08-16 14:47:01.392 Error: dzVents: Error: (3.1.8) DB check: Method updateAlertSensor is not available for device "dbCheck" (deviceType=General, deviceSubType=Text). If you believe this is not correct, please report.
2022-08-16 14:47:01.392 Status: dzVents: Info: DB check: ------ Finished DBcheck.lua
I found the reason : You created device "dbCheckResult" as a type text device and it should be a type alert devicewaaren wrote: ↑Wednesday 27 January 2021 11:47You created device "dbCheckResult" as a type text device and it should be a type alert devicebertbigb wrote: ↑Wednesday 27 January 2021 11:45 I have installed this script but it reports the following error.Code: Select all
2021-01-27 11:10:01.487 Error: dzVents: Error: (3.0.2) DB check: Method updateAlertSensor is not available for device "dbCheckResult" (deviceType=General, deviceSubType=Text). If you believe this is not correct, please report.