Troubleshooting
After installing new hardware or a new update domoticz sometime seems to fail.
Now this could happen if you are running a beta version, but 99,9% of the time this has no relationship with the beta version at all,
and even more so, nothing changed on the part where they have problems with.
So what could be wrong ?
User account
By default Domoticz is protected by a username (admin) and password (domoticz).
Please either change the password as soon as possible (trough menu Setup - My Profile) or create a different admin user and remove the default (admin) user.
Forgotten password: see the Lost Username Password page
Browser Cache
The web frontend uses javascripts to connect with the server.
If for some reason, the page does not load correctly in Firefox / Chrome / Edge, refresh these scripts. Mostly this can be done with CTRL-F5 to refresh all Domoticz javascripts.
Also trying to start Domoticz in a incognito/private browser session can indicate javascript issues if it runs there.
Check the Domoticz log files
Check the Domoticz Log file for hints. Go to menu Setup - Log
to see the Domoticz log. In the web this is a limited log file of only the last 300 lines.
So try to check this log file when the issue starts. If the issue cannot be found in the log or when the web UI is not working you can activate logging to OS-file.
Alternative you can stop the Domoticz Service and start Domoticz manually. Possible issue will appear in the terminal screen logging.
cd domoticz sudo service domoticz stop
Test if domoticz can be started by hand:
./domoticz
Additional you can start domoticz with extra parameters eg ./domoticz -www 8080 -sslwww 443 -log "/var/log/domoticz.log"
For more info on command line parameters see wiki page Command line parameters
For extra debug logging start domoticz manually with debug flags eg:
./domoticz -www 8080 -sslwww 443 -log "/var/log/domoticz.log" -loglevel all -debuglevel normal,auth,hardware,received,webserver,eventsystem,python,thread_id
If issue is solved you can start domoticz service again
sudo service domoticz start
Activate logging to OS-file (with or without debugging)
The log section in the Domoticz browser shows a max of 300 most recent log lines. This could be to small to check older issues so you can direct the logging to a log file.
Be aware, this can become a large file!
The domoticz logfile location and other settings are defined in /etc/init.d/domoticz.sh
the relevant settings are in set to the DAEMON_ARGS
with a text editor of choice:
DAEMON_ARGS="$DAEMON_ARGS -log /var/log/domoticz.log" # or any other OS file #DAEMON_ARGS="$DAEMON_ARGS -loglevel normal,status,error, debug" # debug disabled for now DAEMON_ARGS="$DAEMON_ARGS -loglevel normal,status,error" # these loglevels will make it to the logfile #DAEMON_ARGS="$DAEMON_ARGS -debuglevel normal,hardware,received,webserver,eventsystem,python,thread_id"
sudo systemctl daemon-reload sudo service domoticz stop sudo service domoticz start sudo tail -f /var/log/domoticz.log
The system and other logfiles can be found with sudo ls -lrt /var/log/*log
Crash log
When Domoticz really crashes a domoticz_crash.log file is created in the domoticz install folder eg /home/<user>/domoticz.
In this crash log you can search for the phrase signal_handler
that will show which thread caused the crash of Domoticz. The thread name (plugin/hardware/module) is is listed in the beginning of the crash log.
To open the crash log you normally need root (also called administrator) rights. Use for example sudo cat domoticz_crash.log
Scripts
Domoticz can make use of scripts (Lua, Python, Blockly, dzVents etc). It could be there is a problem with one of the scripts.
- Maybe updating a virtual sensor via JSON with invalid parameters.
- Try disabling the eventsystem in Domoticz (from the Setup - Settings)
- Rename the 'scripts' and 'plugin' folder in
/home/<user>/domoticz/
to prevent the scripts and plugins from running loading and running. Enable them one by one to debug.
Hardware
There could be a problem with one of the added hardware in Domoticz.
- Disable all hardware in Domoticz (Not 'delete', just 'disable') If you are unable to do this because Domoticz does not start, download a SQLite editor (for example SQLite Expert Personal Edition), open the database, go to the 'hardware' table and disable all hardware here (put a 0 (zero) under the enabled column)
- Alternative to disable hardware or plugin from commandline
cd <domoticz dir>
sudo service domoticz stop
sudo sqlite3 -header -list domoticz.db "SELECT Name, ID, Enabled FROM Hardware" -- get ID of misbehaving plugin
sudo sqlite3 -header -list domoticz.db "UPDATE Hardware set Enabled = 0 where ID = <ID of misbehaving plugin>" -- disable
sudo service domoticz start
- Now Domoticz should start, if that is the case:
- Enable ONLY 1 hardware ... test with this for at least a few hours (maybe a day!) until you are 100% sure this hardware is functioning properly, and only then, enable another hardware, and perform the same test, and when this is functioning, enable another -
- If during the test period Domoticz will crash, you know what hardware is causing the issue
Database
Sometimes an sqlite database database becomes corrupted. There can be many reasons but luckily it does not happen very frequent.
More details can be found at How to corrupt a sqlite database Typically you see something like "database disk image is malformed"
or something similar. Worst case domoticz crashes or does not start.
Alternatively to browse through the SQLITE database install "DB Browser for SQLite": https://sqlitebrowser.org
Possible solutions for Linux and Windows based systems below.
Linux
Below check and repair actions for Linux based systems are written with the assumption that the sqlite3 program is installed. If that is not the case, it can be installed with
sudo apt install sqlite3
Check database
sudo service domoticz stop
cd <your domoticz directory>
sudo cp domoticz.db domoticz.keep # just to be sure
sudo sqlite3 domoticz.db 'SELECT name as Tablename ,SUM("pgsize")/4096 Size FROM "dbstat" WHERE name IN (SELECT name FROM "sqlite_master" WHERE type == "table" ) GROUP BY name HAVING Size > 10 ORDER BY size DESC;' # show size of tables. If preferences is in the list your problem is there
sudo sqlite3 domoticz.db "SELECT Key, LENGTH(SValue) size FROM Preferences WHERE LENGTH(sValue) > 1000;" # To identify the row
sudo sqlite3 domoticz.db "UPDATE Preferences SET sValue ='' WHERE LENGTH(sValue) > 1000"
sudo sqlite3 domoticz.db "vacuum"
sudo sqlite3 domoticz.db "PRAGMA integrity_check(10000)"
sudo sqlite3 domoticz.db "PRAGMA foreign_key_check"
sudo service domoticz start # When no other errors found
Repair database
This instruction requires sqlite3 v 3.29 or newer.
sudo service domoticz stop
cd /home/pi/domoticz # or other directory if domoticz is in another place
sudo cp domoticz.db domoticz.2repair
sudo service domoticz start
sudo sqlite3 domoticz.2repair
sqlite>.out dump.sql
sqlite>.recover
sqlite>.dump
sqlite>.quit
sudo sed -i '$ s/ROLLBACK;/COMMIT;/g' dump.sql # change last line in dump to prevent rollback and recover as much as possible
sudo sqlite3 domoticz.repaired < dump.sql
sudo sqlite3 domoticz.repaired
sqlite> pragma integrity_check;
sqlite> # other checks you want to do
sqlite> .quit
sudo service domoticz stop
sudo cp domoticz.repaired domoticz.db
sudo service domoticz start
Windows (or Linux with Desktop GUI)
Below check and repair actions for Windows based systems (or Linux systems with a Desktop GUI) are written based on the assumption that the "DB Browser for SQLite" (verzion >= 3.12.1 is installed. If that is not the case, it can be downloaded from sqlitebrowser.org
When opening the domoticz database with DB Browser for SQLite you will see something like
Check database
Tools => Integrity Check
Problems will be reported in a separate window segment.
When errors are encountered proceed with repair actions (see next alinea)
Repair database
File => Export => Database to SQL file
Save using a describing name (e.g. malformed) type SQL with options "Export everything" and "Keep old schema"
Close database
Check the last line of the created text file and if the line is ROLLBACK; change this into COMMIT;
File => Import => Database from SQL file => (e.g. malformed)
database name using a describing name (e.g. repaired)
save the changes and copy the repaired database to replace your malformed database.
Other problems
If Domoticz does not start working with the above steps, try the below options
Domoticz stops randomly
When Domoticz stops randomly without proper indication check:
- Power supply. Some powersupplies are failing after a while. Also adding an USB stck (Zigbee, Zwave etc) could increase power usage that your power supply cannot handle.
- SD card is starting to fail. Be sure you have a backup ready. Even better to invest in an SSD solution.
Domoticz stops or installation fails after an OS update
On some RPi OS'es there are some issues after an OS update causing installation of Domoticz to fail:
1. /dev/serial/by-id is gone resulting in problamatic USB drive assignments
2. Domoticz is seen as a 64 bit application on a 32 bit machine
For a solution go to forum topic https://www.domoticz.com/forum/viewtopic.php?t=40536
Domoticz stops after a new Beta update
Sometimes the changes in a Beta release will cause issues. The Beta update script automatically creates a backup of your complete environment for easy restore.
See the following page for instructions: Raspberry Pi#Revert to backup after incorrect beta update.
Linux filesystem rights (Raspberry)
login with the user that you used to install Domoticz (on a raspberry pi this is the 'pi' user) then issue:
cd domoticz sudo service domoticz stop sudo chown -R pi.pi *
Test if domoticz can be start by hand:
./domoticz
Now Domoticz should run, or tell you what the problem is, if it runs correctly press 'control-C' to stop it, and start the service
sudo service domoticz start
Domoticz stops after cold boot
When booting after a cold boot (no power attached or power failure) some users on Raspberry Pi report that Domoticz will run shortly and then stop.
This could be related with time settings that only can be restored after internet connection. Domoticz standard waits 30 seconds until time sync has occured.
Possible solutions for older versions or when your internet connection takes longer then 30 seconds to startup are:
- Add a battery powered Real Time Clock (RTC) so your systems knows the time directly after booting.
- Put a x seconds delay in the startup of Domoticz to give the system time to update time settings using Command line parameter -startupdelay
- use crontab and add
@reboot sleep 180 && /etc/init.d/domoticz.sh restart
This will restart Domoticz after 180 seconds. - force 'wait for network' to boot your RPi:
sudo raspi-config nonint do_boot_wait 0
- Start Domoticz manually after a cold boot:
sudo service domoticz restart
- update
/etc/init.d/domoticz.sh
to current version fromdomoticz/domoticz.sh
and change line 70count=30
tocount=nnn
seconds to change the standard 30 seconds wait for internet connection is enabled. - install ntpdate.
sudo apt-get install ntpdate
and put this as the first line in the do_start section in the file /etc/init.d/domoticz.sh
ntpdate nl.pool.ntp.org
This code will wait until time is set and then continue to start Domoticz
Revert to backup after incorrect beta update
For Beta updates an automatic backup of the complete domoticz environment including scripts and plugins is created in domoticz/backups/domoticz_backup_yyyymmdd_hhmmss.tar.gz
by the update script.
To extract that backup:
- enter domoticz backup directory (where domoticz store a backup before upgrading)
cd ~pi/domoticz/backups
- run tar command to extract the backup (specify the right filename and correct domoticz folder)
tar xvzf domoticz_backup_yyyymmdd_hhmms.tar.gz -C /home/pi/domoticz
- restart domoticz
service domoticz restart
Always refresh the browser cache after an update!
Monitoring Domoticz
Software crashes, it's a fact of life. Luckily there are a number of ways to keep an eye on Domoticz, and automaticallty restart it if it crashes.
See the wiki page Monitoring Domoticz for more information.
Please feel free to make changes to this page if needed