mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 00:20:30 +01:00
Use _get_quirk_entity_description
This commit is contained in:
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from tuya_device_handlers import TUYA_QUIRKS_REGISTRY
|
||||
from tuya_device_handlers.definition.alarm_control_panel import (
|
||||
AlarmControlPanelQuirk,
|
||||
TuyaAlarmControlPanelDefinition,
|
||||
get_default_definition,
|
||||
)
|
||||
@@ -52,6 +53,12 @@ _TUYA_TO_HA_STATE_MAPPINGS = {
|
||||
}
|
||||
|
||||
|
||||
def _get_quirk_entity_description(
|
||||
entity_quirk: AlarmControlPanelQuirk,
|
||||
) -> AlarmControlPanelEntityDescription:
|
||||
return AlarmControlPanelEntityDescription(key=entity_quirk.key)
|
||||
|
||||
|
||||
def _get_quirk_entities(
|
||||
manager: Manager, device: CustomerDevice
|
||||
) -> list[TuyaAlarmEntity] | None:
|
||||
@@ -63,7 +70,7 @@ def _get_quirk_entities(
|
||||
TuyaAlarmEntity(
|
||||
device,
|
||||
manager,
|
||||
AlarmControlPanelEntityDescription(key=entity_quirk.key),
|
||||
_get_quirk_entity_description(entity_quirk),
|
||||
definition,
|
||||
)
|
||||
for entity_quirk in entity_quirks
|
||||
|
||||
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from tuya_device_handlers import TUYA_QUIRKS_REGISTRY
|
||||
from tuya_device_handlers.definition.camera import (
|
||||
CameraQuirk,
|
||||
TuyaCameraDefinition,
|
||||
get_default_definition,
|
||||
)
|
||||
@@ -29,6 +30,12 @@ CAMERAS: dict[DeviceCategory, CameraEntityDescription] = {
|
||||
}
|
||||
|
||||
|
||||
def _get_quirk_entity_description(
|
||||
entity_quirk: CameraQuirk,
|
||||
) -> CameraEntityDescription:
|
||||
return CameraEntityDescription(key=entity_quirk.key)
|
||||
|
||||
|
||||
def _get_quirk_entities(
|
||||
manager: Manager, device: CustomerDevice
|
||||
) -> list[TuyaCameraEntity] | None:
|
||||
@@ -40,7 +47,7 @@ def _get_quirk_entities(
|
||||
TuyaCameraEntity(
|
||||
device,
|
||||
manager,
|
||||
CameraEntityDescription(key=entity_quirk.key),
|
||||
_get_quirk_entity_description(entity_quirk),
|
||||
definition,
|
||||
)
|
||||
for entity_quirk in entity_quirks
|
||||
|
||||
@@ -6,6 +6,7 @@ from typing import Any
|
||||
|
||||
from tuya_device_handlers import TUYA_QUIRKS_REGISTRY
|
||||
from tuya_device_handlers.definition.fan import (
|
||||
FanQuirk,
|
||||
TuyaFanDefinition,
|
||||
get_default_definition,
|
||||
)
|
||||
@@ -45,6 +46,12 @@ _HA_TO_TUYA_DIRECTION_MAPPINGS = {
|
||||
}
|
||||
|
||||
|
||||
def _get_quirk_entity_description(
|
||||
entity_quirk: FanQuirk,
|
||||
) -> FanEntityDescription:
|
||||
return FanEntityDescription(key=entity_quirk.key)
|
||||
|
||||
|
||||
def _get_quirk_entities(
|
||||
manager: Manager, device: CustomerDevice
|
||||
) -> list[TuyaFanEntity] | None:
|
||||
@@ -56,7 +63,7 @@ def _get_quirk_entities(
|
||||
TuyaFanEntity(
|
||||
device,
|
||||
manager,
|
||||
FanEntityDescription(key=entity_quirk.key),
|
||||
_get_quirk_entity_description(entity_quirk),
|
||||
definition,
|
||||
)
|
||||
for entity_quirk in entity_quirks
|
||||
|
||||
@@ -7,6 +7,7 @@ from typing import Any
|
||||
from tuya_device_handlers import TUYA_QUIRKS_REGISTRY
|
||||
from tuya_device_handlers.definition.vacuum import (
|
||||
TuyaVacuumDefinition,
|
||||
VacuumQuirk,
|
||||
get_default_definition,
|
||||
)
|
||||
from tuya_device_handlers.helpers.homeassistant import (
|
||||
@@ -43,6 +44,12 @@ VACUUMS: dict[DeviceCategory, StateVacuumEntityDescription] = {
|
||||
}
|
||||
|
||||
|
||||
def _get_quirk_entity_description(
|
||||
entity_quirk: VacuumQuirk,
|
||||
) -> StateVacuumEntityDescription:
|
||||
return StateVacuumEntityDescription(key=entity_quirk.key)
|
||||
|
||||
|
||||
def _get_quirk_entities(
|
||||
manager: Manager, device: CustomerDevice
|
||||
) -> list[TuyaVacuumEntity] | None:
|
||||
@@ -54,7 +61,7 @@ def _get_quirk_entities(
|
||||
TuyaVacuumEntity(
|
||||
device,
|
||||
manager,
|
||||
StateVacuumEntityDescription(key=entity_quirk.key),
|
||||
_get_quirk_entity_description(entity_quirk),
|
||||
definition,
|
||||
)
|
||||
for entity_quirk in entity_quirks
|
||||
|
||||
Reference in New Issue
Block a user