From be1c225c7091265606e8fd6ab9ef7c1a3bc10d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Tue, 10 Dec 2024 10:20:30 +0100 Subject: [PATCH] Address misc comments from myuplink quality scale review (#132802) --- homeassistant/components/myuplink/binary_sensor.py | 10 ++++------ homeassistant/components/myuplink/select.py | 7 ++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/myuplink/binary_sensor.py b/homeassistant/components/myuplink/binary_sensor.py index 953859986d0..d903c7cbfae 100644 --- a/homeassistant/components/myuplink/binary_sensor.py +++ b/homeassistant/components/myuplink/binary_sensor.py @@ -155,7 +155,7 @@ class MyUplinkDeviceBinarySensor(MyUplinkEntity, BinarySensorEntity): self, coordinator: MyUplinkDataCoordinator, device_id: str, - entity_description: BinarySensorEntityDescription | None, + entity_description: BinarySensorEntityDescription, unique_id_suffix: str, ) -> None: """Initialize the binary_sensor.""" @@ -165,8 +165,7 @@ class MyUplinkDeviceBinarySensor(MyUplinkEntity, BinarySensorEntity): unique_id_suffix=unique_id_suffix, ) - if entity_description is not None: - self.entity_description = entity_description + self.entity_description = entity_description @property def is_on(self) -> bool: @@ -185,7 +184,7 @@ class MyUplinkSystemBinarySensor(MyUplinkSystemEntity, BinarySensorEntity): coordinator: MyUplinkDataCoordinator, system_id: str, device_id: str, - entity_description: BinarySensorEntityDescription | None, + entity_description: BinarySensorEntityDescription, unique_id_suffix: str, ) -> None: """Initialize the binary_sensor.""" @@ -196,8 +195,7 @@ class MyUplinkSystemBinarySensor(MyUplinkSystemEntity, BinarySensorEntity): unique_id_suffix=unique_id_suffix, ) - if entity_description is not None: - self.entity_description = entity_description + self.entity_description = entity_description @property def is_on(self) -> bool | None: diff --git a/homeassistant/components/myuplink/select.py b/homeassistant/components/myuplink/select.py index c0fb66602de..96058b916b3 100644 --- a/homeassistant/components/myuplink/select.py +++ b/homeassistant/components/myuplink/select.py @@ -5,7 +5,7 @@ from typing import cast from aiohttp import ClientError from myuplink import DevicePoint -from homeassistant.components.select import SelectEntity, SelectEntityDescription +from homeassistant.components.select import SelectEntity from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError @@ -30,14 +30,12 @@ async def async_setup_entry( for point_id, device_point in point_data.items(): if skip_entity(device_point.category, device_point): continue - description = None - if find_matching_platform(device_point, description) == Platform.SELECT: + if find_matching_platform(device_point, None) == Platform.SELECT: entities.append( MyUplinkSelect( coordinator=coordinator, device_id=device_id, device_point=device_point, - entity_description=description, unique_id_suffix=point_id, ) ) @@ -53,7 +51,6 @@ class MyUplinkSelect(MyUplinkEntity, SelectEntity): coordinator: MyUplinkDataCoordinator, device_id: str, device_point: DevicePoint, - entity_description: SelectEntityDescription | None, unique_id_suffix: str, ) -> None: """Initialize the select."""