mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Address misc comments from myuplink quality scale review (#132802)
This commit is contained in:
parent
28d01d88a2
commit
be1c225c70
@ -155,7 +155,7 @@ class MyUplinkDeviceBinarySensor(MyUplinkEntity, BinarySensorEntity):
|
|||||||
self,
|
self,
|
||||||
coordinator: MyUplinkDataCoordinator,
|
coordinator: MyUplinkDataCoordinator,
|
||||||
device_id: str,
|
device_id: str,
|
||||||
entity_description: BinarySensorEntityDescription | None,
|
entity_description: BinarySensorEntityDescription,
|
||||||
unique_id_suffix: str,
|
unique_id_suffix: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the binary_sensor."""
|
"""Initialize the binary_sensor."""
|
||||||
@ -165,8 +165,7 @@ class MyUplinkDeviceBinarySensor(MyUplinkEntity, BinarySensorEntity):
|
|||||||
unique_id_suffix=unique_id_suffix,
|
unique_id_suffix=unique_id_suffix,
|
||||||
)
|
)
|
||||||
|
|
||||||
if entity_description is not None:
|
self.entity_description = entity_description
|
||||||
self.entity_description = entity_description
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
@ -185,7 +184,7 @@ class MyUplinkSystemBinarySensor(MyUplinkSystemEntity, BinarySensorEntity):
|
|||||||
coordinator: MyUplinkDataCoordinator,
|
coordinator: MyUplinkDataCoordinator,
|
||||||
system_id: str,
|
system_id: str,
|
||||||
device_id: str,
|
device_id: str,
|
||||||
entity_description: BinarySensorEntityDescription | None,
|
entity_description: BinarySensorEntityDescription,
|
||||||
unique_id_suffix: str,
|
unique_id_suffix: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the binary_sensor."""
|
"""Initialize the binary_sensor."""
|
||||||
@ -196,8 +195,7 @@ class MyUplinkSystemBinarySensor(MyUplinkSystemEntity, BinarySensorEntity):
|
|||||||
unique_id_suffix=unique_id_suffix,
|
unique_id_suffix=unique_id_suffix,
|
||||||
)
|
)
|
||||||
|
|
||||||
if entity_description is not None:
|
self.entity_description = entity_description
|
||||||
self.entity_description = entity_description
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool | None:
|
def is_on(self) -> bool | None:
|
||||||
|
@ -5,7 +5,7 @@ from typing import cast
|
|||||||
from aiohttp import ClientError
|
from aiohttp import ClientError
|
||||||
from myuplink import DevicePoint
|
from myuplink import DevicePoint
|
||||||
|
|
||||||
from homeassistant.components.select import SelectEntity, SelectEntityDescription
|
from homeassistant.components.select import SelectEntity
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
@ -30,14 +30,12 @@ async def async_setup_entry(
|
|||||||
for point_id, device_point in point_data.items():
|
for point_id, device_point in point_data.items():
|
||||||
if skip_entity(device_point.category, device_point):
|
if skip_entity(device_point.category, device_point):
|
||||||
continue
|
continue
|
||||||
description = None
|
if find_matching_platform(device_point, None) == Platform.SELECT:
|
||||||
if find_matching_platform(device_point, description) == Platform.SELECT:
|
|
||||||
entities.append(
|
entities.append(
|
||||||
MyUplinkSelect(
|
MyUplinkSelect(
|
||||||
coordinator=coordinator,
|
coordinator=coordinator,
|
||||||
device_id=device_id,
|
device_id=device_id,
|
||||||
device_point=device_point,
|
device_point=device_point,
|
||||||
entity_description=description,
|
|
||||||
unique_id_suffix=point_id,
|
unique_id_suffix=point_id,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -53,7 +51,6 @@ class MyUplinkSelect(MyUplinkEntity, SelectEntity):
|
|||||||
coordinator: MyUplinkDataCoordinator,
|
coordinator: MyUplinkDataCoordinator,
|
||||||
device_id: str,
|
device_id: str,
|
||||||
device_point: DevicePoint,
|
device_point: DevicePoint,
|
||||||
entity_description: SelectEntityDescription | None,
|
|
||||||
unique_id_suffix: str,
|
unique_id_suffix: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the select."""
|
"""Initialize the select."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user