Update integrations j-o to override extra_state_attributes() (#47758)
This commit is contained in:
parent
1095905f8c
commit
14a59d290a
110 changed files with 150 additions and 150 deletions
|
@ -71,7 +71,7 @@ class HMDevice(Entity):
|
|||
return self._available
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific state attributes."""
|
||||
# Static attributes
|
||||
attr = {
|
||||
|
|
|
@ -134,7 +134,7 @@ class ISYNodeEntity(ISYEntity):
|
|||
"""Representation of a ISY Nodebase (Node/Group) entity."""
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> Dict:
|
||||
def extra_state_attributes(self) -> Dict:
|
||||
"""Get the state attributes for the device.
|
||||
|
||||
The 'aux_properties' in the pyisy Node class are combined with the
|
||||
|
@ -186,7 +186,7 @@ class ISYProgramEntity(ISYEntity):
|
|||
self._actions = actions
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> Dict:
|
||||
def extra_state_attributes(self) -> Dict:
|
||||
"""Get the state attributes for the device."""
|
||||
attr = {}
|
||||
if self._actions:
|
||||
|
|
|
@ -111,7 +111,7 @@ class JewishCalendarSensor(Entity):
|
|||
)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
if self._type != "holiday":
|
||||
return {}
|
||||
|
@ -153,7 +153,7 @@ class JewishCalendarTimeSensor(JewishCalendarSensor):
|
|||
return DEVICE_CLASS_TIMESTAMP
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
attrs = {}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class KaiterraAirQuality(AirQualityEntity):
|
|||
return f"{self._device_id}_air_quality"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
data = {}
|
||||
attributes = [
|
||||
|
|
|
@ -71,7 +71,7 @@ class KebaBinarySensor(BinarySensorEntity):
|
|||
return self._is_on
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the binary sensor."""
|
||||
return self._attributes
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class KebaSensor(Entity):
|
|||
return self._unit
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the binary sensor."""
|
||||
return self._attributes
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ class KeeneticTracker(ScannerEntity):
|
|||
return self._router.available
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
if self.is_connected:
|
||||
return {
|
||||
|
|
|
@ -395,7 +395,7 @@ class KefMediaPlayer(MediaPlayerEntity):
|
|||
self._update_dsp_task_remover = None
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the DSP settings of the KEF device."""
|
||||
return self._dsp or {}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class KiraReceiver(Entity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the device."""
|
||||
return {CONF_DEVICE: self._device}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class KiwiLock(LockEntity):
|
|||
return self._state == STATE_LOCKED
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device specific state attributes."""
|
||||
return self._device_attrs
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class KNXBinarySensor(KnxEntity, BinarySensorEntity):
|
|||
return self._device.is_on()
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||
"""Return device specific state attributes."""
|
||||
if self._device.counter is not None:
|
||||
return {ATTR_COUNTER: self._device.counter}
|
||||
|
|
|
@ -138,7 +138,7 @@ class LaCrosseSensor(Entity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
attributes = {
|
||||
"low_battery": self._low_battery,
|
||||
|
|
|
@ -107,7 +107,7 @@ class LastfmSensor(Entity):
|
|||
self._state = f"{now_playing.artist} - {now_playing.title}"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {
|
||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||
|
|
|
@ -76,7 +76,7 @@ class LaunchLibrarySensor(Entity):
|
|||
return "mdi:rocket"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> Optional[dict]:
|
||||
def extra_state_attributes(self) -> Optional[dict]:
|
||||
"""Return attributes for the sensor."""
|
||||
if self.next_launch:
|
||||
return {
|
||||
|
|
|
@ -75,7 +75,7 @@ class LinodeBinarySensor(BinarySensorEntity):
|
|||
return DEVICE_CLASS_MOVING
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the Linode Node."""
|
||||
return self._attrs
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class LinodeSwitch(SwitchEntity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the Linode Node."""
|
||||
return self._attrs
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class LinuxBatterySensor(Entity):
|
|||
return PERCENTAGE
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the sensor."""
|
||||
if self._system == "android":
|
||||
return {
|
||||
|
|
|
@ -85,7 +85,7 @@ class LiteJetLight(LightEntity):
|
|||
return False
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
return {ATTR_NUMBER: self._index}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class LiteJetScene(Scene):
|
|||
return f"{self._entry_id}_{self._index}"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device-specific state attributes."""
|
||||
return {ATTR_NUMBER: self._index}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class LiteJetSwitch(SwitchEntity):
|
|||
return False
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device-specific state attributes."""
|
||||
return {ATTR_NUMBER: self._index}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ class LitterRobotCleaner(LitterRobotEntity, VacuumEntity):
|
|||
raise NotImplementedError()
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific state attributes."""
|
||||
return {
|
||||
"clean_cycle_wait_time_minutes": self.robot.clean_cycle_wait_time_minutes,
|
||||
|
|
|
@ -105,6 +105,6 @@ class LocalFile(Camera):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the camera state attributes."""
|
||||
return {"file_path": self._file_path}
|
||||
|
|
|
@ -125,7 +125,7 @@ class LogiCam(Camera):
|
|||
}
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
state = {
|
||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||
|
|
|
@ -83,7 +83,7 @@ class LogiSensor(Entity):
|
|||
}
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
state = {
|
||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||
|
|
|
@ -124,7 +124,7 @@ class AirSensor(Entity):
|
|||
return self.ICON
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return other details about the sensor state."""
|
||||
attrs = {}
|
||||
attrs["updated"] = self._updated
|
||||
|
|
|
@ -78,7 +78,7 @@ class LondonTubeSensor(Entity):
|
|||
return ICON
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return other details about the sensor state."""
|
||||
self.attrs["Description"] = self._description
|
||||
return self.attrs
|
||||
|
|
|
@ -94,7 +94,7 @@ class LuftdatenSensor(Entity):
|
|||
return None
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
self._attrs[ATTR_ATTRIBUTION] = DEFAULT_ATTRIBUTION
|
||||
|
||||
|
|
|
@ -49,6 +49,6 @@ class LutronOccupancySensor(LutronDevice, BinarySensorEntity):
|
|||
return f"{self._area_name} Occupancy"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {"lutron_integration_id": self._lutron_device.id}
|
||||
|
|
|
@ -64,6 +64,6 @@ class LutronCover(LutronDevice, CoverEntity):
|
|||
_LOGGER.debug("Lutron ID: %d updated to %f", self._lutron_device.id, level)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {"lutron_integration_id": self._lutron_device.id}
|
||||
|
|
|
@ -65,7 +65,7 @@ class LutronLight(LutronDevice, LightEntity):
|
|||
self._lutron_device.level = 0
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {"lutron_integration_id": self._lutron_device.id}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class LutronSwitch(LutronDevice, SwitchEntity):
|
|||
self._lutron_device.level = 0
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {"lutron_integration_id": self._lutron_device.id}
|
||||
|
||||
|
@ -75,7 +75,7 @@ class LutronLed(LutronDevice, SwitchEntity):
|
|||
self._lutron_device.state = 0
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {
|
||||
"keypad": self._keypad_name,
|
||||
|
|
|
@ -349,7 +349,7 @@ class LutronCasetaDevice(Entity):
|
|||
}
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {"device_id": self.device_id, "zone_id": self._device["zone"]}
|
||||
|
||||
|
|
|
@ -69,6 +69,6 @@ class LutronOccupancySensor(LutronCasetaDevice, BinarySensorEntity):
|
|||
return None
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {"device_id": self.device_id}
|
||||
|
|
|
@ -110,7 +110,7 @@ class LyftSensor(Entity):
|
|||
return self._unit_of_measurement
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
params = {
|
||||
"Product ID": self._product["ride_type"],
|
||||
|
|
|
@ -136,7 +136,7 @@ class MagicSeaweedSensor(Entity):
|
|||
return ICON
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return self._attrs
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ class ManualAlarm(alarm.AlarmControlPanelEntity, RestoreEntity):
|
|||
return check
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
if self.state == STATE_ALARM_PENDING or self.state == STATE_ALARM_ARMING:
|
||||
return {
|
||||
|
|
|
@ -415,7 +415,7 @@ class ManualMQTTAlarm(alarm.AlarmControlPanelEntity):
|
|||
return check
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
if self.state != STATE_ALARM_PENDING:
|
||||
return {}
|
||||
|
|
|
@ -286,7 +286,7 @@ class MaxCubeClimate(ClimateEntity):
|
|||
return
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the optional state attributes."""
|
||||
cube = self._cubehandle.cube
|
||||
device = cube.device_by_rf(self._rf_address)
|
||||
|
|
|
@ -138,7 +138,7 @@ class AtaDeviceClimate(MelCloudClimate):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
|
||||
"""Return the optional state attributes with device specific additions."""
|
||||
attr = {}
|
||||
|
||||
|
@ -310,7 +310,7 @@ class AtwDeviceZoneClimate(MelCloudClimate):
|
|||
return f"{self._name} {self._zone.name}"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> Dict[str, Any]:
|
||||
def extra_state_attributes(self) -> Dict[str, Any]:
|
||||
"""Return the optional state attributes with device specific additions."""
|
||||
data = {
|
||||
ATTR_STATUS: ATW_ZONE_HVAC_MODE_LOOKUP.get(
|
||||
|
|
|
@ -72,7 +72,7 @@ class AtwWaterHeater(WaterHeaterEntity):
|
|||
await self._device.set({PROPERTY_POWER: False})
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the optional state attributes with device specific additions."""
|
||||
data = {ATTR_STATUS: self._device.status}
|
||||
return data
|
||||
|
|
|
@ -154,7 +154,7 @@ class MeteoFranceSensor(CoordinatorEntity):
|
|||
return SENSOR_TYPES[self._type][ENTITY_ENABLE]
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
||||
|
@ -177,7 +177,7 @@ class MeteoFranceRainSensor(MeteoFranceSensor):
|
|||
)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
reference_dt = self.coordinator.data.forecast[0]["dt"]
|
||||
return {
|
||||
|
@ -208,7 +208,7 @@ class MeteoFranceAlertSensor(MeteoFranceSensor):
|
|||
)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {
|
||||
**readeable_phenomenoms_dict(self.coordinator.data.phenomenons_max_colors),
|
||||
|
|
|
@ -73,7 +73,7 @@ class MeteoAlertBinarySensor(BinarySensorEntity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION
|
||||
return self._attributes
|
||||
|
|
|
@ -171,7 +171,7 @@ class MetOfficeCurrentSensor(Entity):
|
|||
return SENSOR_TYPES[self._type][1]
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the device."""
|
||||
return {
|
||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||
|
|
|
@ -107,7 +107,7 @@ class MfiSwitch(SwitchEntity):
|
|||
return int(self._port.data.get("active_pwr", 0))
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes for the device."""
|
||||
return {
|
||||
"volts": round(self._port.data.get("v_rms", 0), 1),
|
||||
|
|
|
@ -107,7 +107,7 @@ class MHZ19Sensor(Entity):
|
|||
self._ppm = data.get(SENSOR_CO2)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
result = {}
|
||||
if self._sensor_type == SENSOR_TEMPERATURE and self._ppm is not None:
|
||||
|
|
|
@ -231,7 +231,7 @@ class MicrosoftFaceGroupEntity(Entity):
|
|||
return False
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific state attributes."""
|
||||
attr = {}
|
||||
for name, p_id in self._api.store[self._id].items():
|
||||
|
|
|
@ -189,7 +189,7 @@ class MiFloraSensor(Entity):
|
|||
)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the device."""
|
||||
return {ATTR_LAST_SUCCESSFUL_UPDATE: self.last_successful_update}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class MikrotikHubTracker(ScannerEntity):
|
|||
return self.hub.available
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
if self.is_connected:
|
||||
return {k: v for k, v in self.device.attrs.items() if k not in FILTER_ATTRS}
|
||||
|
|
|
@ -107,7 +107,7 @@ class MillHeater(ClimateEntity):
|
|||
return self._heater.name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
res = {
|
||||
"open_window": self._heater.open_window,
|
||||
|
|
|
@ -188,7 +188,7 @@ class MinMaxSensor(Entity):
|
|||
return False
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the sensor."""
|
||||
return {
|
||||
attr: getattr(self, attr)
|
||||
|
|
|
@ -246,7 +246,7 @@ class MinecraftServerEntity(Entity):
|
|||
"sw_version": self._server.protocol_version,
|
||||
}
|
||||
self._device_class = device_class
|
||||
self._device_state_attributes = None
|
||||
self._extra_state_attributes = None
|
||||
self._disconnect_dispatcher = None
|
||||
|
||||
@property
|
||||
|
|
|
@ -141,19 +141,19 @@ class MinecraftServerPlayersOnlineSensor(MinecraftServerSensorEntity):
|
|||
"""Update online players state and device state attributes."""
|
||||
self._state = self._server.players_online
|
||||
|
||||
device_state_attributes = None
|
||||
extra_state_attributes = None
|
||||
players_list = self._server.players_list
|
||||
|
||||
if players_list is not None:
|
||||
if len(players_list) != 0:
|
||||
device_state_attributes = {ATTR_PLAYERS_LIST: self._server.players_list}
|
||||
extra_state_attributes = {ATTR_PLAYERS_LIST: self._server.players_list}
|
||||
|
||||
self._device_state_attributes = device_state_attributes
|
||||
self._extra_state_attributes = extra_state_attributes
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> Dict[str, Any]:
|
||||
def extra_state_attributes(self) -> Dict[str, Any]:
|
||||
"""Return players list in device state attributes."""
|
||||
return self._device_state_attributes
|
||||
return self._extra_state_attributes
|
||||
|
||||
|
||||
class MinecraftServerPlayersMaxSensor(MinecraftServerSensorEntity):
|
||||
|
|
|
@ -56,7 +56,7 @@ class MobileAppEntity(TrackerEntity, RestoreEntity):
|
|||
return self._data.get(ATTR_BATTERY)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific attributes."""
|
||||
attrs = {}
|
||||
for key in ATTR_KEYS:
|
||||
|
|
|
@ -81,7 +81,7 @@ class MobileAppEntity(RestoreEntity):
|
|||
return self._config.get(ATTR_SENSOR_DEVICE_CLASS)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
return self._config[ATTR_SENSOR_ATTRIBUTES]
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class ModemCalleridSensor(Entity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return self._attributes
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ class MoldIndicator(Entity):
|
|||
return self._available
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
if self._is_metric:
|
||||
return {
|
||||
|
|
|
@ -294,7 +294,7 @@ class MotionTDBUDevice(MotionPositionDevice):
|
|||
return self._blind.position[self._motor_key] == 100
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific state attributes."""
|
||||
attributes = {}
|
||||
if self._blind.position is not None:
|
||||
|
|
|
@ -88,7 +88,7 @@ class MotionBatterySensor(CoordinatorEntity, Entity):
|
|||
return self._blind.battery_level
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific state attributes."""
|
||||
return {ATTR_BATTERY_VOLTAGE: self._blind.battery_voltage}
|
||||
|
||||
|
@ -134,7 +134,7 @@ class MotionTDBUBatterySensor(MotionBatterySensor):
|
|||
return self._blind.battery_level[self._motor[0]]
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific state attributes."""
|
||||
attributes = {}
|
||||
if self._blind.battery_voltage is not None:
|
||||
|
|
|
@ -109,32 +109,32 @@ class MqttDeviceTracker(MqttEntity, TrackerEntity):
|
|||
|
||||
@property
|
||||
def latitude(self):
|
||||
"""Return latitude if provided in device_state_attributes or None."""
|
||||
"""Return latitude if provided in extra_state_attributes or None."""
|
||||
if (
|
||||
self.device_state_attributes is not None
|
||||
and ATTR_LATITUDE in self.device_state_attributes
|
||||
self.extra_state_attributes is not None
|
||||
and ATTR_LATITUDE in self.extra_state_attributes
|
||||
):
|
||||
return self.device_state_attributes[ATTR_LATITUDE]
|
||||
return self.extra_state_attributes[ATTR_LATITUDE]
|
||||
return None
|
||||
|
||||
@property
|
||||
def location_accuracy(self):
|
||||
"""Return location accuracy if provided in device_state_attributes or None."""
|
||||
"""Return location accuracy if provided in extra_state_attributes or None."""
|
||||
if (
|
||||
self.device_state_attributes is not None
|
||||
and ATTR_GPS_ACCURACY in self.device_state_attributes
|
||||
self.extra_state_attributes is not None
|
||||
and ATTR_GPS_ACCURACY in self.extra_state_attributes
|
||||
):
|
||||
return self.device_state_attributes[ATTR_GPS_ACCURACY]
|
||||
return self.extra_state_attributes[ATTR_GPS_ACCURACY]
|
||||
return None
|
||||
|
||||
@property
|
||||
def longitude(self):
|
||||
"""Return longitude if provided in device_state_attributes or None."""
|
||||
"""Return longitude if provided in extra_state_attributes or None."""
|
||||
if (
|
||||
self.device_state_attributes is not None
|
||||
and ATTR_LONGITUDE in self.device_state_attributes
|
||||
self.extra_state_attributes is not None
|
||||
and ATTR_LONGITUDE in self.extra_state_attributes
|
||||
):
|
||||
return self.device_state_attributes[ATTR_LONGITUDE]
|
||||
return self.extra_state_attributes[ATTR_LONGITUDE]
|
||||
return None
|
||||
|
||||
@property
|
||||
|
|
|
@ -229,7 +229,7 @@ class MqttAttributes(Entity):
|
|||
)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return self._attributes
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ class MQTTRoomSensor(Entity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {ATTR_DISTANCE: self._distance}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class MVGLiveSensor(Entity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
dep = self.data.departures
|
||||
if not dep:
|
||||
|
|
|
@ -172,7 +172,7 @@ class EVSensor(Entity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return all the state attributes."""
|
||||
return self._state_attributes
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ class MySensorsDevice:
|
|||
return f"{self.node_name} {self.child_id}"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific state attributes."""
|
||||
node = self.gateway.sensors[self.node_id]
|
||||
child = node.children[self.child_id]
|
||||
|
|
|
@ -72,5 +72,5 @@ class MySensorsDeviceScanner(mysensors.device.MySensorsDevice):
|
|||
host_name=self.name,
|
||||
gps=(latitude, longitude),
|
||||
battery=node.battery_level,
|
||||
attributes=self.device_state_attributes,
|
||||
attributes=self.extra_state_attributes,
|
||||
)
|
||||
|
|
|
@ -86,7 +86,7 @@ class N26Account(Entity):
|
|||
return self._data.balance.get("currency")
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> dict:
|
||||
def extra_state_attributes(self) -> dict:
|
||||
"""Additional attributes of the sensor."""
|
||||
attributes = {
|
||||
ATTR_IBAN: self._data.balance.get("iban"),
|
||||
|
@ -147,7 +147,7 @@ class N26Card(Entity):
|
|||
return self._card["status"]
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> dict:
|
||||
def extra_state_attributes(self) -> dict:
|
||||
"""Additional attributes of the sensor."""
|
||||
attributes = {
|
||||
"apple_pay_eligible": self._card.get("applePayEligible"),
|
||||
|
@ -220,7 +220,7 @@ class N26Space(Entity):
|
|||
return self._space["balance"]["currency"]
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> dict:
|
||||
def extra_state_attributes(self) -> dict:
|
||||
"""Additional attributes of the sensor."""
|
||||
goal_value = ""
|
||||
if "goal" in self._space:
|
||||
|
|
|
@ -126,7 +126,7 @@ class NeatoCleaningMap(Camera):
|
|||
return {"identifiers": {(NEATO_DOMAIN, self._robot_serial)}}
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the vacuum cleaner."""
|
||||
data = {}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ class NeatoConnectedVacuum(StateVacuumEntity):
|
|||
return self._robot_serial
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the vacuum cleaner."""
|
||||
data = {}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class NSDepartureSensor(Entity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
if not self._trips:
|
||||
return
|
||||
|
|
|
@ -48,7 +48,7 @@ class NelloLock(LockEntity):
|
|||
return True
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device specific state attributes."""
|
||||
return self._device_attrs
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ class NetatmoCamera(NetatmoBase, Camera):
|
|||
return response.content
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the Netatmo-specific camera state attributes."""
|
||||
return {
|
||||
"id": self._id,
|
||||
|
|
|
@ -418,7 +418,7 @@ class NetatmoThermostat(NetatmoBase, ClimateEntity):
|
|||
self.async_write_ha_state()
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the thermostat."""
|
||||
attr = {}
|
||||
|
||||
|
|
|
@ -536,7 +536,7 @@ class NetatmoPublicSensor(NetatmoBase):
|
|||
return self._device_class
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the attributes of the device."""
|
||||
attrs = {}
|
||||
|
||||
|
|
|
@ -354,9 +354,9 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity):
|
|||
return self._thermostat.is_emergency_heat_active()
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device specific state attributes."""
|
||||
data = super().device_state_attributes
|
||||
data = super().extra_state_attributes
|
||||
|
||||
data[ATTR_ZONE_STATUS] = self._zone.get_status()
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class NexiaEntity(CoordinatorEntity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device specific state attributes."""
|
||||
return {
|
||||
ATTR_ATTRIBUTION: ATTRIBUTION,
|
||||
|
|
|
@ -41,9 +41,9 @@ class NexiaAutomationScene(NexiaEntity, Scene):
|
|||
self._automation = automation
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the scene specific state attributes."""
|
||||
data = super().device_state_attributes
|
||||
data = super().extra_state_attributes
|
||||
data[ATTR_DESCRIPTION] = self._automation.description
|
||||
return data
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ class NextBusDepartureSensor(Entity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return additional state attributes."""
|
||||
return self._attributes
|
||||
|
||||
|
|
|
@ -115,6 +115,6 @@ class NightscoutSensor(Entity):
|
|||
return switcher.get(self._attributes[ATTR_DIRECTION], "mdi:cloud-question")
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return self._attributes
|
||||
|
|
|
@ -175,7 +175,7 @@ class NiluSensor(AirQualityEntity):
|
|||
return ATTRIBUTION
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> dict:
|
||||
def extra_state_attributes(self) -> dict:
|
||||
"""Return other details about the sensor state."""
|
||||
return self._attrs
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ class LeafEntity(Entity):
|
|||
)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return default attributes for Nissan leaf entities."""
|
||||
return {
|
||||
"next_update": self.car.next_update,
|
||||
|
|
|
@ -37,9 +37,9 @@ class LeafClimateSwitch(LeafEntity, ToggleEntity):
|
|||
)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return climate control attributes."""
|
||||
attrs = super().device_state_attributes
|
||||
attrs = super().extra_state_attributes
|
||||
attrs["updated_on"] = self.car.last_climate_response
|
||||
return attrs
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ class NMBSLiveBoard(Entity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the sensor attributes if data is available."""
|
||||
if self._state is None or not self._attrs:
|
||||
return None
|
||||
|
@ -202,7 +202,7 @@ class NMBSSensor(Entity):
|
|||
return "mdi:train"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return sensor attributes if data is available."""
|
||||
if self._state is None or not self._attrs:
|
||||
return None
|
||||
|
|
|
@ -90,7 +90,7 @@ class NOAATidesAndCurrentsSensor(Entity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of this device."""
|
||||
attr = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION}
|
||||
if self.data is None:
|
||||
|
|
|
@ -80,7 +80,7 @@ class AirSensor(AirQualityEntity):
|
|||
return ATTRIBUTION
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> dict:
|
||||
def extra_state_attributes(self) -> dict:
|
||||
"""Return other details about the sensor state."""
|
||||
return {
|
||||
"level": self._api.data.get("level"),
|
||||
|
|
|
@ -180,7 +180,7 @@ class NotionEntity(CoordinatorEntity):
|
|||
return self._device_class
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> dict:
|
||||
def extra_state_attributes(self) -> dict:
|
||||
"""Return the state attributes."""
|
||||
return self._attrs
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ class StationPriceSensor(Entity):
|
|||
return None
|
||||
|
||||
@property
|
||||
def device_state_attributes(self) -> dict:
|
||||
def extra_state_attributes(self) -> dict:
|
||||
"""Return the state attributes of the device."""
|
||||
return {
|
||||
ATTR_STATION_ID: self._station_data.station_id,
|
||||
|
|
|
@ -284,7 +284,7 @@ class NswRuralFireServiceLocationEvent(GeolocationEvent):
|
|||
return LENGTH_KILOMETERS
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
attributes = {}
|
||||
for key, value in (
|
||||
|
|
|
@ -99,7 +99,7 @@ class NukiDeviceEntity(LockEntity, ABC):
|
|||
"""Return true if lock is locked."""
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device specific state attributes."""
|
||||
data = {
|
||||
ATTR_BATTERY_CRITICAL: self._nuki_device.battery_critical,
|
||||
|
|
|
@ -160,7 +160,7 @@ class NUTSensor(CoordinatorEntity):
|
|||
return self._unit
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the sensor attributes."""
|
||||
return {ATTR_STATE: _format_display_state(self._data.status)}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class NX584ZoneSensor(BinarySensorEntity):
|
|||
return self._zone["state"]
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {"zone_number": self._zone["number"]}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class OASATelematicsSensor(Entity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
params = {}
|
||||
if self._times is not None:
|
||||
|
|
|
@ -56,7 +56,7 @@ class OhmconnectSensor(Entity):
|
|||
return "Inactive"
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {"Address": self._data.get("address"), "ID": self._ohmid}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class OmniLogicEntity(CoordinatorEntity):
|
|||
return self._icon
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the attributes."""
|
||||
return self._attrs
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class OneWireBaseEntity(Entity):
|
|||
return self._unit_of_measurement
|
||||
|
||||
@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 {"device_file": self._device_file, "raw_value": self._value_raw}
|
||||
|
||||
|
|
|
@ -392,7 +392,7 @@ class OnkyoDevice(MediaPlayerEntity):
|
|||
return self._source_list
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return device specific state attributes."""
|
||||
return self._attributes
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class OpenexchangeratesSensor(Entity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return other attributes of the sensor."""
|
||||
attr = self.rest.data
|
||||
attr[ATTR_ATTRIBUTION] = ATTRIBUTION
|
||||
|
|
|
@ -92,7 +92,7 @@ class OpenGarageCover(CoverEntity):
|
|||
self._open_garage = open_garage
|
||||
self._state = None
|
||||
self._state_before_move = None
|
||||
self._device_state_attributes = {}
|
||||
self._extra_state_attributes = {}
|
||||
self._available = True
|
||||
self._device_id = device_id
|
||||
|
||||
|
@ -107,9 +107,9 @@ class OpenGarageCover(CoverEntity):
|
|||
return self._available
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the device state attributes."""
|
||||
return self._device_state_attributes
|
||||
return self._extra_state_attributes
|
||||
|
||||
@property
|
||||
def is_closed(self):
|
||||
|
@ -154,11 +154,11 @@ class OpenGarageCover(CoverEntity):
|
|||
|
||||
_LOGGER.debug("%s status: %s", self._name, self._state)
|
||||
if status.get("rssi") is not None:
|
||||
self._device_state_attributes[ATTR_SIGNAL_STRENGTH] = status.get("rssi")
|
||||
self._extra_state_attributes[ATTR_SIGNAL_STRENGTH] = status.get("rssi")
|
||||
if status.get("dist") is not None:
|
||||
self._device_state_attributes[ATTR_DISTANCE_SENSOR] = status.get("dist")
|
||||
self._extra_state_attributes[ATTR_DISTANCE_SENSOR] = status.get("dist")
|
||||
if self._state is not None:
|
||||
self._device_state_attributes[ATTR_DOOR_STATE] = self._state
|
||||
self._extra_state_attributes[ATTR_DOOR_STATE] = self._state
|
||||
|
||||
self._available = True
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ class OpenSkySensor(Entity):
|
|||
self._previously_tracked = currently_tracked
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {ATTR_ATTRIBUTION: OPENSKY_ATTRIBUTION}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ class OpenUvEntity(Entity):
|
|||
return self._available
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return self._attrs
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class AbstractOpenWeatherMapSensor(Entity):
|
|||
return self._unit_of_measurement
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue