Hi
I'm looking for a way to retrieve all supported levels (numeric!) for a specific switch,
so I can use the number in the switchSelector function. It is possible to get all level names
with:
local levels = dz.devices('Beacon').levelNames
But the switchSelector function only supports the numeric values and I did not find
a way to get a list of this numbers.
Does anyone have a solution for this?
Thank you!
Retrieving all supported levels
Moderator: leecollings
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Retrieving all supported levels
use:
local levels = #dz.devices('Beacon').levelNames
to get the levels count (off included)
the result starts from 1 while levels start from 0 so to use it try with
maxLevel = (levels-1) * 10
local levels = #dz.devices('Beacon').levelNames
to get the levels count (off included)
the result starts from 1 while levels start from 0 so to use it try with
maxLevel = (levels-1) * 10
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
Re: Retrieving all supported levels
Hi,
yes this seems to work, but I have another issue regarding the levels. I have levels from 0 to 200 (in steps of 10), but I cannot change levels > 100 with the switchSelector function (levels > 100 are always set to 100 when using switchSelector). Is there any other way to set levels > 100?
yes this seems to work, but I have another issue regarding the levels. I have levels from 0 to 200 (in steps of 10), but I cannot change levels > 100 with the switchSelector function (levels > 100 are always set to 100 when using switchSelector). Is there any other way to set levels > 100?
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Retrieving all supported levels
I think you should NOT be allowed to add more than 10 levels... that's a GUI error
at level 100 the Add button looks like it is disable while it dosen't
at level 100 the Add button looks like it is disable while it dosen't
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
Re: Retrieving all supported levels
Hi,
well I did not add them by hand, I just added a IKEA light bulb device (tradfri) and the levels were preset.
But the question is, why is it not allowed? I understand, that levels are usually in percent, but switchSelector is more than a switch with multiple different states, so why shouldn't it be possible to have more than 10 different states? For example, you have a radio device with multiple pre-programmed radio stations you want to switch. And even in case the level is in percent, maybe devices with special parameters exists which can be set to > 100%?
well I did not add them by hand, I just added a IKEA light bulb device (tradfri) and the levels were preset.
But the question is, why is it not allowed? I understand, that levels are usually in percent, but switchSelector is more than a switch with multiple different states, so why shouldn't it be possible to have more than 10 different states? For example, you have a radio device with multiple pre-programmed radio stations you want to switch. And even in case the level is in percent, maybe devices with special parameters exists which can be set to > 100%?
Who is online
Users browsing this forum: Google [Bot] and 1 guest