Support changing per device scene states #3633
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my first PR on Zigbee2mqtt to please bear with me :)
As per the discussion in the original ticket to add scenes support to Zigbee2mqtt scenes are stored in the lights based on a scene id and group id for which the group id defaults to 0 when setting the state on a light (using
zigbee2mqtt/<light name>/set
). This means one can currently onlystore
a whole group of devices oradd
a whole group of devices with the same state. With this change one can callscene_add
(orscene_store
) on a light and by specifying thegroup_id
the scene will be bound to that group.So in short this allows:
scene_store
orscene_add
a scene for all lights in the groupscene_add
onzigbee2mqtt/<light name>/set
to override the state of a single lightUp for discussion is whether the same change should be applied to
scene_remove
as well. My guess (but didn't test) is that this would thus prevent such light to change it's state when a (group) scene is applied.