Open manup opened 3 years ago
I think this will work, but to be honest, it looks a bit over complicated to me.
In addition to Recall Scene, I’d simply send unicast commands to the lights that:
You could loop over all lights sending a unicast Store Scene for confirmation that the (whitelisted) light has actually accepted the scene.
I think it’s more the responsibility of the API client to implement non-Zigbee scenes (and groups).
Thanks for the review, I have to admit it has a certain complexity :) but within the state machine it's rather simple to implement with (hopefully) very little maintenance, surprisingly the actual code is relative small for what it can do. I'd really like to aim for a max. robust solution which just works, plus implicit goodies like auto repairing scenes and no scaling issues. Mainly because this can get rid of all issues users are currently facing and to bring related support cases down.
In addition to Recall Scene, I’d simply send unicast commands to the lights that:
- Aren’t whitelisted to support the Scenes cluster sufficiently;
- Lights whose Scenes table is full (so part of the “sufficient” support is reporting correctly the available entries).
I agree this should happen right after recalling a scene for such devices. Basically it's a fast forward to the "Set scene state" state.
You could loop over all lights sending a unicast Store Scene for confirmation that the (whitelisted) light has actually accepted the scene.
This is done in the "Store scene state" automatically after a scene state has been set, I think this should do the trick.
I think it’s more the responsibility of the API client to implement non-Zigbee scenes (and groups).
Here the problem is that this would bring the burden to understand and communicate that to the end user. Users usually don't understand nor care about this, they have their lights and want to use scenes. Since the "Set scene state" state is used for both kinds of devices there is little overhead to support devices which don't have Zigbee scenes, we only need move to that state and machine will do its thing. The related REST-API and end user interfaces has one unified solution which is hopefully simple to understand and use.
The current handling of scenes doesn't work very well for some devices and has some general issues. Here is a first draft how to approach a new scenes implementation. It's not complete but should provides a base for discussion and comments.
Observations
ct
can only be set and recalled when the scene was created by store scene;The future implementation as part of the Device state machine needs to be able to do the following tasks. These are described in a coarse state machine.
Device scene specifics
active scene
which can be null, it is used to let the state machine react to scene changes or when a scene isn't active anymore due non scene state changes.Create a scene
Recall a scene
Verify scene after recall
current scene (0x0001)
,current group (0x0002)
andscene valid (0x0003)
;Remarks: IKEA lights set scene valid attribute to false for On/Off and Brightness commands but not when changing only the color.
Verify scene state
Store scene state
Set scene state
Notes
Related: https://github.com/dresden-elektronik/deconz-rest-plugin/pull/3497