Page 1 of 1

setIcon issue

Posted: Sunday 26 April 2020 18:50
by hestia
Hi,
I've a dummy device (selector idx 1105) and 1 icon (id 136)
and this script

Code: Select all

-- Icon changer

return  {   on =    {  
                       devices         = {1105},                    	},
        logging = 
                    {
                        level       = domoticz.LOG_DEBUG,  -- switch to LOG_ERROR when OK
                        marker      = 'setIcon'
                    },

    execute = function(dz, item)

            item.setIcon(136)

    end
}
Nothing happens when I click the device :-(

Version: 2020.2
Build Hash: b63341bc0
Compile Date: 2020-04-26 13:47:55
dzVents Version: 3.0.2

Re: setIcon issue

Posted: Sunday 26 April 2020 22:06
by waaren
hestia wrote: Sunday 26 April 2020 18:50 I've a dummy device (selector idx 1105) and 1 icon (id 136)
Nothing happens when I click the device :-(
Works for me after refeshing cache.
Did you try to refresh browsercache ?

Re: setIcon issue

Posted: Sunday 26 April 2020 22:44
by hestia
Yes and to it again
I've tried before the upgrade to 2020.2 and after. And after upgrading I've refresh the browser cache and the app cache.
And I've checked w incognito mode.

Just to be sure, my table. I understood I have to put the ID of the CustomImages table
Spoiler: show
1 Motion Motion Motion Icon
2 Heater Heater Heater
3 Garagedoor Garagedoor Garagedoor logo
4 HW HW HotWater
5 Venting Venting Venting
6 Venting2 Venting Venting
7 plug Plug Device plugged
28 Pluie Pluie Prevision Pluie
29 Presence Presence Gestion de la presence
30 Net Net Test Connection internet
32 idetect-unithome iDetect Unit Present Unit Present
33 idetect-override iDetect override Unit override
34 azimuth azimuth azimuth
35 sunAltitude sunAltitude sunAltitude
50 Fan Fan Fan On/Off
59 Heating Heating Heating On/Off
81 Printer Printer Printer On/Off
82 Rain Rain Rain On/Off
106 Water Water Water On/Off
113 Cloud Cloud Cloud icon
114 DimRot DimRot Dimmer
115 DayNight DayNight DayNight
116 wan Internet Internet
117 RGB-LEDs RGB LED strip 2 Icon for RGB LED strips
118 lamp Lamp Lamp
119 Lumen Lumen Lumen
121 userfemale User (Female) Female user icon
122 usermale User (Male) Male user icon
123 person Person Person
126 XmasStar Christmas Star Lamp Christmas Star Lamp
127 home home Iemand_Thuis
128 homeS homeS homeS
129 LED RGBW Led A RGBW Led
130 trashcan Trashcan Trashcan
135 doorbell5 doorbell5 doorbell5
136 AlarmClockA AlarmClockA AlarmClockA
137 AlarmClockB AlarmClockB AlarmClockB
Because I could get some changes, but not with the icon I'd want!
If I put 4, I have the printer and not the HotWater!

Re: setIcon issue

Posted: Sunday 26 April 2020 23:35
by waaren
hestia wrote: Sunday 26 April 2020 22:44 Yes and to it again
I've tried before the upgrade to 2020.2 and after. And after upgrading I've refresh the browser cache and the app cache.
If I put 4, I have the printer and not the HotWater!
Have not analyzed how this custom Icon stuff works internally in the domoticz code but I recently translated the moonphase Lua scripts to dzVents and in the github README for this Lua implementation, I read that the custom icon numbers must start with 100. When I test these moonphase icons (numbered 100 - 107) on a selector device they work as good as the internal icons (so also without issues).

Maybe something to investigate for you ?

Re: setIcon issue  [Solved]

Posted: Tuesday 28 April 2020 22:40
by hestia
It was difficult to find the rule as the way it is done is a bit ... strange
Regarding the CustomImages table, you have to add 100 to the ID to get the value (tested on my DB)

119 Lumen Lumen Lumen => item.setIcon(219)