Skip to content

Commit

Permalink
Revert select changes
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Mar 14, 2024
1 parent 5f3bec5 commit bf1ce72
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 51 deletions.
1 change: 1 addition & 0 deletions homeassistant/components/zha/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
For more details on this platform, please refer to the documentation
at https://home-assistant.io/components/zha.climate/
"""

from __future__ import annotations

from datetime import datetime, timedelta
Expand Down
35 changes: 2 additions & 33 deletions homeassistant/components/zha/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ class ZCLEnumSelectEntity(ZhaEntity, SelectEntity):
"""Representation of a ZHA ZCL enum select entity."""

_attribute_name: str
_attr_entity_category: EntityCategory | None = EntityCategory.CONFIG
_attr_entity_category = EntityCategory.CONFIG
_enum: type[Enum]
_has_state_translation = False

@classmethod
def create_entity(
Expand Down Expand Up @@ -205,11 +204,7 @@ def __init__(
self._cluster_handler: ClusterHandler = cluster_handlers[0]
if QUIRK_METADATA in kwargs:
self._init_from_quirks_metadata(kwargs[QUIRK_METADATA])
if self._has_state_translation:
self._attr_options = [entry.name for entry in self._enum]
else:
self._attr_options = [entry.name.replace("_", " ") for entry in self._enum]

self._attr_options = [entry.name.replace("_", " ") for entry in self._enum]
super().__init__(unique_id, zha_device, cluster_handlers, **kwargs)

def _init_from_quirks_metadata(self, entity_metadata: EntityMetadata) -> None:
Expand All @@ -226,8 +221,6 @@ def current_option(self) -> str | None:
if option is None:
return None
option = self._enum(option)
if self._has_state_translation:
return option.name
return option.name.replace("_", " ")

async def async_select_option(self, option: str) -> None:
Expand Down Expand Up @@ -698,27 +691,3 @@ class KeypadLockout(ZCLEnumSelectEntity):
_enum = KeypadLockoutEnum
_attr_translation_key: str = "keypad_lockout"
_attr_icon: str = "mdi:lock"


class LegrandCableOutletHeatModeEnum(types.enum8):
"""Heat mode."""

comfort = 0x00
comfort_minus_1 = 0x01
comfort_minus_2 = 0x02
eco = 0x03
frost_protection = 0x04
off = 0x05


@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names="cable_outlet_cluster")
class LegrandCableOutletHeatMode(ZCLEnumSelectEntity):
"""Representation of an Legrand cable outlet heat mode configuration entity."""

_has_state_translation = True
_unique_id_suffix = "heat_mode"
_attribute_name = "heat_mode"
_enum = LegrandCableOutletHeatModeEnum
_attr_entity_category = None
_attr_translation_key: str = "heat_mode"
_attr_icon: str = "mdi:home-thermometer"
22 changes: 4 additions & 18 deletions homeassistant/components/zha/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -823,17 +823,6 @@
},
"keypad_lockout": {
"name": "Keypad lockout"
},
"heat_mode": {
"name": "Heat mode",
"state": {
"comfort": "Comfort",
"comfort_minus_1": "Comfort -1 °C",
"comfort_minus_2": "Comfort -2 °C",
"eco": "Eco",
"frost_protection": "Frost protection",
"off": "Off"
}
}
},
"sensor": {
Expand Down Expand Up @@ -1010,14 +999,11 @@
"linkage_alarm": {
"name": "Linkage alarm"
},
"led_dark": {
"name": "Led dark"
},
"led_on": {
"name": "Led on"
"buzzer_manual_mute": {
"name": "Buzzer manual mute"
},
"wire_pilot_enabled": {
"name": "Wire pilot mode"
"buzzer_manual_alarm": {
"name": "Buzzer manual alarm"
}
}
}
Expand Down

0 comments on commit bf1ce72

Please sign in to comment.