Migrate Gree to has entity name (#104739)
* Migrate Gree to has entity name * Migrate Gree to has entity name
This commit is contained in:
parent
c4d77877d2
commit
00e87b9dff
6 changed files with 58 additions and 49 deletions
|
@ -33,10 +33,6 @@ class GreeRequiredKeysMixin:
|
|||
class GreeSwitchEntityDescription(SwitchEntityDescription, GreeRequiredKeysMixin):
|
||||
"""Describes Gree switch entity."""
|
||||
|
||||
# GreeSwitch does not support UNDEFINED or None,
|
||||
# restrict the type to str.
|
||||
name: str = ""
|
||||
|
||||
|
||||
def _set_light(device: Device, value: bool) -> None:
|
||||
"""Typed helper to set device light property."""
|
||||
|
@ -66,33 +62,33 @@ def _set_anion(device: Device, value: bool) -> None:
|
|||
GREE_SWITCHES: tuple[GreeSwitchEntityDescription, ...] = (
|
||||
GreeSwitchEntityDescription(
|
||||
icon="mdi:lightbulb",
|
||||
name="Panel Light",
|
||||
key="light",
|
||||
key="Panel Light",
|
||||
translation_key="light",
|
||||
get_value_fn=lambda d: d.light,
|
||||
set_value_fn=_set_light,
|
||||
),
|
||||
GreeSwitchEntityDescription(
|
||||
name="Quiet",
|
||||
key="quiet",
|
||||
key="Quiet",
|
||||
translation_key="quiet",
|
||||
get_value_fn=lambda d: d.quiet,
|
||||
set_value_fn=_set_quiet,
|
||||
),
|
||||
GreeSwitchEntityDescription(
|
||||
name="Fresh Air",
|
||||
key="fresh_air",
|
||||
key="Fresh Air",
|
||||
translation_key="fresh_air",
|
||||
get_value_fn=lambda d: d.fresh_air,
|
||||
set_value_fn=_set_fresh_air,
|
||||
),
|
||||
GreeSwitchEntityDescription(
|
||||
name="XFan",
|
||||
key="xfan",
|
||||
key="XFan",
|
||||
translation_key="xfan",
|
||||
get_value_fn=lambda d: d.xfan,
|
||||
set_value_fn=_set_xfan,
|
||||
),
|
||||
GreeSwitchEntityDescription(
|
||||
icon="mdi:pine-tree",
|
||||
name="Health mode",
|
||||
key="anion",
|
||||
key="Health mode",
|
||||
translation_key="health_mode",
|
||||
get_value_fn=lambda d: d.anion,
|
||||
set_value_fn=_set_anion,
|
||||
entity_registry_enabled_default=False,
|
||||
|
@ -134,7 +130,7 @@ class GreeSwitch(GreeEntity, SwitchEntity):
|
|||
"""Initialize the Gree device."""
|
||||
self.entity_description = description
|
||||
|
||||
super().__init__(coordinator, description.name)
|
||||
super().__init__(coordinator, description.key)
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue