List of supported basic scenes is now added to device data model. It is visible in property tree. Setting and viewing this list works correctly.
I guess holding those levels as ints
should be convenient for use in any logic. However, I am not sure if it would not look better in property tree if printed as strings like OffLevel
, Level1
or Boost
. Therefore there are some functions prepared to translate string->enum, enum->string, in case we want to use them for this or any other purpose.
Also, I think that it would be easier to pass list of supported levels in, for example, array instead of as separate parameters, but I do not think our RestfulRequest class is able to take in anything like this. So, if this is a problem for us, implementation might need some tweaks in this field.
Otherwise, any parameter with true
should be added to supported list, while parameters with false
or missing parameters at all result in not being added to list. I guess this might change if such need arises when designing some UI to control this logic.
Supported levels are now passed as parameter in JSON object.
How it works:
In dSS, DeviceRequestHandler
expects incoming request with method setSupportedBasicScenes
, with parameter=value
containing JSON array without a key with listed supported levels. Those are: "off","level1","level2","level3","level4","boost" 0,5,17,18,19,36.
An example of URL parameter setting all available levels in a device:
&value=[0, 5, 17, 18, 19, 36]
&supportedBasicScenes=["off","level1","level2","level3","level4","boost"]
Those levels are listed in property tree as "supportedBasicScenes", as well as written into "apartment.xml" file to store this setting permanently. The above example will result in following entry in property tree and 'apartment.xml':
supportedBasicScenes=0,5,17,18,19,36