mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Fix missing battery sensors for SimpliSafe locks (#90722)
This commit is contained in:
parent
aeeadb570a
commit
ba58fc25bd
@ -1,7 +1,7 @@
|
||||
"""Support for SimpliSafe binary sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from simplipy.device import DeviceTypes
|
||||
from simplipy.device import DeviceTypes, DeviceV3
|
||||
from simplipy.device.sensor.v3 import SensorV3
|
||||
from simplipy.system.v3 import SystemV3
|
||||
|
||||
@ -67,6 +67,9 @@ async def async_setup_entry(
|
||||
if sensor.type in SUPPORTED_BATTERY_SENSOR_TYPES:
|
||||
sensors.append(BatteryBinarySensor(simplisafe, system, sensor))
|
||||
|
||||
for lock in system.locks.values():
|
||||
sensors.append(BatteryBinarySensor(simplisafe, system, lock))
|
||||
|
||||
async_add_entities(sensors)
|
||||
|
||||
|
||||
@ -99,14 +102,14 @@ class BatteryBinarySensor(SimpliSafeEntity, BinarySensorEntity):
|
||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||
|
||||
def __init__(
|
||||
self, simplisafe: SimpliSafe, system: SystemV3, sensor: SensorV3
|
||||
self, simplisafe: SimpliSafe, system: SystemV3, device: DeviceV3
|
||||
) -> None:
|
||||
"""Initialize."""
|
||||
super().__init__(simplisafe, system, device=sensor)
|
||||
super().__init__(simplisafe, system, device=device)
|
||||
|
||||
self._attr_name = "Battery"
|
||||
self._attr_unique_id = f"{super().unique_id}-battery"
|
||||
self._device: SensorV3
|
||||
self._device: DeviceV3
|
||||
|
||||
@callback
|
||||
def async_update_from_rest_api(self) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user