hello
i try to use this function in a script :
setIcon(iconNumber): Function. 2.4.17 method to update the icon for devices. Supports command options.
like this
device.switchOn().seticon(105)
but i have this error : attempt to call a nil value (field 'seticon')
i know how i can replace with a json request but i want to work in pure lua if is possible.
how to use seticon function? [Solved]
Moderator: leecollings
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: how to use seticon function?
the method is setIcon() -- case matters !
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- papoo
- Posts: 126
- Joined: Friday 22 January 2016 22:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10
- Location: France
- Contact:
Re: how to use seticon function?
i try it also
attempt to call a nil value (field 'setIcon')
I don't write the function correctly surely
attempt to call a nil value (field 'setIcon')
I don't write the function correctly surely
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: how to use seticon function?
Hard to tell without knowing what device is and without seeing the script...
How did you find the Icon number 105 ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- papoo
- Posts: 126
- Joined: Friday 22 January 2016 22:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10
- Location: France
- Contact:
Re: how to use seticon function?
i use custom icons. the first is 101, etc
like this it work fine with this json request
but i want to use the setIcon dzents function
like this
i try also
my selector switch have 9 levels, level 0 not show
custom icon for level 10 to 80 :
[10] = 128,
[20] = 129,
[30] = 130,
[40] = 131,
[50] = 132,
[60] = 133,
[70] = 134,
[80] = 135,
like this it work fine with this json request
Code: Select all
dz.settings['Domoticz url'] .. '/json.htm?type=setused&used=true&name=' .. dz.utils.urlEncode(device.name) ..
'&description=' .. dz.utils.urlEncode(device.description) .. -- Required. If not set it will be blanked out.
'&idx=' .. device.id ..
'&switchtype=' .. device.switchTypeValue ..
'&customimage=' .. iconNumber
like this
Code: Select all
device.setIcon(iconNumber)
Code: Select all
device.switchOn().setIcon(iconNumber)
custom icon for level 10 to 80 :
[10] = 128,
[20] = 129,
[30] = 130,
[40] = 131,
[50] = 132,
[60] = 133,
[70] = 134,
[80] = 135,
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: how to use seticon function?
Can you please share the complete script, the relevant loglines, the device type and subtype and the content of <domoticz dir>/dzVents/runtime/device-adapters/generic_device.lua ?
That will help me finding the root cause of your problem. Thx
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- papoo
- Posts: 126
- Joined: Friday 22 January 2016 22:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10
- Location: France
- Contact:
Re: how to use seticon function? [Solved]
I tested my script again to collect the info to answer you, and it works now.
Unfortunately,
I don't know what was wrong.
sorry for inconvenience, thanks.
please, can you tell me if there is a possibility to display the name of Custom icons and their number with dzvents or json?
Unfortunately,
I don't know what was wrong.
sorry for inconvenience, thanks.
please, can you tell me if there is a possibility to display the name of Custom icons and their number with dzvents or json?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: how to use seticon function?
Good to hear it is working now.
I don't know how to get the name of Custom icons. maybe if you add one or two an look in the database table CustomImages you can see a relation that make sense to you.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest