Skip to content

Commit

Permalink
Rename binary sensor "<type> completed" to generic "Run completed"
Browse files Browse the repository at this point in the history
  • Loading branch information
ollo69 committed Jan 30, 2024
1 parent b592844 commit 5428b34
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions custom_components/smartthinq_sensors/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@

_LOGGER = logging.getLogger(__name__)

RUN_COMPLETED_PREFIX = {
DeviceType.WASHER: "Wash",
DeviceType.DRYER: "Dry",
DeviceType.STYLER: "Style",
DeviceType.DISHWASHER: "Wash",
}


@dataclass
class ThinQBinarySensorEntityDescription(BinarySensorEntityDescription):
Expand All @@ -63,6 +56,7 @@ class ThinQBinarySensorEntityDescription(BinarySensorEntityDescription):
WASH_DEV_BINARY_SENSORS: tuple[ThinQBinarySensorEntityDescription, ...] = (
ThinQBinarySensorEntityDescription(
key=ATTR_RUN_COMPLETED,
name="Run completed",
value_fn=lambda x: x.run_completed,
),
ThinQBinarySensorEntityDescription(
Expand Down Expand Up @@ -252,13 +246,6 @@ def _async_discover_device(lge_devices: dict) -> None:
)


def get_binary_sensor_name(device: LGEDevice, ent_key: str) -> str:
"""Get the name for the binary sensor"""
if ent_key == ATTR_RUN_COMPLETED:
return f"{RUN_COMPLETED_PREFIX.get(device.type, 'Run')} completed"
return get_entity_name(device, ent_key)


class LGEBinarySensor(CoordinatorEntity, BinarySensorEntity):
"""Class to monitor binary sensors for LGE device"""

Expand All @@ -280,7 +267,7 @@ def __init__(
self._attr_unique_id = f"{api.unique_id}-{description.key}"
self._attr_device_info = api.device_info
if not description.translation_key and description.name is UNDEFINED:
self._attr_name = get_binary_sensor_name(api, description.key)
self._attr_name = get_entity_name(api, description.key)

self._is_on = None

Expand Down

0 comments on commit 5428b34

Please sign in to comment.