Update integrations t-z to override extra_state_attributes() (#47760)
This commit is contained in:
parent
14a59d290a
commit
1fc8e32d86
127 changed files with 218 additions and 223 deletions
|
@ -231,7 +231,7 @@ class TadoZoneBinarySensor(TadoZoneEntity, BinarySensorEntity):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._state_attributes
|
return self._state_attributes
|
||||||
|
|
||||||
|
|
|
@ -462,7 +462,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return temperature offset."""
|
"""Return temperature offset."""
|
||||||
return self._tado_zone_temp_offset
|
return self._tado_zone_temp_offset
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ class TadoHomeSensor(TadoHomeEntity, Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._state_attributes
|
return self._state_attributes
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ class TadoZoneSensor(TadoZoneEntity, Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._state_attributes
|
return self._state_attributes
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ class TahomaDevice(Entity):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
return {"tahoma_device_id": self.tahoma_device.url}
|
return {"tahoma_device_id": self.tahoma_device.url}
|
||||||
|
|
||||||
|
|
|
@ -57,10 +57,10 @@ class TahomaBinarySensor(TahomaDevice, BinarySensorEntity):
|
||||||
return self._icon
|
return self._icon
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attr = {}
|
attr = {}
|
||||||
super_attr = super().device_state_attributes
|
super_attr = super().extra_state_attributes
|
||||||
if super_attr is not None:
|
if super_attr is not None:
|
||||||
attr.update(super_attr)
|
attr.update(super_attr)
|
||||||
|
|
||||||
|
|
|
@ -194,10 +194,10 @@ class TahomaCover(TahomaDevice, CoverEntity):
|
||||||
return TAHOMA_DEVICE_CLASSES.get(self.tahoma_device.type)
|
return TAHOMA_DEVICE_CLASSES.get(self.tahoma_device.type)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attr = {}
|
attr = {}
|
||||||
super_attr = super().device_state_attributes
|
super_attr = super().extra_state_attributes
|
||||||
if super_attr is not None:
|
if super_attr is not None:
|
||||||
attr.update(super_attr)
|
attr.update(super_attr)
|
||||||
|
|
||||||
|
|
|
@ -78,12 +78,12 @@ class TahomaLock(TahomaDevice, LockEntity):
|
||||||
return self._lock_status == STATE_LOCKED
|
return self._lock_status == STATE_LOCKED
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the lock state attributes."""
|
"""Return the lock state attributes."""
|
||||||
attr = {
|
attr = {
|
||||||
ATTR_BATTERY_LEVEL: self._battery_level,
|
ATTR_BATTERY_LEVEL: self._battery_level,
|
||||||
}
|
}
|
||||||
super_attr = super().device_state_attributes
|
super_attr = super().extra_state_attributes
|
||||||
if super_attr is not None:
|
if super_attr is not None:
|
||||||
attr.update(super_attr)
|
attr.update(super_attr)
|
||||||
return attr
|
return attr
|
||||||
|
|
|
@ -37,6 +37,6 @@ class TahomaScene(Scene):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the scene."""
|
"""Return the state attributes of the scene."""
|
||||||
return {"tahoma_scene_oid": self.tahoma_scene.oid}
|
return {"tahoma_scene_oid": self.tahoma_scene.oid}
|
||||||
|
|
|
@ -110,10 +110,10 @@ class TahomaSensor(TahomaDevice, Entity):
|
||||||
_LOGGER.debug("Update %s, value: %d", self._name, self.current_value)
|
_LOGGER.debug("Update %s, value: %d", self._name, self.current_value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attr = {}
|
attr = {}
|
||||||
super_attr = super().device_state_attributes
|
super_attr = super().extra_state_attributes
|
||||||
if super_attr is not None:
|
if super_attr is not None:
|
||||||
attr.update(super_attr)
|
attr.update(super_attr)
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,10 @@ class TahomaSwitch(TahomaDevice, SwitchEntity):
|
||||||
return bool(self._state == STATE_ON)
|
return bool(self._state == STATE_ON)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attr = {}
|
attr = {}
|
||||||
super_attr = super().device_state_attributes
|
super_attr = super().extra_state_attributes
|
||||||
if super_attr is not None:
|
if super_attr is not None:
|
||||||
attr.update(super_attr)
|
attr.update(super_attr)
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ class TankUtilitySensor(Entity):
|
||||||
return self._unit_of_measurement
|
return self._unit_of_measurement
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the attributes of the device."""
|
"""Return the attributes of the device."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ class FuelPriceSensor(CoordinatorEntity):
|
||||||
return f"{self._station_id}_{self._fuel_type}"
|
return f"{self._station_id}_{self._fuel_type}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the attributes of the device."""
|
"""Return the attributes of the device."""
|
||||||
data = self.coordinator.data[self._station_id]
|
data = self.coordinator.data[self._station_id]
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ class TautulliSensor(Entity):
|
||||||
return "Watching"
|
return "Watching"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return attributes for the sensor."""
|
"""Return attributes for the sensor."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class TelldusLiveEntity(Entity):
|
||||||
return self._client.is_available(self.device_id)
|
return self._client.is_available(self.device_id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {}
|
attrs = {}
|
||||||
if self._battery_level:
|
if self._battery_level:
|
||||||
|
|
|
@ -168,7 +168,7 @@ class TemplateEntity(Entity):
|
||||||
return self._entity_picture
|
return self._entity_picture
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ class TensorFlowImageProcessor(ImageProcessingEntity):
|
||||||
return self._total_matches
|
return self._total_matches
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
return {
|
return {
|
||||||
ATTR_MATCHES: self._matches,
|
ATTR_MATCHES: self._matches,
|
||||||
|
|
|
@ -307,7 +307,7 @@ class TeslaDevice(CoordinatorEntity):
|
||||||
return ICONS.get(self.tesla_device.type)
|
return ICONS.get(self.tesla_device.type)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
attr = self._attributes
|
attr = self._attributes
|
||||||
if self.tesla_device.has_battery():
|
if self.tesla_device.has_battery():
|
||||||
|
|
|
@ -42,9 +42,9 @@ class TeslaDeviceEntity(TeslaDevice, TrackerEntity):
|
||||||
return SOURCE_TYPE_GPS
|
return SOURCE_TYPE_GPS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
attr = super().device_state_attributes.copy()
|
attr = super().extra_state_attributes.copy()
|
||||||
location = self.tesla_device.get_location()
|
location = self.tesla_device.get_location()
|
||||||
if location:
|
if location:
|
||||||
attr.update(
|
attr.update(
|
||||||
|
|
|
@ -81,7 +81,7 @@ class TeslaSensor(TeslaDevice, Entity):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
attr = self._attributes.copy()
|
attr = self._attributes.copy()
|
||||||
if self.tesla_device.type == "charging rate sensor":
|
if self.tesla_device.type == "charging rate sensor":
|
||||||
|
|
|
@ -124,7 +124,7 @@ class ThermoworksSmokeSensor(Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ class TtnDataSensor(Entity):
|
||||||
return self._unit_of_measurement
|
return self._unit_of_measurement
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the sensor."""
|
"""Return the state attributes of the sensor."""
|
||||||
if self._ttn_data_storage.data is not None:
|
if self._ttn_data_storage.data is not None:
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -144,7 +144,7 @@ class ThresholdSensor(BinarySensorEntity):
|
||||||
return TYPE_UPPER
|
return TYPE_UPPER
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the sensor."""
|
"""Return the state attributes of the sensor."""
|
||||||
return {
|
return {
|
||||||
ATTR_ENTITY_ID: self._entity_id,
|
ATTR_ENTITY_ID: self._entity_id,
|
||||||
|
|
|
@ -54,7 +54,7 @@ class TibberSensor(Entity):
|
||||||
self._last_updated = None
|
self._last_updated = None
|
||||||
self._state = None
|
self._state = None
|
||||||
self._is_available = False
|
self._is_available = False
|
||||||
self._device_state_attributes = {}
|
self._extra_state_attributes = {}
|
||||||
self._name = tibber_home.info["viewer"]["home"]["appNickname"]
|
self._name = tibber_home.info["viewer"]["home"]["appNickname"]
|
||||||
if self._name is None:
|
if self._name is None:
|
||||||
self._name = tibber_home.info["viewer"]["home"]["address"].get(
|
self._name = tibber_home.info["viewer"]["home"]["address"].get(
|
||||||
|
@ -63,9 +63,9 @@ class TibberSensor(Entity):
|
||||||
self._spread_load_constant = randrange(3600)
|
self._spread_load_constant = randrange(3600)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._device_state_attributes
|
return self._extra_state_attributes
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def model(self):
|
def model(self):
|
||||||
|
@ -121,10 +121,10 @@ class TibberSensorElPrice(TibberSensor):
|
||||||
|
|
||||||
res = self._tibber_home.current_price_data()
|
res = self._tibber_home.current_price_data()
|
||||||
self._state, price_level, self._last_updated = res
|
self._state, price_level, self._last_updated = res
|
||||||
self._device_state_attributes["price_level"] = price_level
|
self._extra_state_attributes["price_level"] = price_level
|
||||||
|
|
||||||
attrs = self._tibber_home.current_attributes()
|
attrs = self._tibber_home.current_attributes()
|
||||||
self._device_state_attributes.update(attrs)
|
self._extra_state_attributes.update(attrs)
|
||||||
self._is_available = self._state is not None
|
self._is_available = self._state is not None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -165,11 +165,11 @@ class TibberSensorElPrice(TibberSensor):
|
||||||
except (asyncio.TimeoutError, aiohttp.ClientError):
|
except (asyncio.TimeoutError, aiohttp.ClientError):
|
||||||
return
|
return
|
||||||
data = self._tibber_home.info["viewer"]["home"]
|
data = self._tibber_home.info["viewer"]["home"]
|
||||||
self._device_state_attributes["app_nickname"] = data["appNickname"]
|
self._extra_state_attributes["app_nickname"] = data["appNickname"]
|
||||||
self._device_state_attributes["grid_company"] = data["meteringPointData"][
|
self._extra_state_attributes["grid_company"] = data["meteringPointData"][
|
||||||
"gridCompany"
|
"gridCompany"
|
||||||
]
|
]
|
||||||
self._device_state_attributes["estimated_annual_consumption"] = data[
|
self._extra_state_attributes["estimated_annual_consumption"] = data[
|
||||||
"meteringPointData"
|
"meteringPointData"
|
||||||
]["estimatedAnnualConsumption"]
|
]["estimatedAnnualConsumption"]
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class TibberSensorRT(TibberSensor):
|
||||||
for key, value in live_measurement.items():
|
for key, value in live_measurement.items():
|
||||||
if value is None:
|
if value is None:
|
||||||
continue
|
continue
|
||||||
self._device_state_attributes[key] = value
|
self._extra_state_attributes[key] = value
|
||||||
|
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class TileDeviceTracker(CoordinatorEntity, TrackerEntity):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
return self._attrs
|
return self._attrs
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ class TMBSensor(Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the last update."""
|
"""Return the state attributes of the last update."""
|
||||||
return {
|
return {
|
||||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||||
|
|
|
@ -109,7 +109,7 @@ class TodSensor(BinarySensorEntity):
|
||||||
return self._next_update
|
return self._next_update
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the sensor."""
|
"""Return the state attributes of the sensor."""
|
||||||
return {
|
return {
|
||||||
ATTR_AFTER: self.after.astimezone(self.hass.config.time_zone).isoformat(),
|
ATTR_AFTER: self.after.astimezone(self.hass.config.time_zone).isoformat(),
|
||||||
|
|
|
@ -284,7 +284,7 @@ class TodoistProjectDevice(CalendarEventDevice):
|
||||||
return await self.data.async_get_events(hass, start_date, end_date)
|
return await self.data.async_get_events(hass, start_date, end_date)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
if self.data.event is None:
|
if self.data.event is None:
|
||||||
# No tasks, we don't REALLY need to show anything.
|
# No tasks, we don't REALLY need to show anything.
|
||||||
|
|
|
@ -114,7 +114,7 @@ class ToonThermostatDevice(ToonDisplayDeviceEntity, ClimateEntity):
|
||||||
return DEFAULT_MAX_TEMP
|
return DEFAULT_MAX_TEMP
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Dict[str, Any]:
|
def extra_state_attributes(self) -> Dict[str, Any]:
|
||||||
"""Return the current state of the burner."""
|
"""Return the current state of the burner."""
|
||||||
return {"heating_type": self.coordinator.data.agreement.heating_type}
|
return {"heating_type": self.coordinator.data.agreement.heating_type}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity):
|
||||||
self._location_id = location_id
|
self._location_id = location_id
|
||||||
self._client = client
|
self._client = client
|
||||||
self._state = None
|
self._state = None
|
||||||
self._device_state_attributes = {}
|
self._extra_state_attributes = {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -62,9 +62,9 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity):
|
||||||
return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT
|
return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
return self._device_state_attributes
|
return self._extra_state_attributes
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
|
@ -109,7 +109,7 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity):
|
||||||
state = None
|
state = None
|
||||||
|
|
||||||
self._state = state
|
self._state = state
|
||||||
self._device_state_attributes = attr
|
self._extra_state_attributes = attr
|
||||||
|
|
||||||
def alarm_disarm(self, code=None):
|
def alarm_disarm(self, code=None):
|
||||||
"""Send disarm command."""
|
"""Send disarm command."""
|
||||||
|
|
|
@ -73,7 +73,7 @@ class TotalConnectBinarySensor(BinarySensorEntity):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attributes = {
|
attributes = {
|
||||||
"zone_id": self._zone_id,
|
"zone_id": self._zone_id,
|
||||||
|
|
|
@ -163,7 +163,7 @@ class TPLinkSmartBulb(LightEntity):
|
||||||
return self._is_available
|
return self._is_available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
return self._emeter_params
|
return self._emeter_params
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ class SmartPlugSwitch(SwitchEntity):
|
||||||
self.smartplug.turn_off()
|
self.smartplug.turn_off()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
return self._emeter_params
|
return self._emeter_params
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,7 @@ class TraccarEntity(TrackerEntity, RestoreEntity):
|
||||||
return self._battery
|
return self._battery
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return device specific attributes."""
|
"""Return device specific attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class TradfriCover(TradfriBaseDevice, CoverEntity):
|
||||||
self._refresh(device)
|
self._refresh(device)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return {ATTR_MODEL: self._device.device_info.model_number}
|
return {ATTR_MODEL: self._device.device_info.model_number}
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ class TrainSensor(Entity):
|
||||||
self._delay_in_minutes = self._state.get_delay_time()
|
self._delay_in_minutes = self._state.get_delay_time()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
if self._state is None:
|
if self._state is None:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -172,7 +172,7 @@ class TrafikverketWeatherStation(Entity):
|
||||||
return self._icon
|
return self._icon
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of Trafikverket Weatherstation."""
|
"""Return the state attributes of Trafikverket Weatherstation."""
|
||||||
return {
|
return {
|
||||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||||
|
|
|
@ -148,7 +148,7 @@ class TransmissionTorrentsSensor(TransmissionSensor):
|
||||||
return "Torrents"
|
return "Torrents"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes, if any."""
|
"""Return the state attributes, if any."""
|
||||||
info = _torrents_info(
|
info = _torrents_info(
|
||||||
torrents=self._tm_client.api.torrents,
|
torrents=self._tm_client.api.torrents,
|
||||||
|
|
|
@ -87,7 +87,7 @@ class TransportNSWSensor(Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
if self._times is not None:
|
if self._times is not None:
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -124,7 +124,7 @@ class TravisCISensor(Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {}
|
attrs = {}
|
||||||
attrs[ATTR_ATTRIBUTION] = ATTRIBUTION
|
attrs[ATTR_ATTRIBUTION] = ATTRIBUTION
|
||||||
|
|
|
@ -146,7 +146,7 @@ class SensorTrend(BinarySensorEntity):
|
||||||
return self._device_class
|
return self._device_class
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the sensor."""
|
"""Return the state attributes of the sensor."""
|
||||||
return {
|
return {
|
||||||
ATTR_ENTITY_ID: self._entity_id,
|
ATTR_ENTITY_ID: self._entity_id,
|
||||||
|
|
|
@ -88,7 +88,7 @@ class TwitchSensor(Entity):
|
||||||
return self._preview
|
return self._preview
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attr = dict(self._statistics)
|
attr = dict(self._statistics)
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ class UkTransportLiveBusTimeSensor(UkTransportSensor):
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return other details about the sensor state."""
|
"""Return other details about the sensor state."""
|
||||||
attrs = {}
|
attrs = {}
|
||||||
if self._data is not None:
|
if self._data is not None:
|
||||||
|
@ -261,7 +261,7 @@ class UkTransportLiveTrainTimeSensor(UkTransportSensor):
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return other details about the sensor state."""
|
"""Return other details about the sensor state."""
|
||||||
attrs = {}
|
attrs = {}
|
||||||
if self._data is not None:
|
if self._data is not None:
|
||||||
|
|
|
@ -249,7 +249,7 @@ class UniFiClientTracker(UniFiClient, ScannerEntity):
|
||||||
return f"{self.client.mac}-{self.controller.site}"
|
return f"{self.client.mac}-{self.controller.site}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the client state attributes."""
|
"""Return the client state attributes."""
|
||||||
raw = self.client.raw
|
raw = self.client.raw
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ class UniFiDeviceTracker(UniFiBase, ScannerEntity):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
if self.device.state == 0:
|
if self.device.state == 0:
|
||||||
return {}
|
return {}
|
||||||
|
|
|
@ -238,7 +238,7 @@ class UniFiPOEClientSwitch(UniFiClient, SwitchEntity, RestoreEntity):
|
||||||
await self.device.async_set_port_poe_mode(self.client.sw_port, "off")
|
await self.device.async_set_port_poe_mode(self.client.sw_port, "off")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attributes = {
|
attributes = {
|
||||||
"power": self.port.poe_power,
|
"power": self.port.poe_power,
|
||||||
|
|
|
@ -502,7 +502,7 @@ class UniversalMediaPlayer(MediaPlayerEntity):
|
||||||
return flags
|
return flags
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
active_child = self._child_state
|
active_child = self._child_state
|
||||||
return {ATTR_ACTIVE_CHILD: active_child.entity_id} if active_child else {}
|
return {ATTR_ACTIVE_CHILD: active_child.entity_id} if active_child else {}
|
||||||
|
|
|
@ -110,7 +110,7 @@ class UpbEntity(Entity):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the default attributes of the element."""
|
"""Return the default attributes of the element."""
|
||||||
return self._element.as_dict()
|
return self._element.as_dict()
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ class UpCloudServerEntity(CoordinatorEntity):
|
||||||
return DEFAULT_COMPONENT_DEVICE_CLASS
|
return DEFAULT_COMPONENT_DEVICE_CLASS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the UpCloud server."""
|
"""Return the state attributes of the UpCloud server."""
|
||||||
return {
|
return {
|
||||||
x: getattr(self._server, x, None)
|
x: getattr(self._server, x, None)
|
||||||
|
|
|
@ -35,7 +35,7 @@ class UpdaterBinary(CoordinatorEntity, BinarySensorEntity):
|
||||||
return self.coordinator.data.update_available
|
return self.coordinator.data.update_available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> dict:
|
def extra_state_attributes(self) -> dict:
|
||||||
"""Return the optional state attributes."""
|
"""Return the optional state attributes."""
|
||||||
if not self.coordinator.data:
|
if not self.coordinator.data:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -75,7 +75,7 @@ class UptimeRobotBinarySensor(BinarySensorEntity):
|
||||||
return DEVICE_CLASS_CONNECTIVITY
|
return DEVICE_CLASS_CONNECTIVITY
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the binary sensor."""
|
"""Return the state attributes of the binary sensor."""
|
||||||
return {ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_TARGET: self._target}
|
return {ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_TARGET: self._target}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ class UscisSensor(Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ class UsgsEarthquakesEvent(GeolocationEvent):
|
||||||
return DEFAULT_UNIT_OF_MEASUREMENT
|
return DEFAULT_UNIT_OF_MEASUREMENT
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attributes = {}
|
attributes = {}
|
||||||
for key, value in (
|
for key, value in (
|
||||||
|
|
|
@ -324,7 +324,7 @@ class UtilityMeterSensor(RestoreEntity):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the sensor."""
|
"""Return the state attributes of the sensor."""
|
||||||
state_attr = {
|
state_attr = {
|
||||||
ATTR_SOURCE_ID: self._sensor_source_id,
|
ATTR_SOURCE_ID: self._sensor_source_id,
|
||||||
|
|
|
@ -111,7 +111,7 @@ class UnifiVideoCamera(Camera):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the camera state attributes."""
|
"""Return the camera state attributes."""
|
||||||
attr = {}
|
attr = {}
|
||||||
if self.motion_detection_enabled:
|
if self.motion_detection_enabled:
|
||||||
|
|
|
@ -83,7 +83,7 @@ class ValloxFan(FanEntity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
return {
|
return {
|
||||||
ATTR_PROFILE_FAN_SPEED_HOME["description"]: self._fan_speed_home,
|
ATTR_PROFILE_FAN_SPEED_HOME["description"]: self._fan_speed_home,
|
||||||
|
|
|
@ -106,7 +106,7 @@ class VasttrafikDepartureSensor(Entity):
|
||||||
return ICON
|
return ICON
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ class VenstarThermostat(ClimateEntity):
|
||||||
return FAN_AUTO
|
return FAN_AUTO
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the optional state attributes."""
|
"""Return the optional state attributes."""
|
||||||
return {
|
return {
|
||||||
ATTR_FAN_STATE: self._client.fanstate,
|
ATTR_FAN_STATE: self._client.fanstate,
|
||||||
|
|
|
@ -248,7 +248,7 @@ class VeraDevice(Generic[DeviceType], Entity):
|
||||||
return self.vera_device.should_poll
|
return self.vera_device.should_poll
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
attr = {}
|
attr = {}
|
||||||
|
|
||||||
|
|
|
@ -61,14 +61,14 @@ class VeraLock(VeraDevice[veraApi.VeraLock], LockEntity):
|
||||||
return self._state == STATE_LOCKED
|
return self._state == STATE_LOCKED
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Who unlocked the lock and did a low battery alert fire.
|
"""Who unlocked the lock and did a low battery alert fire.
|
||||||
|
|
||||||
Reports on the previous poll cycle.
|
Reports on the previous poll cycle.
|
||||||
changed_by_name is a string like 'Bob'.
|
changed_by_name is a string like 'Bob'.
|
||||||
low_battery is 1 if an alert fired, 0 otherwise.
|
low_battery is 1 if an alert fired, 0 otherwise.
|
||||||
"""
|
"""
|
||||||
data = super().device_state_attributes
|
data = super().extra_state_attributes
|
||||||
|
|
||||||
last_user = self.vera_device.get_last_user_alert()
|
last_user = self.vera_device.get_last_user_alert()
|
||||||
if last_user is not None:
|
if last_user is not None:
|
||||||
|
|
|
@ -53,6 +53,6 @@ class VeraScene(Scene):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Return the state attributes of the scene."""
|
"""Return the state attributes of the scene."""
|
||||||
return {"vera_scene_id": self.vera_scene.vera_scene_id}
|
return {"vera_scene_id": self.vera_scene.vera_scene_id}
|
||||||
|
|
|
@ -118,7 +118,7 @@ class VersionSensor(Entity):
|
||||||
return self.haversion.api.version
|
return self.haversion.api.version
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return attributes for the sensor."""
|
"""Return attributes for the sensor."""
|
||||||
return self.haversion.api.version_data
|
return self.haversion.api.version_data
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ class VeSyncFanHA(VeSyncDevice, FanEntity):
|
||||||
return self.smartfan.uuid
|
return self.smartfan.uuid
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the fan."""
|
"""Return the state attributes of the fan."""
|
||||||
return {
|
return {
|
||||||
"mode": self.smartfan.mode,
|
"mode": self.smartfan.mode,
|
||||||
|
|
|
@ -72,7 +72,7 @@ class VeSyncSwitchHA(VeSyncBaseSwitch, SwitchEntity):
|
||||||
self.smartplug = plug
|
self.smartplug = plug
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
if not hasattr(self.smartplug, "weekly_energy_total"):
|
if not hasattr(self.smartplug, "weekly_energy_total"):
|
||||||
return {}
|
return {}
|
||||||
|
|
|
@ -119,7 +119,7 @@ class ViaggiaTrenoSensor(Entity):
|
||||||
return self._unit
|
return self._unit
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return extra attributes."""
|
"""Return extra attributes."""
|
||||||
self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION
|
self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
|
@ -278,7 +278,7 @@ class ViCareClimate(ClimateEntity):
|
||||||
self._api.activateProgram(vicare_program)
|
self._api.activateProgram(vicare_program)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Show Device Attributes."""
|
"""Show Device Attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ class VolvoEntity(Entity):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
return dict(
|
return dict(
|
||||||
self.instrument.attributes,
|
self.instrument.attributes,
|
||||||
|
|
|
@ -86,7 +86,7 @@ class VultrBinarySensor(BinarySensorEntity):
|
||||||
return DEFAULT_DEVICE_CLASS
|
return DEFAULT_DEVICE_CLASS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the Vultr subscription."""
|
"""Return the state attributes of the Vultr subscription."""
|
||||||
return {
|
return {
|
||||||
ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"),
|
ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"),
|
||||||
|
|
|
@ -80,7 +80,7 @@ class VultrSwitch(SwitchEntity):
|
||||||
return "mdi:server" if self.is_on else "mdi:server-off"
|
return "mdi:server" if self.is_on else "mdi:server-off"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the Vultr subscription."""
|
"""Return the state attributes of the Vultr subscription."""
|
||||||
return {
|
return {
|
||||||
ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"),
|
ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"),
|
||||||
|
|
|
@ -151,7 +151,7 @@ class WaqiSensor(Entity):
|
||||||
return "AQI"
|
return "AQI"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the last update."""
|
"""Return the state attributes of the last update."""
|
||||||
attrs = {}
|
attrs = {}
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ class WazeTravelTime(Entity):
|
||||||
return ICON
|
return ICON
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the last update."""
|
"""Return the state attributes of the last update."""
|
||||||
if self._waze_data.duration is None:
|
if self._waze_data.duration is None:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -318,7 +318,7 @@ class LgWebOSMediaPlayerEntity(MediaPlayerEntity):
|
||||||
return supported
|
return supported
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
if self._client.sound_output is None and self.state == STATE_OFF:
|
if self._client.sound_output is None and self.state == STATE_OFF:
|
||||||
return {}
|
return {}
|
||||||
|
|
|
@ -115,7 +115,7 @@ class WemoHumidifier(WemoSubscriptionEntity, FanEntity):
|
||||||
return "mdi:water-percent"
|
return "mdi:water-percent"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return device specific state attributes."""
|
"""Return device specific state attributes."""
|
||||||
return {
|
return {
|
||||||
ATTR_CURRENT_HUMIDITY: self._current_humidity,
|
ATTR_CURRENT_HUMIDITY: self._current_humidity,
|
||||||
|
|
|
@ -59,7 +59,7 @@ class WemoSwitch(WemoSubscriptionEntity, SwitchEntity):
|
||||||
self._mode_string = None
|
self._mode_string = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
attr = {}
|
attr = {}
|
||||||
if self.maker_params:
|
if self.maker_params:
|
||||||
|
|
|
@ -81,7 +81,7 @@ class WhoisSensor(Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Get the more info attributes."""
|
"""Get the more info attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -778,7 +778,7 @@ class WinkDevice(Entity):
|
||||||
return self.wink.pubnub_channel is None
|
return self.wink.pubnub_channel is None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attributes = {}
|
attributes = {}
|
||||||
battery = self._battery_level
|
battery = self._battery_level
|
||||||
|
@ -855,9 +855,9 @@ class WinkSirenDevice(WinkDevice):
|
||||||
return "mdi:bell-ring"
|
return "mdi:bell-ring"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attributes = super().device_state_attributes
|
attributes = super().extra_state_attributes
|
||||||
|
|
||||||
auto_shutoff = self.wink.auto_shutoff()
|
auto_shutoff = self.wink.auto_shutoff()
|
||||||
if auto_shutoff is not None:
|
if auto_shutoff is not None:
|
||||||
|
@ -913,9 +913,9 @@ class WinkNimbusDialDevice(WinkDevice):
|
||||||
return f"{self.parent.name()} dial {self.wink.index() + 1}"
|
return f"{self.parent.name()} dial {self.wink.index() + 1}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
attributes = super().device_state_attributes
|
attributes = super().extra_state_attributes
|
||||||
dial_attributes = self.dial_attributes()
|
dial_attributes = self.dial_attributes()
|
||||||
|
|
||||||
return {**attributes, **dial_attributes}
|
return {**attributes, **dial_attributes}
|
||||||
|
|
|
@ -70,6 +70,6 @@ class WinkCameraDevice(WinkDevice, alarm.AlarmControlPanelEntity):
|
||||||
self.wink.set_mode("away")
|
self.wink.set_mode("away")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return {"private": self.wink.private()}
|
return {"private": self.wink.private()}
|
||||||
|
|
|
@ -119,18 +119,18 @@ class WinkBinarySensorEntity(WinkDevice, BinarySensorEntity):
|
||||||
return SENSOR_TYPES.get(self.capability)
|
return SENSOR_TYPES.get(self.capability)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
return super().device_state_attributes
|
return super().extra_state_attributes
|
||||||
|
|
||||||
|
|
||||||
class WinkSmokeDetector(WinkBinarySensorEntity):
|
class WinkSmokeDetector(WinkBinarySensorEntity):
|
||||||
"""Representation of a Wink Smoke detector."""
|
"""Representation of a Wink Smoke detector."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
_attributes = super().device_state_attributes
|
_attributes = super().extra_state_attributes
|
||||||
_attributes["test_activated"] = self.wink.test_activated()
|
_attributes["test_activated"] = self.wink.test_activated()
|
||||||
return _attributes
|
return _attributes
|
||||||
|
|
||||||
|
@ -139,9 +139,9 @@ class WinkHub(WinkBinarySensorEntity):
|
||||||
"""Representation of a Wink Hub."""
|
"""Representation of a Wink Hub."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
_attributes = super().device_state_attributes
|
_attributes = super().extra_state_attributes
|
||||||
_attributes["update_needed"] = self.wink.update_needed()
|
_attributes["update_needed"] = self.wink.update_needed()
|
||||||
_attributes["firmware_version"] = self.wink.firmware_version()
|
_attributes["firmware_version"] = self.wink.firmware_version()
|
||||||
_attributes["pairing_mode"] = self.wink.pairing_mode()
|
_attributes["pairing_mode"] = self.wink.pairing_mode()
|
||||||
|
@ -159,9 +159,9 @@ class WinkRemote(WinkBinarySensorEntity):
|
||||||
"""Representation of a Wink Lutron Connected bulb remote."""
|
"""Representation of a Wink Lutron Connected bulb remote."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
_attributes = super().device_state_attributes
|
_attributes = super().extra_state_attributes
|
||||||
_attributes["button_on_pressed"] = self.wink.button_on_pressed()
|
_attributes["button_on_pressed"] = self.wink.button_on_pressed()
|
||||||
_attributes["button_off_pressed"] = self.wink.button_off_pressed()
|
_attributes["button_off_pressed"] = self.wink.button_off_pressed()
|
||||||
_attributes["button_up_pressed"] = self.wink.button_up_pressed()
|
_attributes["button_up_pressed"] = self.wink.button_up_pressed()
|
||||||
|
@ -178,9 +178,9 @@ class WinkButton(WinkBinarySensorEntity):
|
||||||
"""Representation of a Wink Relay button."""
|
"""Representation of a Wink Relay button."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
_attributes = super().device_state_attributes
|
_attributes = super().extra_state_attributes
|
||||||
_attributes["pressed"] = self.wink.pressed()
|
_attributes["pressed"] = self.wink.pressed()
|
||||||
_attributes["long_pressed"] = self.wink.long_pressed()
|
_attributes["long_pressed"] = self.wink.long_pressed()
|
||||||
return _attributes
|
return _attributes
|
||||||
|
|
|
@ -99,7 +99,7 @@ class WinkThermostat(WinkDevice, ClimateEntity):
|
||||||
return TEMP_CELSIUS
|
return TEMP_CELSIUS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the optional device state attributes."""
|
"""Return the optional device state attributes."""
|
||||||
data = {}
|
data = {}
|
||||||
if self.external_temperature is not None:
|
if self.external_temperature is not None:
|
||||||
|
@ -396,7 +396,7 @@ class WinkAC(WinkDevice, ClimateEntity):
|
||||||
return TEMP_CELSIUS
|
return TEMP_CELSIUS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the optional device state attributes."""
|
"""Return the optional device state attributes."""
|
||||||
data = {}
|
data = {}
|
||||||
data[ATTR_TOTAL_CONSUMPTION] = self.wink.total_consumption()
|
data[ATTR_TOTAL_CONSUMPTION] = self.wink.total_consumption()
|
||||||
|
|
|
@ -187,9 +187,9 @@ class WinkLockDevice(WinkDevice, LockEntity):
|
||||||
self.wink.set_alarm_mode(mode)
|
self.wink.set_alarm_mode(mode)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
super_attrs = super().device_state_attributes
|
super_attrs = super().extra_state_attributes
|
||||||
sensitivity = dict_value_to_key(
|
sensitivity = dict_value_to_key(
|
||||||
ALARM_SENSITIVITY_MAP, self.wink.alarm_sensitivity()
|
ALARM_SENSITIVITY_MAP, self.wink.alarm_sensitivity()
|
||||||
)
|
)
|
||||||
|
|
|
@ -83,9 +83,9 @@ class WinkSensorDevice(WinkDevice):
|
||||||
return self._unit_of_measurement
|
return self._unit_of_measurement
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
super_attrs = super().device_state_attributes
|
super_attrs = super().extra_state_attributes
|
||||||
try:
|
try:
|
||||||
super_attrs["egg_times"] = self.wink.eggs()
|
super_attrs["egg_times"] = self.wink.eggs()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
|
@ -48,9 +48,9 @@ class WinkToggleDevice(WinkDevice, ToggleEntity):
|
||||||
self.wink.set_state(False)
|
self.wink.set_state(False)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attributes = super().device_state_attributes
|
attributes = super().extra_state_attributes
|
||||||
try:
|
try:
|
||||||
event = self.wink.last_event()
|
event = self.wink.last_event()
|
||||||
if event is not None:
|
if event is not None:
|
||||||
|
|
|
@ -66,7 +66,7 @@ class WinkWaterHeater(WinkDevice, WaterHeaterEntity):
|
||||||
return TEMP_CELSIUS
|
return TEMP_CELSIUS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the optional device state attributes."""
|
"""Return the optional device state attributes."""
|
||||||
data = {}
|
data = {}
|
||||||
data[ATTR_VACATION_MODE] = self.wink.vacation_mode_enabled()
|
data[ATTR_VACATION_MODE] = self.wink.vacation_mode_enabled()
|
||||||
|
|
|
@ -272,7 +272,7 @@ class WirelessTagBaseSensor(Entity):
|
||||||
self._state = self.updated_state_value()
|
self._state = self.updated_state_value()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return {
|
return {
|
||||||
ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100),
|
ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100),
|
||||||
|
|
|
@ -188,7 +188,7 @@ class WLEDSegmentLight(LightEntity, WLEDDeviceEntity):
|
||||||
return super().available
|
return super().available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Return the state attributes of the entity."""
|
"""Return the state attributes of the entity."""
|
||||||
playlist = self.coordinator.data.state.playlist
|
playlist = self.coordinator.data.state.playlist
|
||||||
if playlist == -1:
|
if playlist == -1:
|
||||||
|
|
|
@ -92,7 +92,7 @@ class WLEDEstimatedCurrentSensor(WLEDSensor):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Return the state attributes of the entity."""
|
"""Return the state attributes of the entity."""
|
||||||
return {
|
return {
|
||||||
ATTR_LED_COUNT: self.coordinator.data.info.leds.count,
|
ATTR_LED_COUNT: self.coordinator.data.info.leds.count,
|
||||||
|
|
|
@ -72,7 +72,7 @@ class WLEDNightlightSwitch(WLEDSwitch):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Return the state attributes of the entity."""
|
"""Return the state attributes of the entity."""
|
||||||
return {
|
return {
|
||||||
ATTR_DURATION: self.coordinator.data.state.nightlight.duration,
|
ATTR_DURATION: self.coordinator.data.state.nightlight.duration,
|
||||||
|
@ -110,7 +110,7 @@ class WLEDSyncSendSwitch(WLEDSwitch):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Return the state attributes of the entity."""
|
"""Return the state attributes of the entity."""
|
||||||
return {ATTR_UDP_PORT: self.coordinator.data.info.udp_port}
|
return {ATTR_UDP_PORT: self.coordinator.data.info.udp_port}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ class WLEDSyncReceiveSwitch(WLEDSwitch):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Return the state attributes of the entity."""
|
"""Return the state attributes of the entity."""
|
||||||
return {ATTR_UDP_PORT: self.coordinator.data.info.udp_port}
|
return {ATTR_UDP_PORT: self.coordinator.data.info.udp_port}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ class WolfLinkSensor(CoordinatorEntity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return {
|
return {
|
||||||
"parameter_id": self.wolf_object.parameter_id,
|
"parameter_id": self.wolf_object.parameter_id,
|
||||||
|
|
|
@ -72,7 +72,7 @@ class WorldTidesInfoSensor(Entity):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of this device."""
|
"""Return the state attributes of this device."""
|
||||||
attr = {ATTR_ATTRIBUTION: ATTRIBUTION}
|
attr = {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ class WashingtonStateTravelTimeSensor(WashingtonStateTransportSensor):
|
||||||
self._state = self._data.get(ATTR_CURRENT_TIME)
|
self._state = self._data.get(ATTR_CURRENT_TIME)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return other details about the sensor state."""
|
"""Return other details about the sensor state."""
|
||||||
if self._data is not None:
|
if self._data is not None:
|
||||||
attrs = {ATTR_ATTRIBUTION: ATTRIBUTION}
|
attrs = {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||||
|
|
|
@ -70,7 +70,7 @@ class WUSensorConfig:
|
||||||
unit_of_measurement: Optional[str] = None,
|
unit_of_measurement: Optional[str] = None,
|
||||||
entity_picture=None,
|
entity_picture=None,
|
||||||
icon: str = "mdi:gauge",
|
icon: str = "mdi:gauge",
|
||||||
device_state_attributes=None,
|
extra_state_attributes=None,
|
||||||
device_class=None,
|
device_class=None,
|
||||||
):
|
):
|
||||||
"""Initialize sensor configuration.
|
"""Initialize sensor configuration.
|
||||||
|
@ -82,7 +82,7 @@ class WUSensorConfig:
|
||||||
:param unit_of_measurement: unit of measurement
|
:param unit_of_measurement: unit of measurement
|
||||||
:param entity_picture: value or callback returning URL of entity picture
|
:param entity_picture: value or callback returning URL of entity picture
|
||||||
:param icon: icon name or URL
|
:param icon: icon name or URL
|
||||||
:param device_state_attributes: dictionary of attributes, or callable that returns it
|
:param extra_state_attributes: dictionary of attributes, or callable that returns it
|
||||||
"""
|
"""
|
||||||
self.friendly_name = friendly_name
|
self.friendly_name = friendly_name
|
||||||
self.unit_of_measurement = unit_of_measurement
|
self.unit_of_measurement = unit_of_measurement
|
||||||
|
@ -90,7 +90,7 @@ class WUSensorConfig:
|
||||||
self.value = value
|
self.value = value
|
||||||
self.entity_picture = entity_picture
|
self.entity_picture = entity_picture
|
||||||
self.icon = icon
|
self.icon = icon
|
||||||
self.device_state_attributes = device_state_attributes or {}
|
self.extra_state_attributes = extra_state_attributes or {}
|
||||||
self.device_class = device_class
|
self.device_class = device_class
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class WUCurrentConditionsSensorConfig(WUSensorConfig):
|
||||||
entity_picture=lambda wu: wu.data["current_observation"]["icon_url"]
|
entity_picture=lambda wu: wu.data["current_observation"]["icon_url"]
|
||||||
if icon is None
|
if icon is None
|
||||||
else None,
|
else None,
|
||||||
device_state_attributes={
|
extra_state_attributes={
|
||||||
"date": lambda wu: wu.data["current_observation"]["observation_time"]
|
"date": lambda wu: wu.data["current_observation"]["observation_time"]
|
||||||
},
|
},
|
||||||
device_class=device_class,
|
device_class=device_class,
|
||||||
|
@ -152,7 +152,7 @@ class WUDailyTextForecastSensorConfig(WUSensorConfig):
|
||||||
"forecastday"
|
"forecastday"
|
||||||
][period]["icon_url"],
|
][period]["icon_url"],
|
||||||
unit_of_measurement=unit_of_measurement,
|
unit_of_measurement=unit_of_measurement,
|
||||||
device_state_attributes={
|
extra_state_attributes={
|
||||||
"date": lambda wu: wu.data["forecast"]["txt_forecast"]["date"]
|
"date": lambda wu: wu.data["forecast"]["txt_forecast"]["date"]
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -201,7 +201,7 @@ class WUDailySimpleForecastSensorConfig(WUSensorConfig):
|
||||||
if not icon
|
if not icon
|
||||||
else None,
|
else None,
|
||||||
icon=icon,
|
icon=icon,
|
||||||
device_state_attributes={
|
extra_state_attributes={
|
||||||
"date": lambda wu: wu.data["forecast"]["simpleforecast"]["forecastday"][
|
"date": lambda wu: wu.data["forecast"]["simpleforecast"]["forecastday"][
|
||||||
period
|
period
|
||||||
]["date"]["pretty"]
|
]["date"]["pretty"]
|
||||||
|
@ -227,7 +227,7 @@ class WUHourlyForecastSensorConfig(WUSensorConfig):
|
||||||
feature="hourly",
|
feature="hourly",
|
||||||
value=lambda wu: wu.data["hourly_forecast"][period][field],
|
value=lambda wu: wu.data["hourly_forecast"][period][field],
|
||||||
entity_picture=lambda wu: wu.data["hourly_forecast"][period]["icon_url"],
|
entity_picture=lambda wu: wu.data["hourly_forecast"][period]["icon_url"],
|
||||||
device_state_attributes={
|
extra_state_attributes={
|
||||||
"temp_c": lambda wu: wu.data["hourly_forecast"][period]["temp"][
|
"temp_c": lambda wu: wu.data["hourly_forecast"][period]["temp"][
|
||||||
"metric"
|
"metric"
|
||||||
],
|
],
|
||||||
|
@ -315,7 +315,7 @@ class WUAlertsSensorConfig(WUSensorConfig):
|
||||||
icon=lambda wu: "mdi:alert-circle-outline"
|
icon=lambda wu: "mdi:alert-circle-outline"
|
||||||
if wu.data["alerts"]
|
if wu.data["alerts"]
|
||||||
else "mdi:check-circle-outline",
|
else "mdi:check-circle-outline",
|
||||||
device_state_attributes=self._get_attributes,
|
extra_state_attributes=self._get_attributes,
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -1157,7 +1157,7 @@ class WUndergroundSensor(Entity):
|
||||||
|
|
||||||
def _update_attrs(self):
|
def _update_attrs(self):
|
||||||
"""Parse and update device state attributes."""
|
"""Parse and update device state attributes."""
|
||||||
attrs = self._cfg_expand("device_state_attributes", {})
|
attrs = self._cfg_expand("extra_state_attributes", {})
|
||||||
|
|
||||||
for (attr, callback) in attrs.items():
|
for (attr, callback) in attrs.items():
|
||||||
if callable(callback):
|
if callable(callback):
|
||||||
|
@ -1185,7 +1185,7 @@ class WUndergroundSensor(Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._attributes
|
return self._attributes
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ class XboxSensor(Entity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attributes = {"gamerscore": self._gamerscore, "tier": self._tier}
|
attributes = {"gamerscore": self._gamerscore, "tier": self._tier}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ class XiaomiDevice(Entity):
|
||||||
self._type = device_type
|
self._type = device_type
|
||||||
self._write_to_hub = xiaomi_hub.write_to_hub
|
self._write_to_hub = xiaomi_hub.write_to_hub
|
||||||
self._get_from_hub = xiaomi_hub.get_from_hub
|
self._get_from_hub = xiaomi_hub.get_from_hub
|
||||||
self._device_state_attributes = {}
|
self._extra_state_attributes = {}
|
||||||
self._remove_unavailability_tracker = None
|
self._remove_unavailability_tracker = None
|
||||||
self._xiaomi_hub = xiaomi_hub
|
self._xiaomi_hub = xiaomi_hub
|
||||||
self.parse_data(device["data"], device["raw_data"])
|
self.parse_data(device["data"], device["raw_data"])
|
||||||
|
@ -319,9 +319,9 @@ class XiaomiDevice(Entity):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
return self._device_state_attributes
|
return self._extra_state_attributes
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_set_unavailable(self, now):
|
def _async_set_unavailable(self, now):
|
||||||
|
@ -364,11 +364,11 @@ class XiaomiDevice(Entity):
|
||||||
max_volt = 3300
|
max_volt = 3300
|
||||||
min_volt = 2800
|
min_volt = 2800
|
||||||
voltage = data[voltage_key]
|
voltage = data[voltage_key]
|
||||||
self._device_state_attributes[ATTR_VOLTAGE] = round(voltage / 1000.0, 2)
|
self._extra_state_attributes[ATTR_VOLTAGE] = round(voltage / 1000.0, 2)
|
||||||
voltage = min(voltage, max_volt)
|
voltage = min(voltage, max_volt)
|
||||||
voltage = max(voltage, min_volt)
|
voltage = max(voltage, min_volt)
|
||||||
percent = ((voltage - min_volt) / (max_volt - min_volt)) * 100
|
percent = ((voltage - min_volt) / (max_volt - min_volt)) * 100
|
||||||
self._device_state_attributes[ATTR_BATTERY_LEVEL] = round(percent, 1)
|
self._extra_state_attributes[ATTR_BATTERY_LEVEL] = round(percent, 1)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def parse_data(self, data, raw_data):
|
def parse_data(self, data, raw_data):
|
||||||
|
|
|
@ -170,10 +170,10 @@ class XiaomiNatgasSensor(XiaomiBinarySensor):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {ATTR_DENSITY: self._density}
|
attrs = {ATTR_DENSITY: self._density}
|
||||||
attrs.update(super().device_state_attributes)
|
attrs.update(super().extra_state_attributes)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def parse_data(self, data, raw_data):
|
def parse_data(self, data, raw_data):
|
||||||
|
@ -214,10 +214,10 @@ class XiaomiMotionSensor(XiaomiBinarySensor):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {ATTR_NO_MOTION_SINCE: self._no_motion_since}
|
attrs = {ATTR_NO_MOTION_SINCE: self._no_motion_since}
|
||||||
attrs.update(super().device_state_attributes)
|
attrs.update(super().extra_state_attributes)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
@ -308,10 +308,10 @@ class XiaomiDoorSensor(XiaomiBinarySensor):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {ATTR_OPEN_SINCE: self._open_since}
|
attrs = {ATTR_OPEN_SINCE: self._open_since}
|
||||||
attrs.update(super().device_state_attributes)
|
attrs.update(super().extra_state_attributes)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def parse_data(self, data, raw_data):
|
def parse_data(self, data, raw_data):
|
||||||
|
@ -389,10 +389,10 @@ class XiaomiSmokeSensor(XiaomiBinarySensor):
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {ATTR_DENSITY: self._density}
|
attrs = {ATTR_DENSITY: self._density}
|
||||||
attrs.update(super().device_state_attributes)
|
attrs.update(super().extra_state_attributes)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def parse_data(self, data, raw_data):
|
def parse_data(self, data, raw_data):
|
||||||
|
@ -424,10 +424,10 @@ class XiaomiVibration(XiaomiBinarySensor):
|
||||||
super().__init__(device, name, xiaomi_hub, data_key, None, config_entry)
|
super().__init__(device, name, xiaomi_hub, data_key, None, config_entry)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {ATTR_LAST_ACTION: self._last_action}
|
attrs = {ATTR_LAST_ACTION: self._last_action}
|
||||||
attrs.update(super().device_state_attributes)
|
attrs.update(super().extra_state_attributes)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def parse_data(self, data, raw_data):
|
def parse_data(self, data, raw_data):
|
||||||
|
@ -459,10 +459,10 @@ class XiaomiButton(XiaomiBinarySensor):
|
||||||
super().__init__(device, name, xiaomi_hub, data_key, None, config_entry)
|
super().__init__(device, name, xiaomi_hub, data_key, None, config_entry)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {ATTR_LAST_ACTION: self._last_action}
|
attrs = {ATTR_LAST_ACTION: self._last_action}
|
||||||
attrs.update(super().device_state_attributes)
|
attrs.update(super().extra_state_attributes)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def parse_data(self, data, raw_data):
|
def parse_data(self, data, raw_data):
|
||||||
|
@ -519,10 +519,10 @@ class XiaomiCube(XiaomiBinarySensor):
|
||||||
super().__init__(device, "Cube", xiaomi_hub, data_key, None, config_entry)
|
super().__init__(device, "Cube", xiaomi_hub, data_key, None, config_entry)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attrs = {ATTR_LAST_ACTION: self._last_action}
|
attrs = {ATTR_LAST_ACTION: self._last_action}
|
||||||
attrs.update(super().device_state_attributes)
|
attrs.update(super().extra_state_attributes)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def parse_data(self, data, raw_data):
|
def parse_data(self, data, raw_data):
|
||||||
|
|
|
@ -50,7 +50,7 @@ class XiaomiAqaraLock(LockEntity, XiaomiDevice):
|
||||||
return self._changed_by
|
return self._changed_by
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self) -> dict:
|
def extra_state_attributes(self) -> dict:
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
attributes = {ATTR_VERIFIED_WRONG_TIMES: self._verified_wrong_times}
|
attributes = {ATTR_VERIFIED_WRONG_TIMES: self._verified_wrong_times}
|
||||||
return attributes
|
return attributes
|
||||||
|
|
|
@ -194,7 +194,7 @@ class XiaomiBatterySensor(XiaomiDevice):
|
||||||
succeed = super().parse_voltage(data)
|
succeed = super().parse_voltage(data)
|
||||||
if not succeed:
|
if not succeed:
|
||||||
return False
|
return False
|
||||||
battery_level = int(self._device_state_attributes.pop(ATTR_BATTERY_LEVEL))
|
battery_level = int(self._extra_state_attributes.pop(ATTR_BATTERY_LEVEL))
|
||||||
if battery_level <= 0 or battery_level > 100:
|
if battery_level <= 0 or battery_level > 100:
|
||||||
return False
|
return False
|
||||||
self._state = battery_level
|
self._state = battery_level
|
||||||
|
|
|
@ -157,7 +157,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchEntity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
if self._supports_power_consumption:
|
if self._supports_power_consumption:
|
||||||
attrs = {
|
attrs = {
|
||||||
|
@ -167,7 +167,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchEntity):
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
attrs = {}
|
attrs = {}
|
||||||
attrs.update(super().device_state_attributes)
|
attrs.update(super().extra_state_attributes)
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -165,7 +165,7 @@ class AirMonitorB1(XiaomiMiioEntity, AirQualityEntity):
|
||||||
return self._humidity
|
return self._humidity
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes."""
|
"""Return the state attributes."""
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,7 @@ class XiaomiGenericDevice(XiaomiMiioEntity, FanEntity):
|
||||||
return self._available
|
return self._available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
return self._state_attrs
|
return self._state_attrs
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,7 @@ class XiaomiPhilipsAbstractLight(XiaomiMiioEntity, LightEntity):
|
||||||
return self._available
|
return self._available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
return self._state_attrs
|
return self._state_attrs
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ class XiaomiAirQualityMonitor(XiaomiMiioEntity):
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
return self._state_attrs
|
return self._state_attrs
|
||||||
|
|
||||||
|
|
|
@ -252,7 +252,7 @@ class XiaomiPlugGenericSwitch(XiaomiMiioEntity, SwitchEntity):
|
||||||
return self._available
|
return self._available
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
"""Return the state attributes of the device."""
|
"""Return the state attributes of the device."""
|
||||||
return self._state_attrs
|
return self._state_attrs
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue