Conversation
|
Hey there @dmulcahey, @Adminiuga, mind taking a look at this pull request as it has been labeled with an integration ( |
| self._state = True | ||
| if ( | ||
| light.ATTR_COLOR_TEMP in kwargs | ||
| and self.supported_features & light.SUPPORT_COLOR_TEMP |
There was a problem hiding this comment.
This guard was not needed, it's handled by the light base component
|
|
||
| if ( | ||
| light.ATTR_HS_COLOR in kwargs | ||
| and self.supported_features & light.SUPPORT_COLOR |
There was a problem hiding this comment.
This guard was not needed, it's handled by the light base component
Same comment for the removed guards below.
|
|
||
| if ( | ||
| effect == light.EFFECT_COLORLOOP | ||
| and self.supported_features & light.SUPPORT_EFFECT |
There was a problem hiding this comment.
This guard was not needed, it's handled by the light base component
| elif ( | ||
| self._effect == light.EFFECT_COLORLOOP | ||
| and effect != light.EFFECT_COLORLOOP | ||
| and self.supported_features & light.SUPPORT_EFFECT |
There was a problem hiding this comment.
This guard was not needed, it's handled by the light base component
| if len(self._attr_supported_color_modes) == 1: | ||
| self._color_mode = next(iter(self._attr_supported_color_modes)) | ||
| else: # Light supports color_temp + hs, determine which mode the light is in | ||
| if self._color_channel.color_mode == LightColorMode.COLOR_TEMP: |
There was a problem hiding this comment.
Is this the correct way to determine the color mode of the light when the entity is initialized?
There was a problem hiding this comment.
color_mode doesn’t exist on the channel.
It will need to be added. The attribute will also need to be added to the ZCL_INIT_ATTRS dict with False to make sure it’s read during initialization and not read from cache.
then the comparisons need to be against the Zigpy enum: https://github.com/zigpy/zigpy/blob/b166e2e1f22c49bad201d7ecdf202f0fc9b7b087/zigpy/zcl/clusters/lighting.py#L14
| CONF_DEFAULT_LIGHT_TRANSITION, | ||
| 0, | ||
| ) | ||
| self._attr_supported_color_modes = COLOR_MODES_GROUP_LIGHT |
There was a problem hiding this comment.
I'm not sure I understand the ZHA light group, it seems to derive its state not from zigpy but from the HA state machine, while it changes the state of the group by talking to zigpy?
Is it OK to set the light group to either HS or CT; and how do we determine which one the group is in; the members could be in states: ONOFF, BRIGHTNESS (dimmers with no adjustable color temperature), COLOR_TEMP or HS.
We could map ONOFF + BRIGHTNESS + COLOR_TEMP to a COLOR_TEMP group and HS to a HS group and make a majority decision?
For reference, this is the implementation in the standard light group:
core/homeassistant/components/group/light.py
Lines 283 to 292 in d9433e6
There was a problem hiding this comment.
I'm not sure I understand the ZHA light group, it seems to derive its state not from zigpy but from the HA state machine, while it changes the state of the group by talking to zigpy?
It derives the group state by aggregating the state of each member entity from HA state machine.
Is it OK to set the light group to either HS or CT; and how do we determine which one the group is in; the members could be in states: ONOFF, BRIGHTNESS (dimmers with no adjustable color temperature), COLOR_TEMP or HS.
We could map ONOFF + BRIGHTNESS + COLOR_TEMP to a COLOR_TEMP group and HS to a HS group and make a majority decision?
IIRC currently as long as one member is ON then the entire group is on. The group state is calculated based on the ON entities. Need to verify.
The ZigBee groups could be crazy, as I do mix in one group CT lamps and color lamps. At the ZigBee network level, lamps without color support just ignore the color commands
There was a problem hiding this comment.
Improved in 214adf8, zha groups is now using same logic as the standard light group
This comment was marked as outdated.
This comment was marked as outdated.
ce67d33 to
9e78df0
Compare
|
So far nothing jumps out at me, but i have a question: what happens when the color_mode attribute is None (unsupported)? IIRC there are some color bulbs which don't support this attribute. It still would behave as an older version, right? |
Proposed change
Migrate zha light to color_mode
Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: