Domoticz database check script
Moderator: leecollings
-
- Posts: 350
- Joined: Sunday 19 April 2015 0:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.2
- Location: UK
- Contact:
Re: Domoticz database check script
PS: also works like a charm for me - thx!
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
Thx again. Two typo's in one word
It's a miracle that some of my code actually works
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
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Domoticz database check script
Works
Now i need to figure out what the 'unknown error' is.
Now i need to figure out what the 'unknown error' is.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
If you set the scriptlogging to DEBUG and share the loglines maybe we can help ?
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
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Domoticz database check script
It seems it was easy to fix Just wrong path to the database O, and that evil 'database malformed' error, that I can't get rid of
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Domoticz database check script
When looking at the log it now shows:
Code: Select all
2020-01-14 14:05:11.232 Error: dzVents: Error: (2.5.5) DB check: pragma integrity_check; result ==>> Failed: The database disk image is malformed*** in database main ***
2020-01-14 14:05:11.232 Page 226: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 263: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 223: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 225: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 222: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 228: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 227: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 259: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 Page 258: btreeInitPage() returns error code 11
2020-01-14 14:05:11.232 On tree page 14 cell 0: 2nd reference to page 66250
2020-01-14 14:05:11.232 On tree page 14 cell 2: 2nd reference to page 66375
2020-01-14 14:05:11.232 On tree page 14 cell 1: 2nd reference to page 14045
2020-01-14 14:05:11.232 On tree page 13314 cell 90: Rowid 235640 out of order
2020-01-14 14:05:11.232 On tree page 98 cell 0: 2nd reference to page 32742
2020-01-14 14:05:11.232 On tree page 98 cell 1: 2nd reference to page 30388
2020-01-14 14:05:11.232 On tree page 98 cell 0: 2nd reference to page 27249
2020-01-14 14:05:11.232 On tree page 39 cell 1: 2nd reference to page 13314
2020-01-14 14:05:11.232 wrong # of entries in index sqlite_autoindex_UserSessions_2
2020-01-14 14:05:11.232 (11)
2020-01-14 14:05:11.234 Error: dzVents: Error: (2.5.5) DB check: ------ Finished DB Check after >11 seconds. (using 0.406 seconds CPU time !)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
The script identified some errors in the domoticz database. Best to make a copy now of the database and try to repair asap.EdwinK wrote: ↑Tuesday 14 January 2020 15:52 When looking at the log it now shows:Code: Select all
2020-01-14 14:05:11.232 Error: dzVents: Error: (2.5.5) DB check: pragma integrity_check; result ==>> Failed: The database disk image is malformed*** in database main *** 2020-01-14 14:05:11.234 Error: dzVents: Error: (2.5.5) DB check: ------ Finished DB Check after >11 seconds. (using 0.406 seconds CPU time !)
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
- gjaa
- Posts: 38
- Joined: Thursday 12 February 2015 6:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Domoticz database check script
What am I doing wrong
This is what I see in the logging
There is no device with that name or id: dbCheck result
Error: dzVents: Error: (2.5.5) DB check: An error occurred when calling event handler dzVents_DBcheck
Error: dzVents: Error: (2.5.5) DB check: ...cz/scripts/dzVents/generated_scripts/dzVents_DBcheck.lua:159: attempt to index a nil value
This is what I see in the logging
There is no device with that name or id: dbCheck result
Error: dzVents: Error: (2.5.5) DB check: An error occurred when calling event handler dzVents_DBcheck
Error: dzVents: Error: (2.5.5) DB check: ...cz/scripts/dzVents/generated_scripts/dzVents_DBcheck.lua:159: attempt to index a nil value
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
You left alert = true on line 42 but have not defined a device with devicetype alert and/or used a wrong name in line 43
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
- EdwinK
- Posts: 1820
- Joined: Sunday 22 January 2017 21:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Rhoon
- Contact:
Re: Domoticz database check script
Tried DB browser to check the database, but it couldn't open the database file
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
-
- Posts: 187
- Joined: Tuesday 07 March 2017 21:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Germany
- Contact:
Re: Domoticz database check script
Hi, I created this today, but there is an error.
Can you help me?
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: There is no device with that name or id: dbCheck result
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: An error occurred when calling event handler DB_Check
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: .../domoticz/scripts/dzVents/generated_scripts/DB_Check.lua:159: attempt to index a nil value
Can you help me?
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: There is no device with that name or id: dbCheck result
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: An error occurred when calling event handler DB_Check
2020-07-06 20:42:02.371 Error: dzVents: Error: (3.0.10) DB check: .../domoticz/scripts/dzVents/generated_scripts/DB_Check.lua:159: attempt to index a nil value
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
If you have active = true in line 42, you need to create an alert device with the name you entered in line 43.
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
-
- Posts: 187
- Joined: Tuesday 07 March 2017 21:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Germany
- Contact:
Re: Domoticz database check script
many thanks
-
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Re: Domoticz database check script
I have some errors and weirdness in my log but will post a separate post on that, as a consequence though I implemented this script as it seemed quick and easy to perform a DB check on a regular basis (not sure why this couldn't be added by default TBH) but the script itself 'seems' to I'm not sure cause issues.
Like I say i've had issues recently with the website dying so have been running sudo systemctl status domoticz.service this all seemed fine till I added the script and now I get as below.
with debug on I see this in the logs
2021-01-06 11:13:00.210 Status: dzVents: Info: DB check: ------ Start internal script: DB_Check:, trigger: "at 11:13"
2021-01-06 11:13:00.253 Status: dzVents: Debug: DB check: Command select count(id) from deviceStatus; result ==>> OK
2021-01-06 11:13:00.289 Status: dzVents: Debug: DB check: Command .schema result ==>> OK
2021-01-06 11:13:00.477 Status: dzVents: Debug: DB check: Command pragma integrity_check; result ==>> OK
2021-01-06 11:13:00.512 Status: dzVents: Debug: DB check: Command pragma foreign_key_check; result ==>> OK
2021-01-06 11:13:00.512 Status: dzVents: Info: DB check: ------ Finished DB_Check
Everything is running but I see the session open session closed messages and have to Ctrl-C out of the query now.
Like I say i've had issues recently with the website dying so have been running sudo systemctl status domoticz.service this all seemed fine till I added the script and now I get as below.
Code: Select all
pi@raspberrypi4:~ $ sudo systemctl status domoticz.service
* domoticz.service - LSB: Home Automation System
Loaded: loaded (/etc/init.d/domoticz.sh; generated)
Active: active (running) since Tue 2021-01-05 10:38:40 GMT; 24h ago
Docs: man:systemd-sysv-generator(8)
Process: 474 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)
Tasks: 26 (limit: 4915)
CGroup: /system.slice/domoticz.service
`-583 /home/pi/domoticz/domoticz -daemon -www 8090 -sslwww 443
Jan 06 11:00:00 raspberrypi4 sudo[17794]: pam_unix(sudo:session): session closed for user root
Jan 06 11:00:00 raspberrypi4 sudo[17797]: root : TTY=unknown ; PWD=/home/pi/domoticz ; USER=root ; COMMAND=/usr/bin/sqlite3 /home/pi/domoticz/domoticz.db .
Jan 06 11:00:00 raspberrypi4 sudo[17797]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 06 11:00:00 raspberrypi4 sudo[17797]: pam_unix(sudo:session): session closed for user root
Jan 06 11:00:00 raspberrypi4 sudo[17800]: root : TTY=unknown ; PWD=/home/pi/domoticz ; USER=root ; COMMAND=/usr/bin/sqlite3 /home/pi/domoticz/domoticz.db p
Jan 06 11:00:00 raspberrypi4 sudo[17800]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 06 11:00:00 raspberrypi4 sudo[17800]: pam_unix(sudo:session): session closed for user root
Jan 06 11:00:00 raspberrypi4 sudo[17803]: root : TTY=unknown ; PWD=/home/pi/domoticz ; USER=root ; COMMAND=/usr/bin/sqlite3 /home/pi/domoticz/domoticz.db p
Jan 06 11:00:00 raspberrypi4 sudo[17803]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 06 11:00:00 raspberrypi4 sudo[17803]: pam_unix(sudo:session): session closed for user root
2021-01-06 11:13:00.210 Status: dzVents: Info: DB check: ------ Start internal script: DB_Check:, trigger: "at 11:13"
2021-01-06 11:13:00.253 Status: dzVents: Debug: DB check: Command select count(id) from deviceStatus; result ==>> OK
2021-01-06 11:13:00.289 Status: dzVents: Debug: DB check: Command .schema result ==>> OK
2021-01-06 11:13:00.477 Status: dzVents: Debug: DB check: Command pragma integrity_check; result ==>> OK
2021-01-06 11:13:00.512 Status: dzVents: Debug: DB check: Command pragma foreign_key_check; result ==>> OK
2021-01-06 11:13:00.512 Status: dzVents: Info: DB check: ------ Finished DB_Check
Everything is running but I see the session open session closed messages and have to Ctrl-C out of the query now.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
Seems quite legit to me. The log is showing what the script does.Calzor Suzay wrote: ↑Wednesday 06 January 2021 12:15 Everything is running but I see the session open session closed messages and have to Ctrl-C out of the query now.
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
-
- Posts: 145
- Joined: Tuesday 08 July 2014 15:10
- Target OS: -
- Domoticz version: 4.9700
- Location: UK
- Contact:
Re: Domoticz database check script
Ok just making sure, just have to Ctrl-C out of running the status update now, assumed it was stuck doing something and I have to quit it.
-
- Posts: 147
- Joined: Thursday 13 August 2015 13:36
- Target OS: NAS (Synology & others)
- Domoticz version: beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
I have installed this script but it reports the following error.
I can't see myself why this error is reported
I hope someone can help me or guide me what to do?
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.
I hope someone can help me or guide me what to do?
Best regards Bert
Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
You 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.
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
-
- Posts: 147
- Joined: Thursday 13 August 2015 13:36
- Target OS: NAS (Synology & others)
- Domoticz version: beta
- Location: Netherlands
- Contact:
Re: Domoticz database check script
Thank you Waaren, that was indeed the problem, how stupid of me.
Best regards Bert
Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
Synology DS1517+ - DSM 6.2
Raspberry PI2-B, Raspberry Nano - Raspberry PI3 - model B
Xiaomi Gateway - Philips HUE Lights - Zwave - RFXCom(E) with KaKu and other 433MHz devices - Yeelight Lights - Toon
Who is online
Users browsing this forum: No registered users and 0 guests