Mark type hint as compulsory for entity.available property (#145189)
parent
f27b2c4df1
commit
8d83341308
|
@ -165,7 +165,7 @@ class MediaroomDevice(MediaPlayerEntity):
|
|||
self._unique_id = None
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ class Luminary(LightEntity):
|
|||
return self._device_attributes
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ class RMVDepartureSensor(SensorEntity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return self._state is not None
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class SonyProjector(SwitchEntity):
|
|||
self._attributes = {}
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return if projector is available."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class StarlineButton(StarlineEntity, ButtonEntity):
|
|||
self.entity_description = description
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return True if entity is available."""
|
||||
return super().available and self._device.online
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class SupervisorProcessSensor(SensorEntity):
|
|||
return self._info.get("statename")
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Could the device be accessed during the last update call."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ class FolderSensor(SensorEntity):
|
|||
return self._state["state"]
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Could the device be accessed during the last update call."""
|
||||
return self._state is not None
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class TfiacClimate(ClimateEntity):
|
|||
self._available = True
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return if the device is available."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class VSensor(SensorEntity):
|
|||
return self._unit
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return if the sensor is available."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class VActuator(SwitchEntity):
|
|||
return self._is_on
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return if the actuator is available."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class BoolEntity(WiffiEntity, BinarySensorEntity):
|
|||
self.reset_expiration_date()
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true if value is valid."""
|
||||
return self._attr_is_on is not None
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class NumberEntity(WiffiEntity, SensorEntity):
|
|||
self.reset_expiration_date()
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true if value is valid."""
|
||||
return self._attr_native_value is not None
|
||||
|
||||
|
@ -116,7 +116,7 @@ class StringEntity(WiffiEntity, SensorEntity):
|
|||
self.reset_expiration_date()
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true if value is valid."""
|
||||
return self._attr_native_value is not None
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ class XiaomiPhilipsAbstractLight(XiaomiMiioEntity, LightEntity):
|
|||
self._state_attrs = {}
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true when state is known."""
|
||||
return self._available
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ class XiaomiGatewayLight(LightEntity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true when state is known."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -928,7 +928,7 @@ class XiaomiAirQualityMonitor(XiaomiMiioEntity, SensorEntity):
|
|||
self.entity_description = description
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true when state is known."""
|
||||
return self._available
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ class XiaomiGatewayIlluminanceSensor(SensorEntity):
|
|||
self._state = None
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true when state is known."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -789,7 +789,7 @@ class XiaomiPlugGenericSwitch(XiaomiMiioEntity, SwitchEntity):
|
|||
return self._icon
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true when state is known."""
|
||||
return self._available
|
||||
|
||||
|
|
|
@ -676,6 +676,7 @@ _ENTITY_MATCH: list[TypeHintMatch] = [
|
|||
TypeHintMatch(
|
||||
function_name="available",
|
||||
return_type="bool",
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="assumed_state",
|
||||
|
|
Loading…
Reference in New Issue