mirror of
https://github.com/home-assistant/core.git
synced 2026-09-27 01:46:11 -04:00
cleanup
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, replace
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from tuya_sharing import CustomerDevice, Manager
|
||||
@@ -143,27 +143,6 @@ COVERS: dict[DeviceCategory, tuple[TuyaCoverEntityDescription, ...]] = {
|
||||
),
|
||||
}
|
||||
|
||||
_QUIRKS: dict[str, dict[str, Any]] = {
|
||||
# Quirks for devices where the standard descriptions don't work well
|
||||
# Key is "{device.category}_{device.product_id}_{description.key}"
|
||||
"cl_lfkr93x0ukp5gaia_control": {
|
||||
# This model has percent_control / percent_state / situation_set
|
||||
# but they never get updated - use control instead to get the state
|
||||
"current_state": DPCode.CONTROL,
|
||||
"current_position": None,
|
||||
"set_position": None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def _apply_quirk(
|
||||
device: CustomerDevice, description: TuyaCoverEntityDescription
|
||||
) -> TuyaCoverEntityDescription:
|
||||
"""Apply quirk for specific device."""
|
||||
if quirk := _QUIRKS.get(f"{device.category}_{device.product_id}_{description.key}"):
|
||||
return replace(description, **quirk)
|
||||
return description
|
||||
|
||||
|
||||
def _create_quirk_description(
|
||||
definition: TuyaCoverDefinition,
|
||||
@@ -205,7 +184,7 @@ async def async_setup_entry(
|
||||
)
|
||||
elif descriptions := COVERS.get(device.category):
|
||||
entities.extend(
|
||||
TuyaCoverEntity(device, manager, _apply_quirk(device, description))
|
||||
TuyaCoverEntity(device, manager, description)
|
||||
for description in descriptions
|
||||
if (
|
||||
description.key in device.function
|
||||
|
||||
Reference in New Issue
Block a user