Skip to content

Commit

Permalink
add count and locked attributes Enhancement request. Add is_locked at…
Browse files Browse the repository at this point in the history
…tribute to climate entities #374
  • Loading branch information
msp1974 committed Mar 4, 2024
1 parent 69391a6 commit 47bdbfe
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions custom_components/wiser/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from homeassistant.helpers import entity_platform
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from aioWiserHeatAPI.wiserhub import TEMP_MINIMUM, TEMP_MAXIMUM, TEMP_OFF
from aioWiserHeatAPI.devices import _WiserRoomStat, _WiserSmartValve
from .const import (
DATA,
DOMAIN,
Expand Down Expand Up @@ -525,6 +526,33 @@ def extra_state_attributes(self):
if self._room.is_passive_mode:
attrs["passive_mode_temp_increment"] = self.passive_temperature_increment

# Climate devices (iTRVs and Roomstats)
attrs["number_of_trvs"] = len(
[
device
for device in self._room.devices
if isinstance(device, (_WiserSmartValve))
]
)
attrs["number_of_trvs_locked"] = len(
[
device
for device in self._room.devices
if isinstance(device, (_WiserSmartValve)) and device.device_lock_enabled
]
)
attrs["is_roomstat_locked"] = (
len(
[
device
for device in self._room.devices
if isinstance(device, (_WiserRoomStat))
and device.device_lock_enabled
]
)
> 0
)

return attrs

@property
Expand Down

0 comments on commit 47bdbfe

Please sign in to comment.