Page 1 of 1
Retrieving all supported levels
Posted: Monday 05 February 2018 14:32
by dzdm
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!
Re: Retrieving all supported levels
Posted: Monday 05 February 2018 15:00
by emme
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
Re: Retrieving all supported levels
Posted: Tuesday 06 February 2018 12:27
by dzdm
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?
Re: Retrieving all supported levels
Posted: Tuesday 06 February 2018 12:35
by emme
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
Re: Retrieving all supported levels
Posted: Tuesday 06 February 2018 12:43
by dzdm
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%?