Page 1 of 1

Adding custom icons simple explanation

Posted: Wednesday 15 May 2024 23:28
by Tukker
I had some trouble interpreting the wiki about custom icons plus I want to add information about how to change the Icon in a text dummy.

1) Create a nice icon by asking ChatGPT or Microsoft Copilot to draw a picture for you. Try different options to create a simple drawing of the object you want to have an icon from.
2) open https://domoticz-icon.aurelien-loyer.fr/ , give your icon a name and use the same drawing twice for on and of or use different colored pictures for on and off.
Adjust the position of the part of the picture you want to be used for your icons..
3) Let the website generate a zip file.
4) In Domoticz goto Setup -> More Options -> Custom Icons and upload your zip file.
5) Now you can use your new icon in the sensors and actors of Domoticz

To use your new icon to dynamicaly change the icon (like different icons depending on the weatherforecast) you can proceed as follows:
5) SSH to your domoticz server and cd domoticz
6) sudo sqlite3 -header domoticz.db " select id+100 id ,name from customimages"
6) make a note of the number of your icon (101, 102, 103 or whatever is displayed)
7) The dzvents code to change the icon of a txt dummy sensor is domoticz.devices('name_of_dummy_txt_sensor').setIcon(icon_number_in_sqlite)
8) Refresh your screen using Ctrl-F5 et voilá there's your icon.

Re: Adding custom icons simple explanation

Posted: Thursday 16 May 2024 0:23
by waltervl
Why would you need DzVents to change the icon for a text device? You can do that with the edit button on the device like the other devices.

Additional the easiest way to get the custom icon number is to go to the custom icon page (menu Setup - Other - Custom Icons) and count, starting with 101. First from left to right and then going a row down. For example:
101, 102, 103
104, 105, Etc

Re: Adding custom icons simple explanation

Posted: Thursday 16 May 2024 14:00
by psubiaco
Thanks for the explanation.
It will be super to collect several customs icons in a Domoticz repository, so they can be added in the next Domoticz versions.
Domoticz by default has very very few icons available, and I'm too lazy to add customs icons!

Re: Adding custom icons simple explanation

Posted: Thursday 16 May 2024 14:06
by waltervl
psubiaco wrote: Thursday 16 May 2024 14:00 Thanks for the explanation.
It will be super to collect several customs icons in a Domoticz repository, so they can be added in the next Domoticz versions.
Domoticz by default has very very few icons available, and I'm too lazy to add customs icons!
It is not that simple as you have to create an install script to fill the database with the custom image data too.

Re: Adding custom icons simple explanation

Posted: Thursday 16 May 2024 14:14
by janpep
waltervl wrote: Thursday 16 May 2024 0:23 Why would you need DzVents to change the icon for a text device? You can do that with the edit button on the device like the other devices.
In general, that is of course correct. However, there are circumstances where it is desirable to change the icons from a script. That's why it was made possible. An example of this, with cnanging of weather icons, I just posted in Configurable 'KNMI Weerlive' script.

Re: Adding custom icons simple explanation

Posted: Thursday 16 May 2024 22:22
by waltervl
I understand that but from the original instruction in the first post I got the impression that for a text device you could only do that by dzvents and not by manual edit.

But I see the start topic has been changed to a better instruction. But still steering users to use SQLite to query the database.

Re: Adding custom icons simple explanation

Posted: Thursday 16 May 2024 22:52
by janpep
Yes, I think your counting method or the https://yourIP:yourport/#/Custom/ShowAllDeviceValues that I mentioned is easier for most users.

Re: Adding custom icons simple explanation

Posted: Thursday 16 May 2024 23:18
by waltervl
janpep wrote: Thursday 16 May 2024 22:52 Yes, I think your counting method or the https://yourIP:yourport/#/Custom/ShowAllDeviceValues that I mentioned is easier for most users.
I do not know what you have custom but that is not working for me. What does work is this undocumented API call:

Code: Select all

/json.htm?type=command&param=getcustomiconset

Re: Adding custom icons simple explanation

Posted: Friday 17 May 2024 9:13
by janpep
Oh, this is very stupid of me!
I meant:

Code: Select all

https://yourIP:yourport/json.htm?type=command&param=getdevices&plan=0
I use it so often that I included it in a custom page, so that I can easily access it from the menu. I had pasted the URL of that page into the message without a second thought. My apologies for the confusion. I will correct it in my other Weerlive post.

BTW. I did the same with the command to see all schedules. You can see it with:

Code: Select all

https://yourIP:yourport//json.htm?type=schedules
I find it very useful to quickly find all kinds of details this way.