mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Bump pydeconz to v88 (#69369)
This commit is contained in:
parent
da55c48cce
commit
d6d7f3cb3c
@ -1,8 +1,6 @@
|
|||||||
"""Support for deCONZ alarm control panel devices."""
|
"""Support for deCONZ alarm control panel devices."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
|
|
||||||
from pydeconz.alarm_system import AlarmSystem
|
from pydeconz.alarm_system import AlarmSystem
|
||||||
from pydeconz.sensor import (
|
from pydeconz.sensor import (
|
||||||
ANCILLARY_CONTROL_ARMED_AWAY,
|
ANCILLARY_CONTROL_ARMED_AWAY,
|
||||||
@ -81,12 +79,14 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_alarm_control_panel(
|
def async_add_alarm_control_panel(
|
||||||
sensors: list[AncillaryControl]
|
sensors: list[AncillaryControl] | None = None,
|
||||||
| ValuesView[AncillaryControl] = gateway.api.sensors.values(),
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Add alarm control panel devices from deCONZ."""
|
"""Add alarm control panel devices from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if sensors is None:
|
||||||
|
sensors = list(gateway.api.sensors.ancillary_control.values())
|
||||||
|
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -143,7 +143,7 @@ class DeconzAlarmControlPanel(DeconzDevice, AlarmControlPanelEntity):
|
|||||||
keys = {"panel", "reachable"}
|
keys = {"panel", "reachable"}
|
||||||
if (
|
if (
|
||||||
self._device.changed_keys.intersection(keys)
|
self._device.changed_keys.intersection(keys)
|
||||||
and self._device.state in DECONZ_TO_ALARM_STATE
|
and self._device.panel in DECONZ_TO_ALARM_STATE
|
||||||
):
|
):
|
||||||
super().async_update_callback()
|
super().async_update_callback()
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
"""Support for deCONZ binary sensors."""
|
"""Support for deCONZ binary sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable, ValuesView
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from pydeconz.sensor import (
|
from pydeconz.sensor import (
|
||||||
Alarm,
|
Alarm,
|
||||||
CarbonMonoxide,
|
CarbonMonoxide,
|
||||||
DeconzSensor as PydeconzSensor,
|
|
||||||
Fire,
|
Fire,
|
||||||
GenericFlag,
|
GenericFlag,
|
||||||
OpenClose,
|
OpenClose,
|
||||||
Presence,
|
Presence,
|
||||||
|
SensorBase as PydeconzSensor,
|
||||||
Vibration,
|
Vibration,
|
||||||
Water,
|
Water,
|
||||||
)
|
)
|
||||||
@ -178,13 +178,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_sensor(
|
def async_add_sensor(sensors: list[PydeconzSensor] | None = None) -> None:
|
||||||
sensors: list[PydeconzSensor]
|
|
||||||
| ValuesView[PydeconzSensor] = gateway.api.sensors.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add binary sensor from deCONZ."""
|
"""Add binary sensor from deCONZ."""
|
||||||
entities: list[DeconzBinarySensor] = []
|
entities: list[DeconzBinarySensor] = []
|
||||||
|
|
||||||
|
if sensors is None:
|
||||||
|
sensors = gateway.api.sensors.values()
|
||||||
|
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
|
|
||||||
if not gateway.option_allow_clip_sensor and sensor.type.startswith("CLIP"):
|
if not gateway.option_allow_clip_sensor and sensor.type.startswith("CLIP"):
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from pydeconz.group import Scene as PydeconzScene
|
from pydeconz.group import Scene as PydeconzScene
|
||||||
@ -58,13 +57,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_scene(
|
def async_add_scene(scenes: list[PydeconzScene] | None = None) -> None:
|
||||||
scenes: list[PydeconzScene]
|
|
||||||
| ValuesView[PydeconzScene] = gateway.api.scenes.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add scene button from deCONZ."""
|
"""Add scene button from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if scenes is None:
|
||||||
|
scenes = list(gateway.api.scenes.values())
|
||||||
|
|
||||||
for scene in scenes:
|
for scene in scenes:
|
||||||
|
|
||||||
known_entities = set(gateway.entities[DOMAIN])
|
known_entities = set(gateway.entities[DOMAIN])
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for deCONZ climate devices."""
|
"""Support for deCONZ climate devices."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pydeconz.sensor import (
|
from pydeconz.sensor import (
|
||||||
@ -107,13 +106,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_climate(
|
def async_add_climate(sensors: list[Thermostat] | None = None) -> None:
|
||||||
sensors: list[Thermostat]
|
|
||||||
| ValuesView[Thermostat] = gateway.api.sensors.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add climate devices from deCONZ."""
|
"""Add climate devices from deCONZ."""
|
||||||
entities: list[DeconzThermostat] = []
|
entities: list[DeconzThermostat] = []
|
||||||
|
|
||||||
|
if sensors is None:
|
||||||
|
sensors = list(gateway.api.sensors.thermostat.values())
|
||||||
|
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
|
|
||||||
if not gateway.option_allow_clip_sensor and sensor.type.startswith("CLIP"):
|
if not gateway.option_allow_clip_sensor and sensor.type.startswith("CLIP"):
|
||||||
@ -245,7 +244,7 @@ class DeconzThermostat(DeconzDevice, ClimateEntity):
|
|||||||
@property
|
@property
|
||||||
def current_temperature(self) -> float:
|
def current_temperature(self) -> float:
|
||||||
"""Return the current temperature."""
|
"""Return the current temperature."""
|
||||||
return self._device.temperature # type: ignore[no-any-return]
|
return self._device.scaled_temperature # type: ignore[no-any-return]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature(self) -> float | None:
|
def target_temperature(self) -> float | None:
|
||||||
|
@ -30,7 +30,6 @@ from .const import (
|
|||||||
CONF_ALLOW_CLIP_SENSOR,
|
CONF_ALLOW_CLIP_SENSOR,
|
||||||
CONF_ALLOW_DECONZ_GROUPS,
|
CONF_ALLOW_DECONZ_GROUPS,
|
||||||
CONF_ALLOW_NEW_DEVICES,
|
CONF_ALLOW_NEW_DEVICES,
|
||||||
CONF_BRIDGE_ID,
|
|
||||||
DEFAULT_PORT,
|
DEFAULT_PORT,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
HASSIO_CONFIGURATION_URL,
|
HASSIO_CONFIGURATION_URL,
|
||||||
@ -86,7 +85,7 @@ class DeconzFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
for bridge in self.bridges:
|
for bridge in self.bridges:
|
||||||
if bridge[CONF_HOST] == user_input[CONF_HOST]:
|
if bridge[CONF_HOST] == user_input[CONF_HOST]:
|
||||||
self.bridge_id = cast(str, bridge[CONF_BRIDGE_ID])
|
self.bridge_id = cast(str, bridge["id"])
|
||||||
self.deconz_config = {
|
self.deconz_config = {
|
||||||
CONF_HOST: bridge[CONF_HOST],
|
CONF_HOST: bridge[CONF_HOST],
|
||||||
CONF_PORT: bridge[CONF_PORT],
|
CONF_PORT: bridge[CONF_PORT],
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from typing import Any, cast
|
from typing import Any, cast
|
||||||
|
|
||||||
from pydeconz.light import Cover
|
from pydeconz.light import Cover
|
||||||
@ -47,12 +46,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_cover(
|
def async_add_cover(lights: list[Cover] | None = None) -> None:
|
||||||
lights: list[Cover] | ValuesView[Cover] = gateway.api.lights.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add cover from deCONZ."""
|
"""Add cover from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if lights is None:
|
||||||
|
lights = list(gateway.api.lights.covers.values())
|
||||||
|
|
||||||
for light in lights:
|
for light in lights:
|
||||||
if (
|
if (
|
||||||
isinstance(light, Cover)
|
isinstance(light, Cover)
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pydeconz.group import Group as DeconzGroup, Scene as PydeconzScene
|
from pydeconz.group import Group as DeconzGroup, Scene as PydeconzScene
|
||||||
from pydeconz.light import DeconzLight
|
from pydeconz.light import LightBase as DeconzLight
|
||||||
from pydeconz.sensor import DeconzSensor
|
from pydeconz.sensor import SensorBase as DeconzSensor
|
||||||
|
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
|
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
|
||||||
|
@ -43,12 +43,15 @@ async def async_setup_events(gateway: DeconzGateway) -> None:
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_sensor(
|
def async_add_sensor(
|
||||||
sensors: AncillaryControl | Switch = gateway.api.sensors.values(),
|
sensors: AncillaryControl | Switch | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Create DeconzEvent."""
|
"""Create DeconzEvent."""
|
||||||
new_events = []
|
new_events = []
|
||||||
known_events = {event.unique_id for event in gateway.events}
|
known_events = {event.unique_id for event in gateway.events}
|
||||||
|
|
||||||
|
if sensors is None:
|
||||||
|
sensors = gateway.api.sensors.values()
|
||||||
|
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
|
|
||||||
if not gateway.option_allow_clip_sensor and sensor.type.startswith("CLIP"):
|
if not gateway.option_allow_clip_sensor and sensor.type.startswith("CLIP"):
|
||||||
@ -130,7 +133,7 @@ class DeconzEvent(DeconzBase):
|
|||||||
data = {
|
data = {
|
||||||
CONF_ID: self.event_id,
|
CONF_ID: self.event_id,
|
||||||
CONF_UNIQUE_ID: self.serial,
|
CONF_UNIQUE_ID: self.serial,
|
||||||
CONF_EVENT: self._device.state,
|
CONF_EVENT: self._device.button_event,
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.device_id:
|
if self.device_id:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Support for deCONZ fans."""
|
"""Support for deCONZ fans."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pydeconz.light import (
|
from pydeconz.light import (
|
||||||
@ -44,12 +43,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_fan(
|
def async_add_fan(lights: list[Fan] | None = None) -> None:
|
||||||
lights: list[Fan] | ValuesView[Fan] = gateway.api.lights.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add fan from deCONZ."""
|
"""Add fan from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if lights is None:
|
||||||
|
lights = list(gateway.api.lights.fans.values())
|
||||||
|
|
||||||
for light in lights:
|
for light in lights:
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -10,8 +10,8 @@ import async_timeout
|
|||||||
from pydeconz import DeconzSession, errors, group, light, sensor
|
from pydeconz import DeconzSession, errors, group, light, sensor
|
||||||
from pydeconz.alarm_system import AlarmSystem as DeconzAlarmSystem
|
from pydeconz.alarm_system import AlarmSystem as DeconzAlarmSystem
|
||||||
from pydeconz.group import Group as DeconzGroup
|
from pydeconz.group import Group as DeconzGroup
|
||||||
from pydeconz.light import DeconzLight
|
from pydeconz.light import LightBase as DeconzLight
|
||||||
from pydeconz.sensor import DeconzSensor
|
from pydeconz.sensor import SensorBase as DeconzSensor
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_HASSIO, ConfigEntry
|
from homeassistant.config_entries import SOURCE_HASSIO, ConfigEntry
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_API_KEY, CONF_HOST, CONF_PORT
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pydeconz.group import Group
|
from pydeconz.group import Group
|
||||||
@ -62,12 +61,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_light(
|
def async_add_light(lights: list[Light] | None = None) -> None:
|
||||||
lights: list[Light] | ValuesView[Light] = gateway.api.lights.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add light from deCONZ."""
|
"""Add light from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if lights is None:
|
||||||
|
lights = gateway.api.lights.values()
|
||||||
|
|
||||||
for light in lights:
|
for light in lights:
|
||||||
if (
|
if (
|
||||||
isinstance(light, Light)
|
isinstance(light, Light)
|
||||||
@ -88,15 +88,16 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_group(
|
def async_add_group(groups: list[Group] | None = None) -> None:
|
||||||
groups: list[Group] | ValuesView[Group] = gateway.api.groups.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add group from deCONZ."""
|
"""Add group from deCONZ."""
|
||||||
if not gateway.option_allow_deconz_groups:
|
if not gateway.option_allow_deconz_groups:
|
||||||
return
|
return
|
||||||
|
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if groups is None:
|
||||||
|
groups = list(gateway.api.groups.values())
|
||||||
|
|
||||||
for group in groups:
|
for group in groups:
|
||||||
if not group.lights:
|
if not group.lights:
|
||||||
continue
|
continue
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pydeconz.light import Lock
|
from pydeconz.light import Lock
|
||||||
@ -28,12 +27,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_lock_from_light(
|
def async_add_lock_from_light(lights: list[Lock] | None = None) -> None:
|
||||||
lights: list[Lock] | ValuesView[Lock] = gateway.api.lights.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add lock from deCONZ."""
|
"""Add lock from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if lights is None:
|
||||||
|
lights = list(gateway.api.lights.locks.values())
|
||||||
|
|
||||||
for light in lights:
|
for light in lights:
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -54,12 +54,13 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_lock_from_sensor(
|
def async_add_lock_from_sensor(sensors: list[DoorLock] | None = None) -> None:
|
||||||
sensors: list[DoorLock] | ValuesView[DoorLock] = gateway.api.sensors.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add lock from deCONZ."""
|
"""Add lock from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if sensors is None:
|
||||||
|
sensors = list(gateway.api.sensors.door_lock.values())
|
||||||
|
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "deCONZ",
|
"name": "deCONZ",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/deconz",
|
"documentation": "https://www.home-assistant.io/integrations/deconz",
|
||||||
"requirements": ["pydeconz==87"],
|
"requirements": ["pydeconz==88"],
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
"manufacturer": "Royal Philips Electronics"
|
"manufacturer": "Royal Philips Electronics"
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable, ValuesView
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from pydeconz.sensor import PRESENCE_DELAY, DeconzSensor as PydeconzSensor, Presence
|
from pydeconz.sensor import PRESENCE_DELAY, Presence, SensorBase as PydeconzSensor
|
||||||
|
|
||||||
from homeassistant.components.number import (
|
from homeassistant.components.number import (
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
@ -62,12 +62,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_sensor(
|
def async_add_sensor(sensors: list[Presence] | None = None) -> None:
|
||||||
sensors: list[Presence] | ValuesView[Presence] = gateway.api.sensors.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add number config sensor from deCONZ."""
|
"""Add number config sensor from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if sensors is None:
|
||||||
|
sensors = list(gateway.api.sensors.presence.values())
|
||||||
|
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
|
|
||||||
if sensor.type.startswith("CLIP"):
|
if sensor.type.startswith("CLIP"):
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pydeconz.group import Scene as PydeconzScene
|
from pydeconz.group import Scene as PydeconzScene
|
||||||
@ -27,13 +26,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_scene(
|
def async_add_scene(scenes: list[PydeconzScene] | None = None) -> None:
|
||||||
scenes: list[PydeconzScene]
|
|
||||||
| ValuesView[PydeconzScene] = gateway.api.scenes.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add scene from deCONZ."""
|
"""Add scene from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if scenes is None:
|
||||||
|
scenes = list(gateway.api.scenes.values())
|
||||||
|
|
||||||
for scene in scenes:
|
for scene in scenes:
|
||||||
|
|
||||||
known_entities = set(gateway.entities[DOMAIN])
|
known_entities = set(gateway.entities[DOMAIN])
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""Support for deCONZ sensors."""
|
"""Support for deCONZ sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable, ValuesView
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@ -9,12 +9,12 @@ from pydeconz.sensor import (
|
|||||||
AirQuality,
|
AirQuality,
|
||||||
Consumption,
|
Consumption,
|
||||||
Daylight,
|
Daylight,
|
||||||
DeconzSensor as PydeconzSensor,
|
|
||||||
GenericStatus,
|
GenericStatus,
|
||||||
Humidity,
|
Humidity,
|
||||||
LightLevel,
|
LightLevel,
|
||||||
Power,
|
Power,
|
||||||
Pressure,
|
Pressure,
|
||||||
|
SensorBase as PydeconzSensor,
|
||||||
Switch,
|
Switch,
|
||||||
Temperature,
|
Temperature,
|
||||||
Time,
|
Time,
|
||||||
@ -174,7 +174,7 @@ ENTITY_DESCRIPTIONS = {
|
|||||||
Temperature: [
|
Temperature: [
|
||||||
DeconzSensorDescription(
|
DeconzSensorDescription(
|
||||||
key="temperature",
|
key="temperature",
|
||||||
value_fn=lambda device: device.temperature, # type: ignore[no-any-return]
|
value_fn=lambda device: device.scaled_temperature, # type: ignore[no-any-return]
|
||||||
update_key="temperature",
|
update_key="temperature",
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
@ -227,10 +227,7 @@ async def async_setup_entry(
|
|||||||
battery_handler = DeconzBatteryHandler(gateway)
|
battery_handler = DeconzBatteryHandler(gateway)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_sensor(
|
def async_add_sensor(sensors: list[PydeconzSensor] | None = None) -> None:
|
||||||
sensors: list[PydeconzSensor]
|
|
||||||
| ValuesView[PydeconzSensor] = gateway.api.sensors.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add sensors from deCONZ.
|
"""Add sensors from deCONZ.
|
||||||
|
|
||||||
Create DeconzBattery if sensor has a battery attribute.
|
Create DeconzBattery if sensor has a battery attribute.
|
||||||
@ -238,6 +235,9 @@ async def async_setup_entry(
|
|||||||
"""
|
"""
|
||||||
entities: list[DeconzSensor] = []
|
entities: list[DeconzSensor] = []
|
||||||
|
|
||||||
|
if sensors is None:
|
||||||
|
sensors = gateway.api.sensors.values()
|
||||||
|
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
|
|
||||||
if not gateway.option_allow_clip_sensor and sensor.type.startswith("CLIP"):
|
if not gateway.option_allow_clip_sensor and sensor.type.startswith("CLIP"):
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pydeconz.light import Siren
|
from pydeconz.light import Siren
|
||||||
@ -34,12 +33,13 @@ async def async_setup_entry(
|
|||||||
gateway.entities[DOMAIN] = set()
|
gateway.entities[DOMAIN] = set()
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_siren(
|
def async_add_siren(lights: list[Siren] | None = None) -> None:
|
||||||
lights: list[Siren] | ValuesView[Siren] = gateway.api.lights.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add siren from deCONZ."""
|
"""Add siren from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if lights is None:
|
||||||
|
lights = list(gateway.api.lights.sirens.values())
|
||||||
|
|
||||||
for light in lights:
|
for light in lights:
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import ValuesView
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from pydeconz.light import Light, Siren
|
from pydeconz.light import Light, Siren
|
||||||
@ -34,7 +33,7 @@ async def async_setup_entry(
|
|||||||
entity_registry = er.async_get(hass)
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
# Siren platform replacing sirens in switch platform added in 2021.10
|
# Siren platform replacing sirens in switch platform added in 2021.10
|
||||||
for light in gateway.api.lights.values():
|
for light in gateway.api.lights.sirens.values():
|
||||||
if isinstance(light, Siren) and (
|
if isinstance(light, Siren) and (
|
||||||
entity_id := entity_registry.async_get_entity_id(
|
entity_id := entity_registry.async_get_entity_id(
|
||||||
DOMAIN, DECONZ_DOMAIN, light.unique_id
|
DOMAIN, DECONZ_DOMAIN, light.unique_id
|
||||||
@ -43,12 +42,13 @@ async def async_setup_entry(
|
|||||||
entity_registry.async_remove(entity_id)
|
entity_registry.async_remove(entity_id)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_add_switch(
|
def async_add_switch(lights: list[Light] | None = None) -> None:
|
||||||
lights: list[Light] | ValuesView[Light] = gateway.api.lights.values(),
|
|
||||||
) -> None:
|
|
||||||
"""Add switch from deCONZ."""
|
"""Add switch from deCONZ."""
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
if lights is None:
|
||||||
|
lights = list(gateway.api.lights.lights.values())
|
||||||
|
|
||||||
for light in lights:
|
for light in lights:
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -1423,7 +1423,7 @@ pydaikin==2.7.0
|
|||||||
pydanfossair==0.1.0
|
pydanfossair==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.deconz
|
# homeassistant.components.deconz
|
||||||
pydeconz==87
|
pydeconz==88
|
||||||
|
|
||||||
# homeassistant.components.delijn
|
# homeassistant.components.delijn
|
||||||
pydelijn==1.0.0
|
pydelijn==1.0.0
|
||||||
|
@ -944,7 +944,7 @@ pycoolmasternet-async==0.1.2
|
|||||||
pydaikin==2.7.0
|
pydaikin==2.7.0
|
||||||
|
|
||||||
# homeassistant.components.deconz
|
# homeassistant.components.deconz
|
||||||
pydeconz==87
|
pydeconz==88
|
||||||
|
|
||||||
# homeassistant.components.dexcom
|
# homeassistant.components.dexcom
|
||||||
pydexcom==0.2.3
|
pydexcom==0.2.3
|
||||||
|
@ -675,7 +675,7 @@ async def test_add_new_binary_sensor_ignored(
|
|||||||
)
|
)
|
||||||
|
|
||||||
aioclient_mock.clear_requests()
|
aioclient_mock.clear_requests()
|
||||||
data = {"groups": {}, "lights": {}, "sensors": {"1": sensor}}
|
data = {"config": {}, "groups": {}, "lights": {}, "sensors": {"1": sensor}}
|
||||||
mock_deconz_request(aioclient_mock, config_entry.data, data)
|
mock_deconz_request(aioclient_mock, config_entry.data, data)
|
||||||
|
|
||||||
await hass.services.async_call(DECONZ_DOMAIN, SERVICE_DEVICE_REFRESH)
|
await hass.services.async_call(DECONZ_DOMAIN, SERVICE_DEVICE_REFRESH)
|
||||||
|
@ -217,6 +217,7 @@ async def test_service_refresh_devices(hass, aioclient_mock):
|
|||||||
aioclient_mock.clear_requests()
|
aioclient_mock.clear_requests()
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
"config": {},
|
||||||
"groups": {
|
"groups": {
|
||||||
"1": {
|
"1": {
|
||||||
"id": "Group 1 id",
|
"id": "Group 1 id",
|
||||||
@ -280,6 +281,7 @@ async def test_service_refresh_devices_trigger_no_state_update(hass, aioclient_m
|
|||||||
aioclient_mock.clear_requests()
|
aioclient_mock.clear_requests()
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
"config": {},
|
||||||
"groups": {
|
"groups": {
|
||||||
"1": {
|
"1": {
|
||||||
"id": "Group 1 id",
|
"id": "Group 1 id",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user