diff --git a/homeassistant/components/deconz/binary_sensor.py b/homeassistant/components/deconz/binary_sensor.py index a8cc5bc5808..687c70d76ed 100644 --- a/homeassistant/components/deconz/binary_sensor.py +++ b/homeassistant/components/deconz/binary_sensor.py @@ -163,7 +163,7 @@ ENTITY_DESCRIPTIONS = { BINARY_SENSOR_DESCRIPTIONS = [ DeconzBinarySensorDescription( key="tampered", - value_fn=lambda device: device.tampered, # type: ignore[no-any-return] + value_fn=lambda device: device.tampered, suffix="Tampered", update_key="tampered", device_class=BinarySensorDeviceClass.TAMPER, @@ -171,7 +171,7 @@ BINARY_SENSOR_DESCRIPTIONS = [ ), DeconzBinarySensorDescription( key="low_battery", - value_fn=lambda device: device.low_battery, # type: ignore[no-any-return] + value_fn=lambda device: device.low_battery, suffix="Low Battery", update_key="lowbattery", device_class=BinarySensorDeviceClass.BATTERY, diff --git a/homeassistant/components/deconz/climate.py b/homeassistant/components/deconz/climate.py index 5c1c0638722..c92fdda336a 100644 --- a/homeassistant/components/deconz/climate.py +++ b/homeassistant/components/deconz/climate.py @@ -228,16 +228,16 @@ class DeconzThermostat(DeconzDevice, ClimateEntity): @property def current_temperature(self) -> float: """Return the current temperature.""" - return self._device.scaled_temperature # type: ignore[no-any-return] + return self._device.scaled_temperature @property def target_temperature(self) -> float | None: """Return the target temperature.""" if self._device.mode == THERMOSTAT_MODE_COOL and self._device.cooling_setpoint: - return self._device.cooling_setpoint # type: ignore[no-any-return] + return self._device.cooling_setpoint if self._device.heating_setpoint: - return self._device.heating_setpoint # type: ignore[no-any-return] + return self._device.heating_setpoint return None diff --git a/homeassistant/components/deconz/cover.py b/homeassistant/components/deconz/cover.py index 243294de382..b3738b21e59 100644 --- a/homeassistant/components/deconz/cover.py +++ b/homeassistant/components/deconz/cover.py @@ -92,7 +92,7 @@ class DeconzCover(DeconzDevice, CoverEntity): @property def current_cover_position(self) -> int: """Return the current position of the cover.""" - return 100 - self._device.lift # type: ignore[no-any-return] + return 100 - self._device.lift @property def is_closed(self) -> bool: @@ -120,7 +120,7 @@ class DeconzCover(DeconzDevice, CoverEntity): def current_cover_tilt_position(self) -> int | None: """Return the current tilt position of the cover.""" if self._device.tilt is not None: - return 100 - self._device.tilt # type: ignore[no-any-return] + return 100 - self._device.tilt return None async def async_set_cover_tilt_position(self, **kwargs: Any) -> None: diff --git a/homeassistant/components/deconz/deconz_device.py b/homeassistant/components/deconz/deconz_device.py index c3fab20f678..37e846e8c77 100644 --- a/homeassistant/components/deconz/deconz_device.py +++ b/homeassistant/components/deconz/deconz_device.py @@ -31,7 +31,7 @@ class DeconzBase: def unique_id(self) -> str: """Return a unique identifier for this device.""" assert not isinstance(self._device, PydeconzScene) - return self._device.unique_id # type: ignore[no-any-return] + return self._device.unique_id @property def serial(self) -> str | None: @@ -39,7 +39,7 @@ class DeconzBase: assert not isinstance(self._device, PydeconzScene) if not self._device.unique_id or self._device.unique_id.count(":") != 7: return None - return self._device.unique_id.split("-", 1)[0] # type: ignore[no-any-return] + return self._device.unique_id.split("-", 1)[0] @property def device_info(self) -> DeviceInfo | None: diff --git a/homeassistant/components/deconz/fan.py b/homeassistant/components/deconz/fan.py index 4629fc3871e..8f9f4691241 100644 --- a/homeassistant/components/deconz/fan.py +++ b/homeassistant/components/deconz/fan.py @@ -92,7 +92,7 @@ class DeconzFan(DeconzDevice, FanEntity): @property def is_on(self) -> bool: """Return true if fan is on.""" - return self._device.speed != FAN_SPEED_OFF # type: ignore[no-any-return] + return self._device.speed != FAN_SPEED_OFF @property def percentage(self) -> int | None: diff --git a/homeassistant/components/deconz/light.py b/homeassistant/components/deconz/light.py index eaa3d7d2e4b..a175d1e4e70 100644 --- a/homeassistant/components/deconz/light.py +++ b/homeassistant/components/deconz/light.py @@ -186,12 +186,12 @@ class DeconzBaseLight(Generic[_L], DeconzDevice, LightEntity): @property def brightness(self) -> int | None: """Return the brightness of this light between 0..255.""" - return self._device.brightness # type: ignore[no-any-return] + return self._device.brightness @property def color_temp(self) -> int | None: """Return the CT color value.""" - return self._device.color_temp # type: ignore[no-any-return] + return self._device.color_temp @property def hs_color(self) -> tuple[float, float] | None: @@ -203,12 +203,12 @@ class DeconzBaseLight(Generic[_L], DeconzDevice, LightEntity): @property def xy_color(self) -> tuple[float, float] | None: """Return the XY color value.""" - return self._device.xy # type: ignore[no-any-return] + return self._device.xy @property def is_on(self) -> bool | None: """Return true if light is on.""" - return self._device.state # type: ignore[no-any-return] + return self._device.state async def async_turn_on(self, **kwargs: Any) -> None: """Turn on light.""" diff --git a/homeassistant/components/deconz/lock.py b/homeassistant/components/deconz/lock.py index 397a600032f..080a4aacbd6 100644 --- a/homeassistant/components/deconz/lock.py +++ b/homeassistant/components/deconz/lock.py @@ -93,7 +93,7 @@ class DeconzLock(DeconzDevice, LockEntity): @property def is_locked(self) -> bool: """Return true if lock is on.""" - return self._device.is_locked # type: ignore[no-any-return] + return self._device.is_locked async def async_lock(self, **kwargs: Any) -> None: """Lock the lock.""" diff --git a/homeassistant/components/deconz/manifest.json b/homeassistant/components/deconz/manifest.json index 6f5d8e369b5..e26c659ff73 100644 --- a/homeassistant/components/deconz/manifest.json +++ b/homeassistant/components/deconz/manifest.json @@ -3,7 +3,7 @@ "name": "deCONZ", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/deconz", - "requirements": ["pydeconz==88"], + "requirements": ["pydeconz==90"], "ssdp": [ { "manufacturer": "Royal Philips Electronics" diff --git a/homeassistant/components/deconz/number.py b/homeassistant/components/deconz/number.py index 5d3f7eb704f..906c560a840 100644 --- a/homeassistant/components/deconz/number.py +++ b/homeassistant/components/deconz/number.py @@ -28,7 +28,7 @@ class DeconzNumberDescriptionMixin: suffix: str update_key: str - value_fn: Callable[[Presence], float] + value_fn: Callable[[Presence], float | None] @dataclass @@ -40,7 +40,7 @@ ENTITY_DESCRIPTIONS = { Presence: [ DeconzNumberDescription( key="delay", - value_fn=lambda device: device.delay, # type: ignore[no-any-return] + value_fn=lambda device: device.delay, suffix="Delay", update_key=PRESENCE_DELAY, max_value=65535, @@ -100,7 +100,7 @@ async def async_setup_entry( async_add_sensor( [ - gateway.api.sensors[key] + gateway.api.sensors.presence[key] for key in sorted(gateway.api.sensors.presence, key=int) ] ) @@ -132,7 +132,7 @@ class DeconzNumber(DeconzDevice, NumberEntity): super().async_update_callback() @property - def value(self) -> float: + def value(self) -> float | None: """Return the value of the sensor property.""" return self.entity_description.value_fn(self._device) diff --git a/homeassistant/components/deconz/sensor.py b/homeassistant/components/deconz/sensor.py index 0e80cf5b456..44af7326312 100644 --- a/homeassistant/components/deconz/sensor.py +++ b/homeassistant/components/deconz/sensor.py @@ -216,7 +216,7 @@ ENTITY_DESCRIPTIONS = { SENSOR_DESCRIPTIONS = [ DeconzSensorDescription( key="battery", - value_fn=lambda device: device.battery, # type: ignore[no-any-return] + value_fn=lambda device: device.battery, suffix="Battery", update_key="battery", device_class=SensorDeviceClass.BATTERY, @@ -226,7 +226,7 @@ SENSOR_DESCRIPTIONS = [ ), DeconzSensorDescription( key="secondary_temperature", - value_fn=lambda device: device.secondary_temperature, # type: ignore[no-any-return] + value_fn=lambda device: device.secondary_temperature, suffix="Temperature", update_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, @@ -354,9 +354,9 @@ class DeconzSensor(DeconzDevice, SensorEntity): def native_value(self) -> StateType | datetime: """Return the state of the sensor.""" if self.entity_description.device_class is SensorDeviceClass.TIMESTAMP: - return dt_util.parse_datetime( - self.entity_description.value_fn(self._device) # type: ignore[arg-type] - ) + value = self.entity_description.value_fn(self._device) + assert isinstance(value, str) + return dt_util.parse_datetime(value) return self.entity_description.value_fn(self._device) @property diff --git a/homeassistant/components/deconz/siren.py b/homeassistant/components/deconz/siren.py index 18121d989a8..52daeca4760 100644 --- a/homeassistant/components/deconz/siren.py +++ b/homeassistant/components/deconz/siren.py @@ -73,7 +73,7 @@ class DeconzSiren(DeconzDevice, SirenEntity): @property def is_on(self) -> bool: """Return true if siren is on.""" - return self._device.is_on # type: ignore[no-any-return] + return self._device.is_on async def async_turn_on(self, **kwargs: Any) -> None: """Turn on siren.""" diff --git a/homeassistant/components/deconz/switch.py b/homeassistant/components/deconz/switch.py index 5326243a8ba..8d405578be8 100644 --- a/homeassistant/components/deconz/switch.py +++ b/homeassistant/components/deconz/switch.py @@ -80,7 +80,7 @@ class DeconzPowerPlug(DeconzDevice, SwitchEntity): @property def is_on(self) -> bool: """Return true if switch is on.""" - return self._device.on # type: ignore[no-any-return] + return self._device.on async def async_turn_on(self, **kwargs: Any) -> None: """Turn on switch.""" diff --git a/requirements_all.txt b/requirements_all.txt index 8792afd1076..5a123990024 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1426,7 +1426,7 @@ pydaikin==2.7.0 pydanfossair==0.1.0 # homeassistant.components.deconz -pydeconz==88 +pydeconz==90 # homeassistant.components.delijn pydelijn==1.0.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index deb527113ed..e84eddc9af1 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -947,7 +947,7 @@ pycoolmasternet-async==0.1.2 pydaikin==2.7.0 # homeassistant.components.deconz -pydeconz==88 +pydeconz==90 # homeassistant.components.dexcom pydexcom==0.2.3