md
Domoticz Tips, Tricks & Info
Last Revision: November 18, 2019. Original Version: October 18, 2019

This is just a list of tips and tricks that can be found in the Domoticz documentation, Wiki or Forum that I find useful and decided to compile for easy retrieval. I tried to attribute these snippets to the original source. If I came up with something myself, no source is given. My apologies if someone else published something along the same line before.

How to

  1. Add Custom Switch Icons
  2. Add Custom Switch With Icons Saved in Database
  3. Add a Web Interface Theme
  4. Change a Virtual Sensor Label / Rename a Device Using a JSON API
  5. Clear a Custom Sensor Log with sqlite
  6. Clear a Scene Log with a JSON API
  7. Clear a Switch Log a JSON API
  8. Clear a Text Log a JSON API
  9. Delete a Record in a Device with Graphic Log
  10. Display Timer Plans in Settings
  11. Manage and Select Timer Plans
  12. Retrieve a Scene Log with a JSON API
  13. Select a Timer Plan with a JSON API

How to Add Custom Switch Icons toc

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:
  1. Select a name for the icon (in this example MyIcon)
  2. 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.
  3. Upload the three files to ~/domoticz/www/images on the Domoticz server.
  4. 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.

How to Add Custom Switch With Icons Saved in Database toc

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
  1. For each switch select a name for the icon (in this example MyIcon)
  2. 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.
  3. Create the icons.txt file
  4. 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
  5. Add all files (3 x number of switches image files + 1 text file) to an archive
Upload Icon archive
  1. Setup tab
  2. More Options
  3. Custom Icons
  4. Browse to the icon archive
  5. 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.

How to Add a Web Interface Theme toc

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:
  1. pi@raspberrrypi:~ $ wget https://github.com/flatsiedatsie/domoticz-aurora-theme/archive/master.zip
  2. pi@raspberrrypi:~ $ unzip master.zip
  3. pi@raspberrrypi:~ $ mkdir domoticz/www/styles/aurora
  4. pi@raspberrrypi:~ $ cp -r domoticz-aurora-theme-master/* domoticz/www/styles/aurora
  5. pi@raspberrrypi:~ $ rm -r domoticz-aurora-theme-master/
  6. pi@raspberrrypi:~ $ mv master.zip downloads/domoticz-aurora-theme.zip
  7. In domoticz: Setup/Settings/System/Theme: aurora
  8. In domoticz: Apply Settings

How to Change a Virtual Sensor Label / Rename a Device Using JSON API toc

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:
  1. Get idx of sensor: {sensor_idx}
  2. Get host name or IP address of Domoticz server: {hostname_or_ip}
  3. Get Domoticz TCP port: {port}
  4. 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

How to Clear a Custom Sensor Log with sqlite toc

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:
  1. Install sqlite3 on desktop machine:
    $ sudo apt install sqlite3
  2. Make a backup copy of the Domoticz database on the desktop computer. Do this from the Domoticiz 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.
  3. Make a backup of the backup just in case:
    $ cp temp/Domoticz.db temp/Domoticz.bak
  4. 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.
  5. Issue a few commands that will make the display clearer.
    sqlite> .header on
    sqlite> .mode column
    
  6. 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
    ...
  7. Delete all entries for the device from the Percentage table.
    sqlite> DELETE FROM Percentage WHERE [DeviceRowID] = 165;
    
  8. Delete all entries for the decive from the Percentage_Calendar table.
    sqlite> DELETE FROM Percentage_Calendar WHERE [DeviceRowID] = 165;
    
  9. Check that the entries were deleted.
    sqlite> SELECT * FROM Percentage WHERE [DeviceRowID] = 165;
    sqlite> SELECT * FROM Percentage_Calendar WHERE [DeviceRowID] = 165;
    
  10. Quit sqlite3.
    sqlite> .quit
    
  11. Restore the modified database from the Domoticiz Web interface: SetupSettingsBackup/RestoreRestore Database.
  12. 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 Domoticiz Web interface; there must be a similar way of clear a log, but I have not found it.

How to Clear a Scene Log with a JSON API toc

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 Domoticiz server such as
http://192.168.1.22:8080/json.htm?type=command&param=clearscenelog&idx=8
This can be done from a browser:

How to Clear a Switch Log with a JSON API toc

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 Domoticiz server:
http://<DOMOTICIZ_IP>:<DOMOTICIZ_PORT>p;/json.htm?type=command&param=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&param=clearlightlog&idx=12
will clear the switch log. This can be done from a browser:

How to Clear a Text Log with a JSON API toc

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 Domoticiz server:
http://<DOMOTICIZ_IP>:<DOMOTICIZ_PORT>p;/json.htm?type=command&param=clearlightlog&idx=<TEXT_IDX>
This the same for clearing a switch log.

How to Delete a Record in a Device with Graphic Log toc

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:
  1. Open up Domoticz in your preferred web browser
  2. Open up the device log screen for the device in question (in my case a Utility device)
  3. With your mouse hover over the bad reading
  4. Hold down SHIFT on your keyboard and left click the bad reading
  5. A confirmation screen will appear, check the date/time and value is the bad value and hit OK

How to Display Timer Plans in Settings toc

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

How to Manage and Select Timer Plans toc

Source:
Title:
URL:
Tested: 2019-10-18
Domoticz: 4.10717, Build Hash: b38b49e5, Date: 2019-05-09 08:04:08
How: Create, delete, rename timer plans
  1. Setup tab
  2. More Options
  3. Plans
  4. TimerPlan (if nothing visible press F5)
Select a timer plan
  1. Setup tab
  2. Settings
  3. Other
  4. Timer Plan: select desired plan
  5. Click on Apply Settings

How to Retrieve a Scene Log with a JSON API toc

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 Domoticiz server such as
http://192.168.1.22:8080/json.htm?type=scenelog&idx=8
This can be done from a browser:

How to Select a Timer Plan With the JSON API toc

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&param=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.