Icons included by default in Domoticz are a little old and do not always meet our needs. Fortunately it is possible to customize some of them quite simply. This method applies to the following devices: Media Player and ON / OFF
How to create new icons for Domoticz
Domoticz didn’t need a specific icons file. Domoticz manages just two States (ON / OFF) from 2 images. You can retrieve images from another Open Source automation software files or prepare your own. To simply create new icons, the easiest is to start from a design in a vector format (SVG). For example on the website Flaticon you can find very many files vector available for free (as long as you quote the author!). You can also take a look on the side iconfinder.
Here is what one finds for example with the key word garage door (and Yes, it will a do a little Google transat to find the right keywords). I selected the two icons on the second line. The closed door is checked.
If you quote the author of icons, you can download them for free.
The download starts immediately after (my-icons-collection). After decompression, go to the svg directory to find the recovered icons.
Now we can personalize them with a vector drawing software. If you do not, there are several Open Source and free. The easiest is the drawing of free Office module ( https://libreoffice.org ). Inskscape (https://inkscape.org/) is also a very good choice if you want to get into more complex icons.
Launch Libre Office and open a new drawing. Open the vector image (svg file). For example, I created on a first page one OFF with a Green State wording FARM and on a second page a State WE (OPEN label).
Now we can export these two images in PNG format (file-> Export…)
Give a file name and respect the formalism of Domoticz for each State ON and OFF (48_On and 48_Off).
In the selection list, choose Pixels and enter 48. Finish with OK.
Open a FTP connection (read this article if you do not know how) and drop the two files in the directory domoticz /www/images.
Install new icons on a server Domoticz
Now that we have our new icons, it is to install and configure Domoticz to use them. Open a SSH connection or connect you to your Domoticz directly on the Raspberry.
Let’s start by editing the file switch_icons.txt , which is located in the directory www folder domoticz
sudo nano domoticz/www/switch_icons.txt
the configuration file looks like this. It for 19 default icons.
Light;Light/Switch;A Lamp or Switch WallSocket;Wall Socket;Power Wall Socket TV;Television;Television Screen Harddisk;Hard disk;Hard disk drive Printer;Printer;Printer Amplifier;Amplifier;Device that controls audio Computer;Computer Laptop;Personal Computer System Fan;Fan;Airflow Producer Speaker;Speaker;Audio Speaker Generic;Generic;Generic On/Off switch Fireplace;Fireplace;Fireplace Water;Water;Water Media;Media Player;Multi Media player Alarm;Alarm;Alarm ChristmasTree;Christmas Tree;Christmas Tree Heating;Heating;Heating device Cooling;Cooling;Cooling device ComputerPC;Computer PC;Personal Computer System Phone;Phone;Mobile Phone
Each line corresponds to an icon. The line includes 3 names:
- the name of the image file by removing (48_On.png or 48_Off.png)
- the wording of the icon (shown in bold)
- a sub-caption (an optional additional information)
note. You can take the opportunity to translate the labels of the icons by the way
Best is to declare your personal icons at the end of the list. Domoticz built the selection list by sorting alphabetically labels of the configuration file. Save the file with Ctrl + X then O (or Y).
Add a new line of declaration of the garage icon
Garage; Garage; Door
we restart the Domoticz service to take into account the new configuration file.
sudo service domoticz.sh restart
Also refresh the browser.
Edit now a device, a type switch On / OFF. In the list of choices, you will find your new icon. Save the change.
And here, your device is now customized. To get a better look, it is best to make icons with a transparent background.
Other sources of Open Source icons