1
mirror of https://github.com/home-assistant/core synced 2024-07-27 18:58:57 +02:00

Update integrations a-e to override extra_state_attributes() (#47756)

This commit is contained in:
Erik Montnemery 2021-03-11 16:51:03 +01:00 committed by GitHub
parent f92b75cbb2
commit 6c084ae6ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
106 changed files with 130 additions and 130 deletions

View File

@ -363,7 +363,7 @@ class AbodeDevice(AbodeEntity):
return self._device.name return self._device.name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,
@ -411,7 +411,7 @@ class AbodeAutomation(AbodeEntity):
return self._automation.name return self._automation.name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION, "type": "CUE automation"} return {ATTR_ATTRIBUTION: ATTRIBUTION, "type": "CUE automation"}

View File

@ -69,7 +69,7 @@ class AbodeAlarm(AbodeDevice, alarm.AlarmControlPanelEntity):
self._device.set_away() self._device.set_away()
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View File

@ -141,7 +141,7 @@ class AccuWeatherSensor(CoordinatorEntity):
return SENSOR_TYPES[self.kind][self._unit_system] return SENSOR_TYPES[self.kind][self._unit_system]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self.forecast_day is not None: if self.forecast_day is not None:
if self.kind in ["WindDay", "WindNight", "WindGustDay", "WindGustNight"]: if self.kind in ["WindDay", "WindNight", "WindGustDay", "WindGustNight"]:

View File

@ -52,6 +52,6 @@ class AbstractAemetSensor(CoordinatorEntity):
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."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -134,7 +134,7 @@ class AfterShipSensor(Entity):
return "packages" return "packages"
@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

View File

@ -108,7 +108,7 @@ class AgentCamera(MjpegCamera):
self._removed = True self._removed = True
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the Agent DVR camera state attributes.""" """Return the Agent DVR camera state attributes."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View File

@ -117,7 +117,7 @@ class AirlyAirQuality(CoordinatorEntity, AirQualityEntity):
} }
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attrs = { attrs = {
LABEL_AQI_DESCRIPTION: self.coordinator.data[ATTR_API_CAQI_DESCRIPTION], LABEL_AQI_DESCRIPTION: self.coordinator.data[ATTR_API_CAQI_DESCRIPTION],

View File

@ -102,7 +102,7 @@ class AirlySensor(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 self._attrs return self._attrs

View File

@ -84,7 +84,7 @@ class AirNowSensor(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."""
if self.kind == ATTR_API_AQI: if self.kind == ATTR_API_AQI:
self._attrs[SENSOR_AQI_ATTR_DESCR] = self.coordinator.data[ self._attrs[SENSOR_AQI_ATTR_DESCR] = self.coordinator.data[

View File

@ -372,7 +372,7 @@ class AirVisualEntity(CoordinatorEntity):
self._unit = None self._unit = 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

View File

@ -163,7 +163,7 @@ class AlarmDecoderAlarmPanel(AlarmControlPanelEntity):
return self._code_arm_required return self._code_arm_required
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
"ac_power": self._ac_power, "ac_power": self._ac_power,

View File

@ -118,7 +118,7 @@ class AlarmDecoderBinarySensor(BinarySensorEntity):
return False return False
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attr = {CONF_ZONE_NUMBER: self._zone_number} attr = {CONF_ZONE_NUMBER: self._zone_number}
if self._rfid and self._rfstate is not None: if self._rfid and self._rfstate is not None:

View File

@ -133,7 +133,7 @@ class AlphaVantageSensor(Entity):
return self.values["1. open"] return self.values["1. open"]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self.values is not None: if self.values is not None:
return { return {
@ -193,7 +193,7 @@ class AlphaVantageForeignExchange(Entity):
return self._icon return self._icon
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self.values is not None: if self.values is not None:
return { return {

View File

@ -266,7 +266,7 @@ class AmcrestCam(Camera):
return self._name return self._name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the Amcrest-specific camera state attributes.""" """Return the Amcrest-specific camera state attributes."""
attr = {} attr = {}
if self._audio_enabled is not None: if self._audio_enabled is not None:

View File

@ -66,7 +66,7 @@ class AmcrestSensor(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._attrs return self._attrs

View File

@ -321,7 +321,7 @@ class AndroidIPCamEntity(Entity):
return self._ipcam.available return self._ipcam.available
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
state_attr = {ATTR_HOST: self._host} state_attr = {ATTR_HOST: self._host}
if self._ipcam.status_data is None: if self._ipcam.status_data is None:

View File

@ -469,7 +469,7 @@ class ADBDevice(MediaPlayerEntity):
return self._available return self._available
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Provide the last ADB command's response and the device's HDMI input as attributes.""" """Provide the last ADB command's response and the device's HDMI input as attributes."""
return { return {
"adb_response": self._adb_response, "adb_response": self._adb_response,

View File

@ -136,7 +136,7 @@ class ArloBaseStation(AlarmControlPanelEntity):
return self._base_station.name return self._base_station.name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View File

@ -108,7 +108,7 @@ class ArloCam(Camera):
return self._name return self._name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
name: value name: value

View File

@ -183,7 +183,7 @@ class ArloSensor(Entity):
self._state = None self._state = None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
attrs = {} attrs = {}

View File

@ -103,7 +103,7 @@ class AsusWrtDevice(ScannerEntity):
return self._icon return self._icon
@property @property
def device_state_attributes(self) -> Dict[str, any]: def extra_state_attributes(self) -> Dict[str, any]:
"""Return the attributes.""" """Return the attributes."""
return self._attrs return self._attrs

View File

@ -159,7 +159,7 @@ class AsusWrtSensor(CoordinatorEntity):
return self._device_class return self._device_class
@property @property
def device_state_attributes(self) -> Dict[str, any]: def extra_state_attributes(self) -> Dict[str, any]:
"""Return the attributes.""" """Return the attributes."""
return {"hostname": self._router.host} return {"hostname": self._router.host}

View File

@ -243,7 +243,7 @@ class AtomeSensor(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

View File

@ -105,7 +105,7 @@ class AugustLock(AugustEntityMixin, RestoreEntity, LockEntity):
return self._changed_by return self._changed_by
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device specific state attributes.""" """Return the device specific state attributes."""
attributes = {ATTR_BATTERY_LEVEL: self._detail.battery_level} attributes = {ATTR_BATTERY_LEVEL: self._detail.battery_level}

View File

@ -166,7 +166,7 @@ class AugustOperatorSensor(AugustEntityMixin, RestoreEntity, Entity):
self._entity_picture = lock_activity.operator_thumbnail_url self._entity_picture = lock_activity.operator_thumbnail_url
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device specific state attributes.""" """Return the device specific state attributes."""
attributes = {} attributes = {}

View File

@ -168,7 +168,7 @@ class AuroraEntity(CoordinatorEntity):
return self._name return self._name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {"attribution": ATTRIBUTION} return {"attribution": ATTRIBUTION}

View File

@ -535,7 +535,7 @@ class AutomationEntity(ToggleEntity, RestoreEntity):
) )
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return automation attributes.""" """Return automation attributes."""
if self._id is None: if self._id is None:
return None return None

View File

@ -179,7 +179,7 @@ class AwairSensor(CoordinatorEntity):
return SENSOR_TYPES[self._kind][ATTR_UNIT] return SENSOR_TYPES[self._kind][ATTR_UNIT]
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the Awair Index alongside state attributes. """Return the Awair Index alongside state attributes.
The Awair Index is a subjective score ranging from 0-4 (inclusive) that The Awair Index is a subjective score ranging from 0-4 (inclusive) that

View File

@ -92,7 +92,7 @@ class AzureDevOpsSensor(AzureDevOpsDeviceEntity):
return self._state return self._state
@property @property
def device_state_attributes(self) -> object: def extra_state_attributes(self) -> object:
"""Return the attributes of the sensor.""" """Return the attributes of the sensor."""
return self._attributes return self._attributes

View File

@ -384,7 +384,7 @@ class BayesianBinarySensor(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."""
attr_observations_list = [ attr_observations_list = [

View File

@ -115,7 +115,7 @@ class BboxUptimeSensor(Entity):
return self._icon return self._icon
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}
@ -167,7 +167,7 @@ class BboxSensor(Entity):
return self._icon return self._icon
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -110,7 +110,7 @@ class BitcoinSensor(Entity):
return ICON return ICON
@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 {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -62,7 +62,7 @@ class BlinkSyncModule(AlarmControlPanelEntity):
return f"{DOMAIN} {self._name}" return f"{DOMAIN} {self._name}"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attr = self.sync.attributes attr = self.sync.attributes
attr["network_info"] = self.data.networks attr["network_info"] = self.data.networks

View File

@ -60,7 +60,7 @@ class BlinkCamera(Camera):
return self._unique_id return self._unique_id
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the camera attributes.""" """Return the camera attributes."""
return self._camera.attributes return self._camera.attributes

View File

@ -75,7 +75,7 @@ class BlockchainSensor(Entity):
return ICON return ICON
@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 {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -850,7 +850,7 @@ class BluesoundPlayer(MediaPlayerEntity):
_LOGGER.error("Master not found %s", master_device) _LOGGER.error("Master not found %s", master_device)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""List members in group.""" """List members in group."""
attributes = {} attributes = {}
if self._group_list: if self._group_list:

View File

@ -334,7 +334,7 @@ class BMWConnectedDriveBaseEntity(Entity):
} }
@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 self._attrs return self._attrs

View File

@ -109,7 +109,7 @@ class BMWConnectedDriveSensor(BMWConnectedDriveBaseEntity, BinarySensorEntity):
return self._state return self._state
@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."""
vehicle_state = self._vehicle.state vehicle_state = self._vehicle.state
result = self._attrs.copy() result = self._attrs.copy()

View File

@ -52,7 +52,7 @@ class BMWLock(BMWConnectedDriveBaseEntity, LockEntity):
return self._name return self._name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the lock.""" """Return the state attributes of the lock."""
vehicle_state = self._vehicle.state vehicle_state = self._vehicle.state
result = self._attrs.copy() result = self._attrs.copy()

View File

@ -88,7 +88,7 @@ class BrotherPrinterSensor(CoordinatorEntity):
return None return None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
remaining_pages = None remaining_pages = None
drum_counter = None drum_counter = None

View File

@ -99,7 +99,7 @@ class BrottsplatskartanSensor(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

View File

@ -131,7 +131,7 @@ class BruntDevice(CoverEntity):
return self.move_state == 2 return self.move_state == 2
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the detailed device state attributes.""" """Return the detailed device state attributes."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View File

@ -430,7 +430,7 @@ class BrSensor(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."""
if self.type.startswith(PRECIPITATION_FORECAST): if self.type.startswith(PRECIPITATION_FORECAST):
result = {ATTR_ATTRIBUTION: self._attribution} result = {ATTR_ATTRIBUTION: self._attribution}

View File

@ -123,7 +123,7 @@ class WebDavCalendarEventDevice(CalendarEventDevice):
self._offset_reached = False self._offset_reached = False
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
return {"offset_reached": self._offset_reached} return {"offset_reached": self._offset_reached}

View File

@ -87,7 +87,7 @@ class CanaryAlarm(CoordinatorEntity, 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.""" """Return the state attributes."""
return {"private": self.location.is_private} return {"private": self.location.is_private}

View File

@ -163,7 +163,7 @@ class CanarySensor(CoordinatorEntity, Entity):
return self._sensor_type[2] return self._sensor_type[2]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
reading = self.reading reading = self.reading

View File

@ -68,7 +68,7 @@ class CertExpiryEntity(CoordinatorEntity):
return "mdi:certificate" return "mdi:certificate"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return additional sensor state attributes.""" """Return additional sensor state attributes."""
return { return {
"is_valid": self.coordinator.is_cert_valid, "is_valid": self.coordinator.is_cert_valid,

View File

@ -286,7 +286,7 @@ class CityBikesStation(Entity):
break break
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._station_data: if self._station_data:
return { return {

View File

@ -91,7 +91,7 @@ class CO2Sensor(Entity):
return CO2_INTENSITY_UNIT return CO2_INTENSITY_UNIT
@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 {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -71,7 +71,7 @@ class AccountSensor(Entity):
return CURRENCY_ICONS.get(self._unit_of_measurement, DEFAULT_COIN_ICON) return CURRENCY_ICONS.get(self._unit_of_measurement, DEFAULT_COIN_ICON)
@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_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,
@ -120,7 +120,7 @@ class ExchangeRateSensor(Entity):
return CURRENCY_ICONS.get(self.currency, DEFAULT_COIN_ICON) return CURRENCY_ICONS.get(self.currency, DEFAULT_COIN_ICON)
@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 {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -97,7 +97,7 @@ class ComedHourlyPricingSensor(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.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -95,7 +95,7 @@ class CommandSensor(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

View File

@ -73,6 +73,6 @@ class CoronavirusSensor(CoordinatorEntity):
return "people" return "people"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device attributes.""" """Return device attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -54,7 +54,7 @@ class CpuSpeedSensor(Entity):
return FREQUENCY_GIGAHERTZ return FREQUENCY_GIGAHERTZ
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self.info is not None: if self.info is not None:
attrs = { attrs = {

View File

@ -131,7 +131,7 @@ class CupsSensor(Entity):
return ICON_PRINTER return ICON_PRINTER
@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._printer is None: if self._printer is None:
return None return None
@ -193,7 +193,7 @@ class IPPSensor(Entity):
return PRINTER_STATES.get(key, key) return PRINTER_STATES.get(key, key)
@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._attributes is None: if self._attributes is None:
return None return None
@ -271,7 +271,7 @@ class MarkerSensor(Entity):
return PERCENTAGE return PERCENTAGE
@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._attributes is None: if self._attributes is None:
return None return None

View File

@ -86,7 +86,7 @@ class CurrencylayerSensor(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 sensor.""" """Return the state attributes of the sensor."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

@ -620,7 +620,7 @@ class DarkSkySensor(Entity):
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 {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}
@ -739,7 +739,7 @@ class DarkSkyAlertSensor(Entity):
return "mdi:alert-circle-outline" return "mdi:alert-circle-outline"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._alerts return self._alerts

View File

@ -92,7 +92,7 @@ class DeconzBinarySensor(DeconzDevice, BinarySensorEntity):
return DEVICE_CLASS.get(type(self._device)) return DEVICE_CLASS.get(type(self._device))
@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."""
attr = {} attr = {}

View File

@ -244,7 +244,7 @@ class DeconzThermostat(DeconzDevice, ClimateEntity):
return TEMP_CELSIUS return TEMP_CELSIUS
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the thermostat.""" """Return the state attributes of the thermostat."""
attr = {} attr = {}

View File

@ -223,7 +223,7 @@ class DeconzBaseLight(DeconzDevice, LightEntity):
await self._device.async_set_state(data) await self._device.async_set_state(data)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
return {"is_deconz_group": self._device.type == "LightGroup"} return {"is_deconz_group": self._device.type == "LightGroup"}
@ -275,9 +275,9 @@ class DeconzGroup(DeconzBaseLight):
} }
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
attributes = dict(super().device_state_attributes) attributes = dict(super().extra_state_attributes)
attributes["all_on"] = self._device.all_on attributes["all_on"] = self._device.all_on
return attributes return attributes

View File

@ -155,7 +155,7 @@ class DeconzSensor(DeconzDevice):
return UNIT_OF_MEASUREMENT.get(type(self._device)) return UNIT_OF_MEASUREMENT.get(type(self._device))
@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."""
attr = {} attr = {}
@ -235,7 +235,7 @@ class DeconzBattery(DeconzDevice):
return PERCENTAGE return PERCENTAGE
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the battery.""" """Return the state attributes of the battery."""
attr = {} attr = {}

View File

@ -126,6 +126,6 @@ class DeLijnPublicTransportSensor(Entity):
return "mdi:bus" return "mdi:bus"
@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

View File

@ -49,7 +49,7 @@ class DemoRemote(RemoteEntity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device state attributes.""" """Return device state attributes."""
if self._last_command_sent is not None: if self._last_command_sent is not None:
return {"last_command_sent": self._last_command_sent} return {"last_command_sent": self._last_command_sent}

View File

@ -96,7 +96,7 @@ class DemoSensor(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.""" """Return the state attributes."""
if self._battery: if self._battery:
return {ATTR_BATTERY_LEVEL: self._battery} return {ATTR_BATTERY_LEVEL: self._battery}

View File

@ -140,7 +140,7 @@ class DemoVacuum(VacuumEntity):
return max(0, min(100, self._battery_level)) return max(0, min(100, self._battery_level))
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device state attributes.""" """Return device state attributes."""
return {ATTR_CLEANED_AREA: round(self._cleaned_area, 2)} return {ATTR_CLEANED_AREA: round(self._cleaned_area, 2)}
@ -288,7 +288,7 @@ class StateDemoVacuum(StateVacuumEntity):
return FAN_SPEEDS return FAN_SPEEDS
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device state attributes.""" """Return device state attributes."""
return {ATTR_CLEANED_AREA: round(self._cleaned_area, 2)} return {ATTR_CLEANED_AREA: round(self._cleaned_area, 2)}

View File

@ -306,7 +306,7 @@ class DenonDevice(MediaPlayerEntity):
return None return None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific state attributes.""" """Return device specific state attributes."""
if ( if (
self._sound_mode_raw is not None self._sound_mode_raw is not None

View File

@ -211,7 +211,7 @@ class DerivativeSensor(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."""
return {ATTR_SOURCE_ID: self._sensor_source_id} return {ATTR_SOURCE_ID: self._sensor_source_id}

View File

@ -65,7 +65,7 @@ class DeutscheBahnSensor(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."""
connections = self.data.connections[0] connections = self.data.connections[0]
if len(self.data.connections) > 1: if len(self.data.connections) > 1:

View File

@ -675,7 +675,7 @@ class Device(RestoreEntity):
return attributes return attributes
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device state attributes.""" """Return device state attributes."""
return self._attributes return self._attributes

View File

@ -79,7 +79,7 @@ class DigitalOceanBinarySensor(BinarySensorEntity):
return DEVICE_CLASS_MOVING return DEVICE_CLASS_MOVING
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the Digital Ocean droplet.""" """Return the state attributes of the Digital Ocean droplet."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View File

@ -71,7 +71,7 @@ class DigitalOceanSwitch(SwitchEntity):
return self.data.status == "active" return self.data.status == "active"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the Digital Ocean droplet.""" """Return the state attributes of the Digital Ocean droplet."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View File

@ -124,7 +124,7 @@ class DIRECTVMediaPlayer(DIRECTVEntity, MediaPlayerEntity):
self._assumed_state = self._is_recorded self._assumed_state = self._is_recorded
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific state attributes.""" """Return device specific state attributes."""
if self._is_standby: if self._is_standby:
return {} return {}

View File

@ -121,7 +121,7 @@ class DiscogsSensor(Entity):
return SENSORS[self._type]["unit_of_measurement"] return SENSORS[self._type]["unit_of_measurement"]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes of the sensor.""" """Return the device state attributes of the sensor."""
if self._state is None or self._attrs is None: if self._state is None or self._attrs is None:
return None return None

View File

@ -71,7 +71,7 @@ class SmartPlugSwitch(SwitchEntity):
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."""
try: try:
ui_temp = self.units.temperature(int(self.data.temperature), TEMP_CELSIUS) ui_temp = self.units.temperature(int(self.data.temperature), TEMP_CELSIUS)

View File

@ -221,7 +221,7 @@ class Doods(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,

View File

@ -105,6 +105,6 @@ class DovadoSensor(Entity):
return SENSORS[self._sensor][2] return SENSORS[self._sensor][2]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {k: v for k, v in self._data.state.items() if k not in ["date", "time"]} return {k: v for k, v in self._data.state.items() if k not in ["date", "time"]}

View File

@ -87,7 +87,7 @@ class DublinPublicTransportSensor(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:
next_up = "None" next_up = "None"

View File

@ -119,7 +119,7 @@ class DwdWeatherWarningsSensor(Entity):
return self._api.api.expected_warning_level return self._api.api.expected_warning_level
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the DWD-Weather-Warnings.""" """Return the state attributes of the DWD-Weather-Warnings."""
data = { data = {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View File

@ -88,6 +88,6 @@ class DysonAirSensor(DysonEntity, AirQualityEntity):
return int(self._device.environmental_state.volatile_organic_compounds) return int(self._device.environmental_state.volatile_organic_compounds)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
return {ATTR_VOC: self.volatile_organic_compounds} return {ATTR_VOC: self.volatile_organic_compounds}

View File

@ -200,7 +200,7 @@ class DysonFanEntity(DysonEntity, FanEntity):
return SUPPORT_OSCILLATE | SUPPORT_SET_SPEED return SUPPORT_OSCILLATE | SUPPORT_SET_SPEED
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return optional state attributes.""" """Return optional state attributes."""
return { return {
ATTR_NIGHT_MODE: self.night_mode, ATTR_NIGHT_MODE: self.night_mode,
@ -455,10 +455,10 @@ class DysonPureCoolEntity(DysonFanEntity):
return int(self._device.state.carbon_filter_state) return int(self._device.state.carbon_filter_state)
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return optional state attributes.""" """Return optional state attributes."""
return { return {
**super().device_state_attributes, **super().extra_state_attributes,
ATTR_ANGLE_LOW: self.angle_low, ATTR_ANGLE_LOW: self.angle_low,
ATTR_ANGLE_HIGH: self.angle_high, ATTR_ANGLE_HIGH: self.angle_high,
ATTR_FLOW_DIRECTION_FRONT: self.flow_direction_front, ATTR_FLOW_DIRECTION_FRONT: self.flow_direction_front,

View File

@ -95,7 +95,7 @@ class Dyson360EyeDevice(DysonEntity, VacuumEntity):
return ["Quiet", "Max"] return ["Quiet", "Max"]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the specific state attributes of this vacuum cleaner.""" """Return the specific state attributes of this vacuum cleaner."""
return {ATTR_POSITION: str(self._device.state.position)} return {ATTR_POSITION: str(self._device.state.position)}

View File

@ -156,7 +156,7 @@ class Measurement(CoordinatorEntity):
return UNIT_MAPPING.get(measure["unit"], measure["unitName"]) return UNIT_MAPPING.get(measure["unit"], measure["unitName"])
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the sensor specific state attributes.""" """Return the sensor specific state attributes."""
return {ATTR_ATTRIBUTION: self.attribution} return {ATTR_ATTRIBUTION: self.attribution}

View File

@ -55,7 +55,7 @@ class EbusdSensor(Entity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
if self._type == 1 and self._state is not None: if self._type == 1 and self._state is not None:
schedule = { schedule = {

View File

@ -519,7 +519,7 @@ class Thermostat(ClimateEntity):
return CURRENT_HVAC_IDLE return CURRENT_HVAC_IDLE
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific state attributes.""" """Return device specific state attributes."""
status = self.thermostat["equipmentStatus"] status = self.thermostat["equipmentStatus"]
return { return {

View File

@ -189,7 +189,7 @@ class EcovacsVacuum(VacuumEntity):
self.device.run(sucks.VacBotCommand(command, params)) self.device.run(sucks.VacBotCommand(command, params))
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device-specific state attributes of this vacuum.""" """Return the device-specific state attributes of this vacuum."""
data = {} data = {}
data[ATTR_ERROR] = self._error data[ATTR_ERROR] = self._error

View File

@ -269,7 +269,7 @@ class EDL21Entity(Entity):
return self._telegram.get("value") return self._telegram.get("value")
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Enumerate supported attributes.""" """Enumerate supported attributes."""
return { return {
self._state_attrs[k]: v self._state_attrs[k]: v

View File

@ -110,7 +110,7 @@ class EightHeatSensor(EightSleepHeatEntity):
self._state = self._usrobj.heating_level self._state = self._usrobj.heating_level
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device state attributes.""" """Return device state attributes."""
return { return {
ATTR_TARGET_HEAT: self._usrobj.target_heating_level, ATTR_TARGET_HEAT: self._usrobj.target_heating_level,
@ -202,7 +202,7 @@ class EightUserSensor(EightSleepUserEntity):
self._state = self._usrobj.current_values["stage"] self._state = self._usrobj.current_values["stage"]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device state attributes.""" """Return device state attributes."""
if self._attr is None: if self._attr is None:
# Skip attributes if sensor type doesn't support # Skip attributes if sensor type doesn't support

View File

@ -429,7 +429,7 @@ class ElkEntity(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(), **self.initial_attrs()} return {**self._element.as_dict(), **self.initial_attrs()}

View File

@ -173,7 +173,7 @@ class ElkArea(ElkAttachedEntity, AlarmControlPanelEntity, RestoreEntity):
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):
"""Attributes of the area.""" """Attributes of the area."""
attrs = self.initial_attrs() attrs = self.initial_attrs()
elmt = self._element elmt = self._element

View File

@ -136,7 +136,7 @@ class ElkKeypad(ElkSensor):
return "mdi:thermometer-lines" return "mdi:thermometer-lines"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Attributes of the sensor.""" """Attributes of the sensor."""
attrs = self.initial_attrs() attrs = self.initial_attrs()
attrs["area"] = self._element.area + 1 attrs["area"] = self._element.area + 1
@ -163,7 +163,7 @@ class ElkPanel(ElkSensor):
return "mdi:home" return "mdi:home"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Attributes of the sensor.""" """Attributes of the sensor."""
attrs = self.initial_attrs() attrs = self.initial_attrs()
attrs["system_trouble_status"] = self._element.system_trouble_status attrs["system_trouble_status"] = self._element.system_trouble_status
@ -190,7 +190,7 @@ class ElkSetting(ElkSensor):
self._state = self._element.value self._state = self._element.value
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Attributes of the sensor.""" """Attributes of the sensor."""
attrs = self.initial_attrs() attrs = self.initial_attrs()
attrs["value_format"] = SettingFormat(self._element.value_format).name.lower() attrs["value_format"] = SettingFormat(self._element.value_format).name.lower()
@ -227,7 +227,7 @@ class ElkZone(ElkSensor):
return f"mdi:{zone_icons.get(self._element.definition, 'alarm-bell')}" return f"mdi:{zone_icons.get(self._element.definition, 'alarm-bell')}"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Attributes of the sensor.""" """Attributes of the sensor."""
attrs = self.initial_attrs() attrs = self.initial_attrs()
attrs["physical_status"] = ZonePhysicalStatus( attrs["physical_status"] = ZonePhysicalStatus(

View File

@ -74,7 +74,7 @@ class SmartPlugSwitch(SwitchEntity):
self._pca.turn_off(self._device_id) self._pca.turn_off(self._device_id)
@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

View File

@ -175,7 +175,7 @@ class EmonCmsSensor(Entity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the attributes of the sensor.""" """Return the attributes of the sensor."""
return { return {
ATTR_FEEDID: self._elem["id"], ATTR_FEEDID: self._elem["id"],

View File

@ -251,7 +251,7 @@ class Enigma2Device(MediaPlayerEntity):
self.e2_box.update() self.e2_box.update()
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific state attributes. """Return device specific state attributes.
isRecording: Is the box currently recording. isRecording: Is the box currently recording.

View File

@ -202,7 +202,7 @@ class Envoy(CoordinatorEntity):
return ICON return ICON
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if ( if (
self._type == "inverters" self._type == "inverters"

View File

@ -172,7 +172,7 @@ class EnturPublicTransportSensor(Entity):
return self._state return self._state
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the state attributes.""" """Return the state attributes."""
self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION
self._attributes[ATTR_STOP_ID] = self._stop self._attributes[ATTR_STOP_ID] = self._stop

View File

@ -81,7 +81,7 @@ class ECCamera(Camera):
return "Environment Canada Radar" return "Environment Canada Radar"
@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 {ATTR_ATTRIBUTION: CONF_ATTRIBUTION, ATTR_UPDATED: self.timestamp} return {ATTR_ATTRIBUTION: CONF_ATTRIBUTION, ATTR_UPDATED: self.timestamp}

View File

@ -95,7 +95,7 @@ class ECSensor(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 device.""" """Return the state attributes of the device."""
return self._attr return self._attr

View File

@ -56,7 +56,7 @@ class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorEntity):
async_dispatcher_connect(self.hass, SIGNAL_ZONE_UPDATE, self._update_callback) async_dispatcher_connect(self.hass, SIGNAL_ZONE_UPDATE, self._update_callback)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attr = {} attr = {}

View File

@ -66,7 +66,7 @@ class EnvisalinkSensor(EnvisalinkDevice, Entity):
return self._info["status"]["alpha"] return self._info["status"]["alpha"]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._info["status"] return self._info["status"]

View File

@ -215,7 +215,7 @@ class EpsonProjectorMediaPlayer(MediaPlayerEntity):
await self._projector.send_command(BACK) await self._projector.send_command(BACK)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific state attributes.""" """Return device specific state attributes."""
if self._cmode is None: if self._cmode is None:
return {} return {}

Some files were not shown because too many files have changed in this diff Show More