This is just a list of tips and tricks that I find useful and decided
to compile for easy retrieval. Most of these were found in the
I tried to attribute these snippets to the original source. If I came up
with something myself, no source is given. My apologies to all those that
published something along the same line before.
I have just come across a "cookbook", Domoticz Home Automation
Workbook by Robert W.B. Linn. It contains a great number of recipes and
the author continues to update this work. Highly recommended. Track the GitHub repository to always get the newest edition.
How to
- Add Custom Switch Icons
- Add Custom Switch Icons Saved in the Domoticz Database
- Add a Web Interface Theme
- Change a Virtual Sensor Label / Rename a Device Using a JSON API
- Clear a Custom Sensor Log with sqlite
- Clear a Scene Log with a JSON API
- Clear a Switch Log with a JSON API
- Clear a Text Log with a JSON API
- Delete a Record in a Device with Graphic Log
- Display Timer Plans in Settings
- Enable Scripts Executing System Calls Requiring Root Privileges
- Get the Domoticz Icon
- Get the Domoticz Source Code
- Manage and Select Timer Plans
- Retrieve a Scene Log with a JSON API
- Repair a "database disk image is malformed" Error with sqlite
- Select a Timer Plan with a JSON API
- Start Domoticz as a systemd Service
Source: | DIY Projects |
Title: | Domoticz: give a facelift by customizing the icons |
URL: | https://diyprojects.io/domoticz-give-facelift-customizing-icons/ |
Tested: | 2019-10-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
- Select a name for the icon (in this example MyIcon)
- Create three
png icons with transparent backgrounds:
- A 48x48 pixel ON image named "MyIcon48_ON.png"
- A 48x48 pixel OFF image named "MyIcon48_OFF.png"
- A 16x16 pixel ON image named "MyIcon.png"
The 16x16 image is used on floor plans, the 48x48 images are used
on device panels in the Web interface.
- Upload the three files to ~/domoticz/www/images on the Domoticz server.
- Add a line at the end of the ~domoticz/www/switch_icons.txt file. It
should contain three fields separated by a semi-colon ";"
MyIcon;My icon;This is my icon
The first field is the name of the icon (step 1).
The second field is the bold caption shown in the list of icons
The third field is the additional grey text shown in the list
The images will not be saved in the Domoticz database.
|
Source: | Domoticz Wiki |
Title: | Custom icons for webinterface |
URL: | https://www.domoticz.com/wiki/Custom_icons_for_webinterface |
Tested: | 2019-10-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
Create Icon Archive which can contain icons for one or more switch
- For each switch select a name for the icon (in this example MyIcon)
- For each switch create three
png icons with transparent backgrounds:
- A 48x48 pixel ON image named "MyIcon48_ON.png"
- A 48x48 pixel OFF image named "MyIcon48_OFF.png"
- A 16x16 pixel ON image named "MyIcon.png"
The 16x16 image is used on floor plans, the 48x48 images are used
on device panels.
- Create the
icons.txt file
- For each switch add a line in the
icon.txt file. Each line
must contain three fields separated by a semi-colon ";"
MyIcon;My icon;This is my icon
The first field is the name of the icon (step 1).
The second field is the bold caption shown in the list of icons
The third field is the additional grey text shown in the list
- Add all files (3 x number of switches image files + 1 text file) to an archive
Upload Icon archive
- Setup tab
- More Options
- Custom Icons
- Browse to the icon archive
- Click Upload button
The images will be saved in the Domoticz database.
|
Note |
Saving images for one and two device icons in an archive worked without
problem, but there were problems with three device icons in an archive.
|
Source: | Domoticz Forum, blauwebuis |
Title: | Aurora theme |
URL: | https://www.domoticz.com/forum/viewtopic.php?f=8&t=20960 |
Tested: | 2019-10-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
- pi@raspberrrypi:~ $ wget https://github.com/flatsiedatsie/domoticz-aurora-theme/archive/master.zip
- pi@raspberrrypi:~ $ unzip master.zip
- pi@raspberrrypi:~ $ mkdir domoticz/www/styles/aurora
- pi@raspberrrypi:~ $ cp -r domoticz-aurora-theme-master/* domoticz/www/styles/aurora
- pi@raspberrrypi:~ $ rm -r domoticz-aurora-theme-master/
- pi@raspberrrypi:~ $ mv master.zip downloads/domoticz-aurora-theme.zip
- In domoticz: Setup/Settings/System/Theme: aurora
- In domoticz: Apply Settings
|
Source: | Domoticz Wiki |
Title: | Domoticz API/JSON URL's, 7.5 Rename device / sensor |
URL: | https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Rename_device_.2F_sensor |
Tested: | 2019-05-21 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
- Get idx of sensor: {sensor_idx}
- Get host name or IP address of Domoticz server: {hostname_or_ip}
- Get Domoticz TCP port: {port}
- Send http request = http://{host_name_or_ip}:{port}/json.htm?type=setused&idx={sensor_idx}&name={new_label}&used=true
|
Examples: |
http://192.168.1.22:8080/json.htm?type=setused&idx=93&name=Today+is+Monday&used=true
http://192.168.1.22:8080/json.htm?type=setused&idx=93&name=Date:<span+style="float:+right;+font-weight:+bold">2019-10-31</span>&used=true
|
Note: |
Additional right justified text cannot be used with sensors, such as
switches, temperature and other weather sensors that already display
more than the sensor name. It works with text sensors as shown in the
second example above. |
Source: | Frustration Memory, Arjan |
Title: | Correcting values in Domoticz database |
URL: | https://frustrationmemory.blogspot.com/2017/04/correcting-values-in-domoticz-database.html |
Tested: | 2019-11-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
- Install
sqlite3 on desktop machine:
$ sudo apt install sqlite3
- Make a backup copy of the Domoticz database on the desktop computer. Do this from the Domoticz Web interface:
SetupSettingsBackup/RestoreBackup Database.
Keep track of where
Domoticz.db was saved. Assume from now on that it
was in /home/michel/temp alias ~/temp .
- Make a backup of the backup just in case:
$ cp temp/Domoticz.db temp/Domoticz.bak
- Open the database in
sqlite3 $ sqlite3 temp/Domoticz.db
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
- Issue a few commands that will make the display clearer.
sqlite> .header on
sqlite> .mode column
- Use the
SELECT command to find the custom sensor data.
This assumes that the custom sensor index number is 165.
sqlite> SELECT * FROM Percentage WHERE [DeviceRowID] = 165;
DeviceRowID Percentage Date
----------- ---------- -------------------
165 5.0 2019-11-17 13:00:00
165 5.0 2019-11-17 13:05:00
...
- Delete all entries for the device from the
Percentage table.
sqlite> DELETE FROM Percentage WHERE [DeviceRowID] = 165;
- Delete all entries for the decive from the
Percentage_Calendar table.
sqlite> DELETE FROM Percentage_Calendar WHERE [DeviceRowID] = 165;
- Check that the entries were deleted.
sqlite> SELECT * FROM Percentage WHERE [DeviceRowID] = 165;
sqlite> SELECT * FROM Percentage_Calendar WHERE [DeviceRowID] = 165;
- Quit
sqlite3 .
sqlite> .quit
- Restore the modified database from the Domoticz Web interface:
SetupSettingsBackup/RestoreRestore Database.
- If something is wrong, restore the backup database
Domoticz.bak
|
Note |
Instead of deleting all entries, data could be modified. See the
source for details.
|
Note |
It is possible to delete a single record from logged data in the
Domoticz Web interface; there must be a similar way of clear a log, but I have not found it.
|
Source: | |
Title: | |
URL: | |
Tested: | 2019-11-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
Assuming the index of the scene is 8, send an HTTP request to the Domoticz
server such as
http://192.168.1.22:8080/json.htm?type=command¶m=clearscenelog&idx=8
This can be done from a browser:
|
Source: | Domoticz Wiki |
Title: | History / Switch devices / Delete |
URL: | https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Delete |
Tested: | 2019-11-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
Send an HTTP request to the Domoticz server:
http://<DOMOTICZ_IP>:<DOMOTICZ_PORT>/json.htm?type=command¶m=clearlightlog&idx=<SWITCH_IDX>
Assuming the switch index is 12 and the Domoticz server IP is 192.168.1.22
and that the default port is used, then the request
http://192.168.1.22:8080/json.htm?type=command¶m=clearlightlog&idx=12
will clear the switch log. This can be done from a browser:
|
Source: | Domoticz Wiki |
Title: | History / Text devices / Delete |
URL: | https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Delete_2 |
Tested: | 2019-11-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
Send an HTTP request to the Domoticz server:
http://<DOMOTICZ_IP>:<DOMOTICZ_PORT>/json.htm?type=command¶m=clearlightlog&idx=<TEXT_IDX>
This the same for clearing a switch log.
|
Source: | Michael Visser (Visser I/O) |
Title: | How to delete an erroneous device record in Domoticz |
URL: | https://visser.io/2017/04/how-to-delete-an-erroneous-device-record-in-domoticz/ |
Tested: | 2019-10-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
- Open up Domoticz in your preferred web browser
- Open up the device log screen for the device in question (in my case a Utility device)
- With your mouse hover over the bad reading
- Hold down SHIFT on your keyboard and left click the bad reading
- A confirmation screen will appear, check the date/time and value is the bad value and hit OK
|
Source: | dragonpi |
Title: | Re: Timer Plan is empty in settings |
URL: | https://www.domoticz.com/forum/viewtopic.php?f=6&t=25180&p=193857&hilit=timer+plan#p224044 |
Tested: | 2019-10-19 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
If nothing displayed: press F5
|
Source: | DomoticzCH; waaren, |
Title: | Restart/Shutdown when running as non root user;
Re: Script to fire a command to a router through SSH
|
URL: | https://www.domoticz.com/forum/viewtopic.php?p=275337#p275337;
https://www.domoticz.com/forum/viewtopic.php?p=232883#p232883
|
Tested: | 2022-06-22 |
Domoticz: | 2021.1 (build 13330) |
How: |
- Make sure that the Domoticz user (usually
pi ) is a member of the sudo group.
pi@raspberrypi:~ $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi
- Add the following line after the similar line beginning with
%sudo in /etc/sudoers
pi ALL=(ALL:ALL) NOPASSWD: ALL
with the visudo utility:
pi@raspberrypi:~ $ visudo
- Alternatively create the file
pi@raspberrypi:~ $ visudo -f /etc/sudoers.d/pi-no-passwd
containing that single line.
|
Note |
In Linux, a Domoticz launched script that executes a system call requiring root privileges will only work if
- the user is a member of the sudo group and if
- a password is not required for the user.
For example, the script script_time_domoticzAlive.lua with the following command
os.execute('sudo touch /tmp/domoticz.alive')
would not be executed properly because the sudo touch command wants the password for user pi
even if pi is a member of the sudo group. Here is the system log entry showing the error.
Jun 22 18:13:00 raspberrypi domoticz[375]: sudo: no tty present and no askpass program specified
Jun 22 18:13:00 raspberrypi sudo[1832]: pam_unix(sudo:auth): conversation failed
Jun 22 18:13:00 raspberrypi sudo[1832]: pam_unix(sudo:auth): auth could not identify password for [pi]
Jun 22 18:13:00 raspberrypi domoticz[375]: 2022-06-22 18:13:00.471 Status: LUA: script_time_domoticzAlive.lua
|
Source: | |
Title: | |
URL: | |
Tested: | 2024-01-13 |
Domoticz: | n/a |
How: |
Download domoticz.ico from the following link https://raw.githubusercontent.com/domoticz/domoticz/development/msbuild/domoticz.ico.There are numerous ways of downloading the .ico file.
- Click on the image with the right mouse button. Choose to save the image file in the context menu. The exact label of the menu choice will depend on the browser used.
- wget "https://raw.githubusercontent.com/domoticz/domoticz/development/msbuild/domoticz.ico"
- curl "https://raw.githubusercontent.com/domoticz/domoticz/development/msbuild/domoticz.ico" -o domoticz.ico
|
Notes: |
|
Source: | |
Title: | |
URL: | |
Tested: | 2024-01-13 |
Domoticz: | n/a |
How: |
The source code is available in the GitHub Repository: https://github.com/domoticz/domoticz. Here are some methods to retrieve the code.
- The repository can be cloned if
git is installed on the computer. Use the address https://github.com/domoticz/domoticz.git
- Click on the
Download ZIP link in the pop-up window displayed when the <> Code v button is pressed.
- Go to the latest release and download the
Source code as a zip or tar.gz archive.
|
Source: | |
Title: | |
URL: | |
Tested: | Latest: 2024-01-13. Original: 2019-10-18 |
Domoticz: | Latest: 2023.2, Build Hash: 19efd039c, Date: 2023-07-21 12:23:44.
Original: 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
Create, delete, rename timer plans
- Click on the Setup tab
- Click on More Options
- Click on Plans
- Click on TimerPlan (if nothing visible press F5)
Select a timer plan
- Click on the Setup tab
- Click on Settings
- Click on Other
- Select the desired plan in the Timer Plan: combo box.
- Click on Apply Settings
|
Source: | Domoticz Forum, Flopp |
Title: | FIX for The database disk image is malformed |
URL: | https://www.domoticz.com/forum/viewtopic.php?f=28&t=10984 |
Tested: | 2020-05-31 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
- Install
sqlite3 on desktop machine:
$ sudo apt install sqlite3
- Make a backup copy of the Domoticz database on the desktop computer. Do this from the Domoticz Web interface:
SetupSettingsBackup/RestoreBackup Database.
Keep track of where
Domoticz.db was saved. Assume from now on that it
was in /home/michel/temp alias ~/temp .
- Make a backup of the backup just in case:
$ cp temp/Domoticz.db temp/Domoticz.bak
- Open the database in
sqlite3 $ sqlite3 temp/Domoticz.db
SQLite version 3.22.0 2018-01-22 18:45:57
Enter ".help" for usage hints.
- A list of errors can be displayed.
sqlite> pragma integrity_check;
*** in database main ***
On tree page 116 cell 69: Rowid 13668 out of order
On tree page 409 cell 26: 2nd reference to page 483
...
row 50 missing from index ll_id_date_idx
row 51 missing from index ll_id_date_idx
- Dump the database.
sqlite> .output dump.sql
sqlite> .dump
sqlite> .exit
- Using a text editor change the last line in
~/temp/dump.sql from
ROLLBACK; -- due to errors
to
COMMIT;
- Re-create the database.
$ sqlite3 temp/fixed.db < temp/dump.sql
- Test that the fixed database is ok.
$ sqlite3 temp/fixed.db
sqlite> pragma integrity_check;
ok
- Quit
sqlite3 .
sqlite> .quit
- Restore the fixed database (
~/temp/fixed.db ) using the Domoticz Web interface: SetupSettingsBackup/RestoreRestore Database.
- If something is wrong, restore the backup database
Domoticz.bak
|
Source: | |
Title: | |
URL: | |
Tested: | 2019-11-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
Assuming the index of the scene is 8, send an HTTP request to the Domoticz
server such as
http://192.168.1.22:8080/json.htm?type=scenelog&idx=8
This can be done from a browser:
|
Source: | broxtor |
Title: | Re: Use switch to disable setpoint timers [Solved] |
URL: | https://www.domoticz.com/forum/viewtopic.php?f=59&t=28361&p=217753&hilit=setactivetimerplan#p217753 |
Tested: | 2019-10-18 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
http://<host_ip:port>/json.htm?type=command¶m=setactivetimerplan&ActiveTimerPlan=<n>
where <n> is the index of the plan. Usually plan Default is 0.
|
Note |
If this is the action of a selector switch for example, then the
Switches tab is not refreshed so the Timers button are not updated.
Conversely, selecting a TimerPlan in Setup/Settings/Other will not update
the value of the selector switch. |
Source: | |
Title: | |
URL: | |
Tested: | 2019-12-08 |
Domoticz: | 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08 |
How: |
- Create the unit file
/etc/systemd/system/domoticz.service .
[Unit]
Description=domoticz_service
After=time-sync.target
[Service]
User=pi
Group=users
ExecStart=/home/pi/domoticz/domoticz -www 8080 -sslwww 443
WorkingDirectory=/home/pi/domoticz
AmbientCapabilities=CAP_NET_BIND_SERVICE
Restart=on-failure
RestartSec=1m
[Install]
WantedBy=multi-user.target
- Stop the Domoticz service
- Delete the old
init script /etc/init.d/domoticz.sh
- Reload daemons
- Start the Domoticz service
- Enable the service for auto starting at boot.
|
Note |
The After=time-sync.target condition will guarantee that
the system time is updated before starting Domoticz. This avoids the startup
crash that happens when restarting systems without a functioning real time
clock that have been down for more than six minutes or so. See The Domoticz Time
Synchronization Problem.
|