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