manzanotti / geniushub-client

Python library to provide direct connectivity to Genius Hub.
MIT License
9 stars 5 forks source link

Sensor should reflect zone name in addition to just an id #82

Closed GeoffAtHome closed 11 months ago

GeoffAtHome commented 11 months ago

Currently sensors such as battery levels just reflect the id of the device. If this included the zone name it would make it more useful.

In sensor.py

I suggest the code is changed from:

class GeniusBattery(GeniusDevice, SensorEntity):
    """Representation of a Genius Hub sensor."""

    def __init__(self, broker, device, state_attr) -> None:
        """Initialize the sensor."""
        super().__init__(broker, device)

        self._state_attr = state_attr

        self._attr_name = f"{device.type} {device.id}"

to:

class GeniusBattery(GeniusDevice, SensorEntity):
    """Representation of a Genius Hub sensor."""

    def __init__(self, broker, device, state_attr) -> None:
        """Initialize the sensor."""
        super().__init__(broker, device)

        self._state_attr = state_attr

        self._attr_name = f"{device.type} ({device.id}) in {device.assigned_zone.name}"

from

GeoffAtHome commented 11 months ago

Added to home assistant core.