deCONZ dependency exports type hints (#70449)
This commit is contained in:
parent
a29265e725
commit
678888c65f
14 changed files with 29 additions and 29 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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."""
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue