Add raid array degraded state binary sensor to freebox sensors (#95242)

Add raid array degraded state binary sensor
This commit is contained in:
Florent Thiery 2023-07-05 15:09:12 +02:00 committed by GitHub
parent c75c79962a
commit bd7057f7b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 296 additions and 36 deletions

View file

@ -72,6 +72,7 @@ class FreeboxRouter:
self.devices: dict[str, dict[str, Any]] = {}
self.disks: dict[int, dict[str, Any]] = {}
self.raids: dict[int, dict[str, Any]] = {}
self.sensors_temperature: dict[str, int] = {}
self.sensors_connection: dict[str, float] = {}
self.call_list: list[dict[str, Any]] = []
@ -145,6 +146,8 @@ class FreeboxRouter:
await self._update_disks_sensors()
await self._update_raids_sensors()
async_dispatcher_send(self.hass, self.signal_sensor_update)
async def _update_disks_sensors(self) -> None:
@ -155,6 +158,14 @@ class FreeboxRouter:
for fbx_disk in fbx_disks:
self.disks[fbx_disk["id"]] = fbx_disk
async def _update_raids_sensors(self) -> None:
"""Update Freebox raids."""
# None at first request
fbx_raids: list[dict[str, Any]] = await self._api.storage.get_raids() or []
for fbx_raid in fbx_raids:
self.raids[fbx_raid["id"]] = fbx_raid
async def update_home_devices(self) -> None:
"""Update Home devices (alarm, light, sensor, switch, remote ...)."""
if not self.home_granted: