-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor polishing for tplink #120868
Minor polishing for tplink #120868
Conversation
Hey there @bdraco, @sdb9696, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
@@ -144,21 +143,6 @@ class TPLinkSensorEntity(CoordinatedTPLinkFeatureEntity, SensorEntity): | |||
|
|||
entity_description: TPLinkSensorEntityDescription | |||
|
|||
def __init__( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for __init__
s for sensor
and switch
as parent's async_added_to_hass
takes care of updating the state.
# fan | ||
"fan_speed_level", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have fan
platform so this is not necessary anymore.
@@ -371,6 +370,7 @@ def _async_update_attrs(self) -> None: | |||
effect_module = self._effect_module | |||
if effect_module.effect != LightEffect.LIGHT_EFFECTS_OFF: | |||
self._attr_effect = effect_module.effect | |||
self._attr_color_mode = ColorMode.BRIGHTNESS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to set this back to the correct mode once the effect is switched off? It's slightly confusing because I see there's _determine_color_mode
in super()._async_update_attrs
but it's not clear whether that does as much as the TPLinkLightEntity
constructor. Is there duplicated logic in there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to do that as it's taken care of through the _determine_color_mode
, we just override that for this special case.
I don't see duplicate logic either, as the ctor only initializes the available modes and leaves setting the active one to the _async_update_attrs
of the corresponding class.
@@ -73,7 +73,7 @@ | |||
"value": 121.1, | |||
"type": "Sensor", | |||
"category": "Primary", | |||
"unit": "v", | |||
"unit": "V", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This caused a warning due to incorrect unit for the device class.
…ate in __init__ This is necessary as setting the attributes in async_added_to_hass is too late for snapshot testing
Proposed change
This PR collects some minor improvements for the tplink based on earlier comments and testing during beta.
TBD:
Type of change
Additional information
Checklist
ruff format 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
.To help with the load of incoming pull requests: