diff --git a/homeassistant/components/pencom/switch.py b/homeassistant/components/pencom/switch.py index 7f193bc09a1..5621846e496 100644 --- a/homeassistant/components/pencom/switch.py +++ b/homeassistant/components/pencom/switch.py @@ -93,6 +93,6 @@ class PencomRelay(SwitchEntity): self._state = self._hub.get(self._board, self._addr) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return supported attributes.""" return {"board": self._board, "addr": self._addr} diff --git a/homeassistant/components/pi_hole/sensor.py b/homeassistant/components/pi_hole/sensor.py index 2f5873b14c1..4bd4c7b7f6f 100644 --- a/homeassistant/components/pi_hole/sensor.py +++ b/homeassistant/components/pi_hole/sensor.py @@ -73,6 +73,6 @@ class PiHoleSensor(PiHoleEntity): return self.api.data[self._condition] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the Pi-hole.""" return {ATTR_BLOCKED_DOMAINS: self.api.data["domains_being_blocked"]} diff --git a/homeassistant/components/ping/binary_sensor.py b/homeassistant/components/ping/binary_sensor.py index 98c36c01d98..a91f7235254 100644 --- a/homeassistant/components/ping/binary_sensor.py +++ b/homeassistant/components/ping/binary_sensor.py @@ -105,7 +105,7 @@ class PingBinarySensor(BinarySensorEntity): return self._ping.available @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes of the ICMP checo request.""" if self._ping.data is not False: return { diff --git a/homeassistant/components/plaato/entity.py b/homeassistant/components/plaato/entity.py index 7cb1a77a9fb..a28dfefb567 100644 --- a/homeassistant/components/plaato/entity.py +++ b/homeassistant/components/plaato/entity.py @@ -68,7 +68,7 @@ class PlaatoEntity(entity.Entity): return device_info @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the monitored installation.""" if self._attributes: return { diff --git a/homeassistant/components/plex/media_player.py b/homeassistant/components/plex/media_player.py index 1a57186bd9b..d32abf86ddb 100644 --- a/homeassistant/components/plex/media_player.py +++ b/homeassistant/components/plex/media_player.py @@ -522,7 +522,7 @@ class PlexMediaPlayer(MediaPlayerEntity): _LOGGER.error("Timed out playing on %s", self.name) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the scene state attributes.""" attributes = {} for attr in [ diff --git a/homeassistant/components/plex/sensor.py b/homeassistant/components/plex/sensor.py index 8c3733a7450..47dd05a557b 100644 --- a/homeassistant/components/plex/sensor.py +++ b/homeassistant/components/plex/sensor.py @@ -89,7 +89,7 @@ class PlexSensor(Entity): return "mdi:plex" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._server.sensor_attributes diff --git a/homeassistant/components/plugwise/binary_sensor.py b/homeassistant/components/plugwise/binary_sensor.py index 825d27d59bb..023ffa3de70 100644 --- a/homeassistant/components/plugwise/binary_sensor.py +++ b/homeassistant/components/plugwise/binary_sensor.py @@ -143,7 +143,7 @@ class PwNotifySensor(SmileBinarySensor, BinarySensorEntity): self._attributes = {} @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/plugwise/climate.py b/homeassistant/components/plugwise/climate.py index c8a2191963e..3efd6dbc3ca 100644 --- a/homeassistant/components/plugwise/climate.py +++ b/homeassistant/components/plugwise/climate.py @@ -124,7 +124,7 @@ class PwThermostat(SmileGateway, ClimateEntity): return SUPPORT_FLAGS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" attributes = {} if self._schema_names: diff --git a/homeassistant/components/point/__init__.py b/homeassistant/components/point/__init__.py index a92f4f3f14f..e5c209004de 100644 --- a/homeassistant/components/point/__init__.py +++ b/homeassistant/components/point/__init__.py @@ -296,7 +296,7 @@ class MinutPointEntity(Entity): return self._id @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return status of device.""" attrs = self.device.device_status attrs["last_heard_from"] = as_local(self.last_update).strftime( diff --git a/homeassistant/components/poolsense/sensor.py b/homeassistant/components/poolsense/sensor.py index a64cc0aef61..bf5c3eb0163 100644 --- a/homeassistant/components/poolsense/sensor.py +++ b/homeassistant/components/poolsense/sensor.py @@ -108,6 +108,6 @@ class PoolSenseSensor(PoolSenseEntity, Entity): return SENSORS[self.info_type]["unit"] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/powerwall/sensor.py b/homeassistant/components/powerwall/sensor.py index 5026d2fb357..3b4d7918cf7 100644 --- a/homeassistant/components/powerwall/sensor.py +++ b/homeassistant/components/powerwall/sensor.py @@ -136,7 +136,7 @@ class PowerWallEnergySensor(PowerWallEntity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" meter = self.coordinator.data[POWERWALL_API_METERS].get_meter(self._meter) return { diff --git a/homeassistant/components/proliphix/climate.py b/homeassistant/components/proliphix/climate.py index 5dff4725ea0..a293642038e 100644 --- a/homeassistant/components/proliphix/climate.py +++ b/homeassistant/components/proliphix/climate.py @@ -84,7 +84,7 @@ class ProliphixThermostat(ClimateEntity): return PRECISION_TENTHS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" return {ATTR_FAN: self._pdp.fan_state} diff --git a/homeassistant/components/push/camera.py b/homeassistant/components/push/camera.py index 31f2f88dac7..ff0ac45c139 100644 --- a/homeassistant/components/push/camera.py +++ b/homeassistant/components/push/camera.py @@ -175,7 +175,7 @@ class PushCamera(Camera): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { name: value diff --git a/homeassistant/components/pushbullet/sensor.py b/homeassistant/components/pushbullet/sensor.py index ff18e86aad9..f7aaa693c67 100644 --- a/homeassistant/components/pushbullet/sensor.py +++ b/homeassistant/components/pushbullet/sensor.py @@ -85,7 +85,7 @@ class PushBulletNotificationSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return all known attributes of the sensor.""" return self._state_attributes diff --git a/homeassistant/components/pvoutput/sensor.py b/homeassistant/components/pvoutput/sensor.py index 32d33f19e80..9e88cb0a664 100644 --- a/homeassistant/components/pvoutput/sensor.py +++ b/homeassistant/components/pvoutput/sensor.py @@ -100,7 +100,7 @@ class PvoutputSensor(Entity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the monitored installation.""" if self.pvcoutput is not None: return { diff --git a/homeassistant/components/pvpc_hourly_pricing/sensor.py b/homeassistant/components/pvpc_hourly_pricing/sensor.py index a9b53c970bd..b3486f9d534 100644 --- a/homeassistant/components/pvpc_hourly_pricing/sensor.py +++ b/homeassistant/components/pvpc_hourly_pricing/sensor.py @@ -112,7 +112,7 @@ class ElecPriceSensor(RestoreEntity): return self._pvpc_data.state_available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._pvpc_data.attributes diff --git a/homeassistant/components/qld_bushfire/geo_location.py b/homeassistant/components/qld_bushfire/geo_location.py index f608f6e12ae..0887e6b7cdd 100644 --- a/homeassistant/components/qld_bushfire/geo_location.py +++ b/homeassistant/components/qld_bushfire/geo_location.py @@ -234,7 +234,7 @@ class QldBushfireLocationEvent(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 ( diff --git a/homeassistant/components/qnap/sensor.py b/homeassistant/components/qnap/sensor.py index 11faba0f210..5f7695e5a60 100644 --- a/homeassistant/components/qnap/sensor.py +++ b/homeassistant/components/qnap/sensor.py @@ -268,7 +268,7 @@ class QNAPMemorySensor(QNAPSensor): return round(used / total * 100) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._api.data: data = self._api.data["system_stats"]["memory"] @@ -294,7 +294,7 @@ class QNAPNetworkSensor(QNAPSensor): return round_nicely(data["rx"] / 1024 / 1024) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._api.data: data = self._api.data["system_stats"]["nics"][self.monitor_device] @@ -322,7 +322,7 @@ class QNAPSystemSensor(QNAPSensor): return int(self._api.data["system_stats"]["system"]["temp_c"]) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._api.data: data = self._api.data["system_stats"] @@ -360,7 +360,7 @@ class QNAPDriveSensor(QNAPSensor): return f"{server_name} {self.var_name} (Drive {self.monitor_device})" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._api.data: data = self._api.data["smart_drive_health"][self.monitor_device] @@ -394,7 +394,7 @@ class QNAPVolumeSensor(QNAPSensor): return round(used_gb / total_gb * 100) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._api.data: data = self._api.data["volumes"][self.monitor_device] diff --git a/homeassistant/components/qvr_pro/camera.py b/homeassistant/components/qvr_pro/camera.py index 9dd8e3c4f20..2f4353063d1 100644 --- a/homeassistant/components/qvr_pro/camera.py +++ b/homeassistant/components/qvr_pro/camera.py @@ -82,7 +82,7 @@ class QVRProCamera(Camera): return self._brand @property - def device_state_attributes(self): + def extra_state_attributes(self): """Get the state attributes.""" attrs = {"qvr_guid": self.guid} diff --git a/homeassistant/components/rachio/switch.py b/homeassistant/components/rachio/switch.py index 44a17acaecf..726a6e26ce5 100644 --- a/homeassistant/components/rachio/switch.py +++ b/homeassistant/components/rachio/switch.py @@ -388,7 +388,7 @@ class RachioZone(RachioSwitch): return self._entity_picture @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the optional state attributes.""" props = {ATTR_ZONE_NUMBER: self._zone_number, ATTR_ZONE_SUMMARY: self._summary} if self._shade_type: @@ -494,7 +494,7 @@ class RachioSchedule(RachioSwitch): return "mdi:water" if self.schedule_is_enabled else "mdi:water-off" @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the optional state attributes.""" return { ATTR_SCHEDULE_SUMMARY: self._summary, diff --git a/homeassistant/components/radarr/sensor.py b/homeassistant/components/radarr/sensor.py index 27365271014..9baed6c41c7 100644 --- a/homeassistant/components/radarr/sensor.py +++ b/homeassistant/components/radarr/sensor.py @@ -144,7 +144,7 @@ class RadarrSensor(Entity): return self._unit @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" attributes = {} if self.type == "upcoming": diff --git a/homeassistant/components/radiotherm/climate.py b/homeassistant/components/radiotherm/climate.py index f09ef95170f..d7bca1175cb 100644 --- a/homeassistant/components/radiotherm/climate.py +++ b/homeassistant/components/radiotherm/climate.py @@ -181,7 +181,7 @@ class RadioThermostat(ClimateEntity): return PRECISION_HALVES @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" return {ATTR_FAN_ACTION: self._fstate} diff --git a/homeassistant/components/rainbird/switch.py b/homeassistant/components/rainbird/switch.py index bccd4d2986c..7acb9740616 100644 --- a/homeassistant/components/rainbird/switch.py +++ b/homeassistant/components/rainbird/switch.py @@ -78,7 +78,7 @@ class RainBirdSwitch(SwitchEntity): self._attributes = {ATTR_DURATION: self._duration, "zone": self._zone} @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return state attributes.""" return self._attributes diff --git a/homeassistant/components/raincloud/__init__.py b/homeassistant/components/raincloud/__init__.py index 5955ef67168..6b0ca39df03 100644 --- a/homeassistant/components/raincloud/__init__.py +++ b/homeassistant/components/raincloud/__init__.py @@ -166,7 +166,7 @@ class RainCloudEntity(Entity): return UNIT_OF_MEASUREMENT_MAP.get(self._sensor_type) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION, "identifier": self.data.serial} diff --git a/homeassistant/components/raincloud/switch.py b/homeassistant/components/raincloud/switch.py index d6733412cac..d15f5c7c047 100644 --- a/homeassistant/components/raincloud/switch.py +++ b/homeassistant/components/raincloud/switch.py @@ -83,7 +83,7 @@ class RainCloudSwitch(RainCloudEntity, SwitchEntity): self._state = self.data.auto_watering @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/rainmachine/__init__.py b/homeassistant/components/rainmachine/__init__.py index b4d8510cc77..e71e8a1f6d2 100644 --- a/homeassistant/components/rainmachine/__init__.py +++ b/homeassistant/components/rainmachine/__init__.py @@ -225,7 +225,7 @@ class RainMachineEntity(CoordinatorEntity): } @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the state attributes.""" return self._attrs diff --git a/homeassistant/components/random/sensor.py b/homeassistant/components/random/sensor.py index 58d996bc6ec..7584fe17405 100644 --- a/homeassistant/components/random/sensor.py +++ b/homeassistant/components/random/sensor.py @@ -74,7 +74,7 @@ class RandomSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the attributes of the sensor.""" return {ATTR_MAXIMUM: self._maximum, ATTR_MINIMUM: self._minimum} diff --git a/homeassistant/components/recollect_waste/sensor.py b/homeassistant/components/recollect_waste/sensor.py index 66ced51b77f..0822cdb1f3a 100644 --- a/homeassistant/components/recollect_waste/sensor.py +++ b/homeassistant/components/recollect_waste/sensor.py @@ -86,7 +86,7 @@ class ReCollectWasteSensor(CoordinatorEntity): self._state = None @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/reddit/sensor.py b/homeassistant/components/reddit/sensor.py index 7a04fb6a8ae..153b6636cc4 100644 --- a/homeassistant/components/reddit/sensor.py +++ b/homeassistant/components/reddit/sensor.py @@ -105,7 +105,7 @@ class RedditSensor(Entity): return len(self._subreddit_data) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { ATTR_SUBREDDIT: self._subreddit, diff --git a/homeassistant/components/rejseplanen/sensor.py b/homeassistant/components/rejseplanen/sensor.py index 30d57a3d9dc..ea55d56b8df 100644 --- a/homeassistant/components/rejseplanen/sensor.py +++ b/homeassistant/components/rejseplanen/sensor.py @@ -110,7 +110,7 @@ class RejseplanenTransportSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if not self._times: return {ATTR_STOP_ID: self._stop_id, ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/repetier/sensor.py b/homeassistant/components/repetier/sensor.py index e342b2d341e..a2b86792aa7 100644 --- a/homeassistant/components/repetier/sensor.py +++ b/homeassistant/components/repetier/sensor.py @@ -66,7 +66,7 @@ class RepetierSensor(Entity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return sensor attributes.""" return self._attributes diff --git a/homeassistant/components/rest/sensor.py b/homeassistant/components/rest/sensor.py index 0699d9dc07c..5ff5e87c3e6 100644 --- a/homeassistant/components/rest/sensor.py +++ b/homeassistant/components/rest/sensor.py @@ -119,7 +119,7 @@ class RestSensor(RestEntity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/rflink/light.py b/homeassistant/components/rflink/light.py index fe74c979396..2a97472f000 100644 --- a/homeassistant/components/rflink/light.py +++ b/homeassistant/components/rflink/light.py @@ -194,7 +194,7 @@ class DimmableRflinkLight(SwitchableRflinkDevice, LightEntity): return self._brightness @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" if self._brightness is None: return {} @@ -256,7 +256,7 @@ class HybridRflinkLight(SwitchableRflinkDevice, LightEntity): return self._brightness @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" if self._brightness is None: return {} diff --git a/homeassistant/components/rfxtrx/__init__.py b/homeassistant/components/rfxtrx/__init__.py index c9e8c0dee75..649a573c5b4 100644 --- a/homeassistant/components/rfxtrx/__init__.py +++ b/homeassistant/components/rfxtrx/__init__.py @@ -505,7 +505,7 @@ class RfxtrxEntity(RestoreEntity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" if not self._event: return None diff --git a/homeassistant/components/ring/binary_sensor.py b/homeassistant/components/ring/binary_sensor.py index bbfbbf1690e..18ce87e722e 100644 --- a/homeassistant/components/ring/binary_sensor.py +++ b/homeassistant/components/ring/binary_sensor.py @@ -111,9 +111,9 @@ class RingBinarySensor(RingEntityMixin, BinarySensorEntity): return self._unique_id @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - attrs = super().device_state_attributes + attrs = super().extra_state_attributes if self._active_alert is None: return attrs diff --git a/homeassistant/components/ring/camera.py b/homeassistant/components/ring/camera.py index bd5950b81a9..8f827aee7d2 100644 --- a/homeassistant/components/ring/camera.py +++ b/homeassistant/components/ring/camera.py @@ -93,7 +93,7 @@ class RingCam(RingEntityMixin, Camera): return self._device.id @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/ring/entity.py b/homeassistant/components/ring/entity.py index 6eb87cb8f9b..7a1c8ae7bdf 100644 --- a/homeassistant/components/ring/entity.py +++ b/homeassistant/components/ring/entity.py @@ -38,7 +38,7 @@ class RingEntityMixin: return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/ring/sensor.py b/homeassistant/components/ring/sensor.py index 0a1cc85230f..276d3839438 100644 --- a/homeassistant/components/ring/sensor.py +++ b/homeassistant/components/ring/sensor.py @@ -180,9 +180,9 @@ class HistoryRingSensor(RingSensor): return self._latest_event["created_at"].isoformat() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - attrs = super().device_state_attributes + attrs = super().extra_state_attributes if self._latest_event: attrs["created_at"] = self._latest_event["created_at"] diff --git a/homeassistant/components/ripple/sensor.py b/homeassistant/components/ripple/sensor.py index ab0da77b173..97cf8b4a794 100644 --- a/homeassistant/components/ripple/sensor.py +++ b/homeassistant/components/ripple/sensor.py @@ -57,7 +57,7 @@ class RippleSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/risco/binary_sensor.py b/homeassistant/components/risco/binary_sensor.py index ba01b70686b..ba32429c154 100644 --- a/homeassistant/components/risco/binary_sensor.py +++ b/homeassistant/components/risco/binary_sensor.py @@ -60,7 +60,7 @@ class RiscoBinarySensor(BinarySensorEntity, RiscoEntity): return binary_sensor_unique_id(self._risco, self._zone_id) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"zone_id": self._zone_id, "bypassed": self._zone.bypassed} diff --git a/homeassistant/components/risco/sensor.py b/homeassistant/components/risco/sensor.py index 43d763a35fa..846444e5fbd 100644 --- a/homeassistant/components/risco/sensor.py +++ b/homeassistant/components/risco/sensor.py @@ -94,7 +94,7 @@ class RiscoSensor(CoordinatorEntity): return self._event.time @property - def device_state_attributes(self): + def extra_state_attributes(self): """State attributes.""" if self._event is None: return None diff --git a/homeassistant/components/rituals_perfume_genie/switch.py b/homeassistant/components/rituals_perfume_genie/switch.py index 7041d22f4b8..471be52b054 100644 --- a/homeassistant/components/rituals_perfume_genie/switch.py +++ b/homeassistant/components/rituals_perfume_genie/switch.py @@ -66,7 +66,7 @@ class DiffuserSwitch(SwitchEntity): return ICON @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" attributes = { "fan_speed": self._diffuser.data["hub"]["attributes"]["speedc"], diff --git a/homeassistant/components/roomba/braava.py b/homeassistant/components/roomba/braava.py index 1a3d106bf80..90298078e42 100644 --- a/homeassistant/components/roomba/braava.py +++ b/homeassistant/components/roomba/braava.py @@ -116,9 +116,9 @@ class BraavaJet(IRobotVacuum): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" - state_attrs = super().device_state_attributes + state_attrs = super().extra_state_attributes # Get Braava state state = self.vacuum_state diff --git a/homeassistant/components/roomba/irobot_base.py b/homeassistant/components/roomba/irobot_base.py index 7dd045a1137..9d6a0f5cafc 100644 --- a/homeassistant/components/roomba/irobot_base.py +++ b/homeassistant/components/roomba/irobot_base.py @@ -168,7 +168,7 @@ class IRobotVacuum(IRobotEntity, StateVacuumEntity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" state = self.vacuum_state diff --git a/homeassistant/components/roomba/roomba.py b/homeassistant/components/roomba/roomba.py index 0a9aec0b608..5f960aeaae0 100644 --- a/homeassistant/components/roomba/roomba.py +++ b/homeassistant/components/roomba/roomba.py @@ -23,9 +23,9 @@ class RoombaVacuum(IRobotVacuum): """Basic Roomba robot (without carpet boost).""" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" - state_attrs = super().device_state_attributes + state_attrs = super().extra_state_attributes # Get bin state bin_raw_state = self.vacuum_state.get("bin", {}) diff --git a/homeassistant/components/sense/binary_sensor.py b/homeassistant/components/sense/binary_sensor.py index bc06721ae5e..ae5e4fc95bc 100644 --- a/homeassistant/components/sense/binary_sensor.py +++ b/homeassistant/components/sense/binary_sensor.py @@ -101,7 +101,7 @@ class SenseDevice(BinarySensorEntity): return self._id @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/sense/sensor.py b/homeassistant/components/sense/sensor.py index 25fa5943bd5..7b6e415d4a3 100644 --- a/homeassistant/components/sense/sensor.py +++ b/homeassistant/components/sense/sensor.py @@ -163,7 +163,7 @@ class SenseActiveSensor(Entity): return POWER_WATT @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} @@ -247,7 +247,7 @@ class SenseVoltageSensor(Entity): return VOLT @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} @@ -333,7 +333,7 @@ class SenseTrendsSensor(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} @@ -415,7 +415,7 @@ class SenseEnergyDevice(Entity): return POWER_WATT @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/sensibo/climate.py b/homeassistant/components/sensibo/climate.py index 26276650752..10ceaa39a38 100644 --- a/homeassistant/components/sensibo/climate.py +++ b/homeassistant/components/sensibo/climate.py @@ -191,7 +191,7 @@ class SensiboClimate(ClimateEntity): return self._external_state or super().state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"battery": self.current_battery} diff --git a/homeassistant/components/serial/sensor.py b/homeassistant/components/serial/sensor.py index e0bf23a2514..02590ccfe8f 100644 --- a/homeassistant/components/serial/sensor.py +++ b/homeassistant/components/serial/sensor.py @@ -241,7 +241,7 @@ class SerialSensor(Entity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the attributes of the entity (if any JSON present).""" return self._attributes diff --git a/homeassistant/components/sesame/lock.py b/homeassistant/components/sesame/lock.py index 9c86c262235..acd71b7c9e7 100644 --- a/homeassistant/components/sesame/lock.py +++ b/homeassistant/components/sesame/lock.py @@ -86,7 +86,7 @@ class SesameDevice(LockEntity): self._responsive = status["responsive"] @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the state attributes.""" return { ATTR_DEVICE_ID: self._device_id, diff --git a/homeassistant/components/seventeentrack/sensor.py b/homeassistant/components/seventeentrack/sensor.py index 07cfe9ca66f..15110f6a0c3 100644 --- a/homeassistant/components/seventeentrack/sensor.py +++ b/homeassistant/components/seventeentrack/sensor.py @@ -109,7 +109,7 @@ class SeventeenTrackSummarySensor(Entity): return self._state is not None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" return self._attrs @@ -190,7 +190,7 @@ class SeventeenTrackPackageSensor(Entity): return self._data.packages.get(self._tracking_number) is not None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" return self._attrs diff --git a/homeassistant/components/sharkiq/vacuum.py b/homeassistant/components/sharkiq/vacuum.py index 9684dde45e6..5b4254eebb7 100644 --- a/homeassistant/components/sharkiq/vacuum.py +++ b/homeassistant/components/sharkiq/vacuum.py @@ -255,7 +255,7 @@ class SharkVacuumEntity(CoordinatorEntity, StateVacuumEntity): return self.sharkiq.get_property_value(Properties.LOW_LIGHT_MISSION) @property - def device_state_attributes(self) -> Dict: + def extra_state_attributes(self) -> Dict: """Return a dictionary of device state attributes specific to sharkiq.""" data = { ATTR_ERROR_CODE: self.error_code, diff --git a/homeassistant/components/shelly/binary_sensor.py b/homeassistant/components/shelly/binary_sensor.py index 18220fc9e3a..385b3b30c36 100644 --- a/homeassistant/components/shelly/binary_sensor.py +++ b/homeassistant/components/shelly/binary_sensor.py @@ -47,7 +47,7 @@ SENSORS = { name="Gas", device_class=DEVICE_CLASS_GAS, value=lambda value: value in ["mild", "heavy"], - device_state_attributes=lambda block: {"detected": block.gas}, + extra_state_attributes=lambda block: {"detected": block.gas}, ), ("sensor", "smoke"): BlockAttributeDescription( name="Smoke", device_class=DEVICE_CLASS_SMOKE @@ -95,7 +95,7 @@ REST_SENSORS = { icon="mdi:update", value=lambda status, _: status["update"]["has_update"], default_enabled=False, - device_state_attributes=lambda status: { + extra_state_attributes=lambda status: { "latest_stable_version": status["update"]["new_version"], "installed_version": status["update"]["old_version"], }, diff --git a/homeassistant/components/shelly/entity.py b/homeassistant/components/shelly/entity.py index 71ab4703c79..9457cbaf370 100644 --- a/homeassistant/components/shelly/entity.py +++ b/homeassistant/components/shelly/entity.py @@ -150,9 +150,7 @@ class BlockAttributeDescription: available: Optional[Callable[[aioshelly.Block], bool]] = None # Callable (settings, block), return true if entity should be removed removal_condition: Optional[Callable[[dict, aioshelly.Block], bool]] = None - device_state_attributes: Optional[ - Callable[[aioshelly.Block], Optional[dict]] - ] = None + extra_state_attributes: Optional[Callable[[aioshelly.Block], Optional[dict]]] = None @dataclass @@ -165,7 +163,7 @@ class RestAttributeDescription: value: Callable[[dict, Any], Any] = None device_class: Optional[str] = None default_enabled: bool = True - device_state_attributes: Optional[Callable[[dict], Optional[dict]]] = None + extra_state_attributes: Optional[Callable[[dict], Optional[dict]]] = None class ShellyBlockEntity(entity.Entity): @@ -293,12 +291,12 @@ class ShellyBlockAttributeEntity(ShellyBlockEntity, entity.Entity): return self.description.available(self.block) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - if self.description.device_state_attributes is None: + if self.description.extra_state_attributes is None: return None - return self.description.device_state_attributes(self.block) + return self.description.extra_state_attributes(self.block) class ShellyRestAttributeEntity(update_coordinator.CoordinatorEntity): @@ -369,12 +367,12 @@ class ShellyRestAttributeEntity(update_coordinator.CoordinatorEntity): return f"{self.wrapper.mac}-{self.attribute}" @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the state attributes.""" - if self.description.device_state_attributes is None: + if self.description.extra_state_attributes is None: return None - return self.description.device_state_attributes(self.wrapper.device.status) + return self.description.extra_state_attributes(self.wrapper.device.status) class ShellySleepingBlockAttributeEntity(ShellyBlockAttributeEntity, RestoreEntity): diff --git a/homeassistant/components/shelly/sensor.py b/homeassistant/components/shelly/sensor.py index 10237629223..aac5ec81ec3 100644 --- a/homeassistant/components/shelly/sensor.py +++ b/homeassistant/components/shelly/sensor.py @@ -159,7 +159,7 @@ SENSORS = { unit=PERCENTAGE, icon="mdi:progress-wrench", value=lambda value: round(100 - (value / 3600 / SHAIR_MAX_WORK_HOURS), 1), - device_state_attributes=lambda block: { + extra_state_attributes=lambda block: { "Operational hours": round(block.totalWorkTime / 3600, 1) }, ), diff --git a/homeassistant/components/shodan/sensor.py b/homeassistant/components/shodan/sensor.py index d2a6a28fbe4..397e05a35ca 100644 --- a/homeassistant/components/shodan/sensor.py +++ b/homeassistant/components/shodan/sensor.py @@ -78,7 +78,7 @@ class ShodanSensor(Entity): return ICON @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/sigfox/sensor.py b/homeassistant/components/sigfox/sensor.py index 1de3cfeb8a0..3bf0f084e51 100644 --- a/homeassistant/components/sigfox/sensor.py +++ b/homeassistant/components/sigfox/sensor.py @@ -155,6 +155,6 @@ class SigfoxDevice(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return other details about the last message.""" return self._message_data diff --git a/homeassistant/components/sighthound/image_processing.py b/homeassistant/components/sighthound/image_processing.py index e15fab1aaa3..fa636eb757f 100644 --- a/homeassistant/components/sighthound/image_processing.py +++ b/homeassistant/components/sighthound/image_processing.py @@ -170,7 +170,7 @@ class SighthoundEntity(ImageProcessingEntity): return ATTR_PEOPLE @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the attributes.""" if not self._last_detection: return {} diff --git a/homeassistant/components/simplisafe/__init__.py b/homeassistant/components/simplisafe/__init__.py index a6d95e1d9af..485284b3293 100644 --- a/homeassistant/components/simplisafe/__init__.py +++ b/homeassistant/components/simplisafe/__init__.py @@ -634,7 +634,7 @@ class SimpliSafeEntity(CoordinatorEntity): return self._device_info @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attrs diff --git a/homeassistant/components/simulated/sensor.py b/homeassistant/components/simulated/sensor.py index 7f484b712c1..dc4872cb2aa 100644 --- a/homeassistant/components/simulated/sensor.py +++ b/homeassistant/components/simulated/sensor.py @@ -137,7 +137,7 @@ class SimulatedSensor(Entity): return self._unit @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return other details about the sensor state.""" return { "amplitude": self._amp, diff --git a/homeassistant/components/skybeacon/sensor.py b/homeassistant/components/skybeacon/sensor.py index 9b759327dca..bff9e311844 100644 --- a/homeassistant/components/skybeacon/sensor.py +++ b/homeassistant/components/skybeacon/sensor.py @@ -86,7 +86,7 @@ class SkybeaconHumid(Entity): return PERCENTAGE @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1} @@ -115,7 +115,7 @@ class SkybeaconTemp(Entity): return TEMP_CELSIUS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1} diff --git a/homeassistant/components/skybell/__init__.py b/homeassistant/components/skybell/__init__.py index c1c9d76314c..2acb729d767 100644 --- a/homeassistant/components/skybell/__init__.py +++ b/homeassistant/components/skybell/__init__.py @@ -82,7 +82,7 @@ class SkybellDevice(Entity): self._device.refresh() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/skybell/binary_sensor.py b/homeassistant/components/skybell/binary_sensor.py index 8949a58fa01..7e075fba38a 100644 --- a/homeassistant/components/skybell/binary_sensor.py +++ b/homeassistant/components/skybell/binary_sensor.py @@ -76,9 +76,9 @@ class SkybellBinarySensor(SkybellDevice, BinarySensorEntity): return self._device_class @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - attrs = super().device_state_attributes + attrs = super().extra_state_attributes attrs["event_date"] = self._event.get("createdAt") diff --git a/homeassistant/components/slide/cover.py b/homeassistant/components/slide/cover.py index 470cf9e5a1f..9e925af3391 100644 --- a/homeassistant/components/slide/cover.py +++ b/homeassistant/components/slide/cover.py @@ -55,7 +55,7 @@ class SlideCover(CoverEntity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return {ATTR_ID: self._id} diff --git a/homeassistant/components/sma/sensor.py b/homeassistant/components/sma/sensor.py index 94bab40a3b7..bc4457e2838 100644 --- a/homeassistant/components/sma/sensor.py +++ b/homeassistant/components/sma/sensor.py @@ -196,7 +196,7 @@ class SMAsensor(Entity): return self._sensor.unit @property - def device_state_attributes(self): # Can be remove from 0.99 + def extra_state_attributes(self): # Can be remove from 0.99 """Return the state attributes of the sensor.""" return self._attr diff --git a/homeassistant/components/smart_meter_texas/sensor.py b/homeassistant/components/smart_meter_texas/sensor.py index e65fbdcb531..42084fff836 100644 --- a/homeassistant/components/smart_meter_texas/sensor.py +++ b/homeassistant/components/smart_meter_texas/sensor.py @@ -65,7 +65,7 @@ class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" attributes = { METER_NUMBER: self.meter.meter, diff --git a/homeassistant/components/smartthings/climate.py b/homeassistant/components/smartthings/climate.py index 6ce872cdac7..d99cc1d60cf 100644 --- a/homeassistant/components/smartthings/climate.py +++ b/homeassistant/components/smartthings/climate.py @@ -415,7 +415,7 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity): return self._device.status.temperature @property - def device_state_attributes(self): + def extra_state_attributes(self): """ Return device specific state attributes. diff --git a/homeassistant/components/smartthings/cover.py b/homeassistant/components/smartthings/cover.py index ddc52ec3f6c..7b837faca1c 100644 --- a/homeassistant/components/smartthings/cover.py +++ b/homeassistant/components/smartthings/cover.py @@ -147,7 +147,7 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity): return self._device_class @property - def device_state_attributes(self): + def extra_state_attributes(self): """Get additional state attributes.""" return self._state_attrs diff --git a/homeassistant/components/smartthings/lock.py b/homeassistant/components/smartthings/lock.py index d6b615b47a7..55370e99993 100644 --- a/homeassistant/components/smartthings/lock.py +++ b/homeassistant/components/smartthings/lock.py @@ -57,7 +57,7 @@ class SmartThingsLock(SmartThingsEntity, LockEntity): return self._device.status.lock == ST_STATE_LOCKED @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" state_attrs = {} status = self._device.status.attributes[Attribute.lock] diff --git a/homeassistant/components/smartthings/scene.py b/homeassistant/components/smartthings/scene.py index 11ee6dc83e1..e3d93c663fa 100644 --- a/homeassistant/components/smartthings/scene.py +++ b/homeassistant/components/smartthings/scene.py @@ -24,7 +24,7 @@ class SmartThingsScene(Scene): await self._scene.execute() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Get attributes about the state.""" return { "icon": self._scene.icon, diff --git a/homeassistant/components/smarttub/sensor.py b/homeassistant/components/smarttub/sensor.py index 563c16b3ff1..99b2e80262d 100644 --- a/homeassistant/components/smarttub/sensor.py +++ b/homeassistant/components/smarttub/sensor.py @@ -70,7 +70,7 @@ class SmartTubPrimaryFiltrationCycle(SmartTubSensor): return self._state.status.name.lower() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" state = self._state return { @@ -96,7 +96,7 @@ class SmartTubSecondaryFiltrationCycle(SmartTubSensor): return self._state.status.name.lower() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" state = self._state return { diff --git a/homeassistant/components/smhi/weather.py b/homeassistant/components/smhi/weather.py index c13982ee15d..ca5e7f7ac23 100644 --- a/homeassistant/components/smhi/weather.py +++ b/homeassistant/components/smhi/weather.py @@ -235,7 +235,7 @@ class SmhiWeather(WeatherEntity): return data @property - def device_state_attributes(self) -> Dict: + def extra_state_attributes(self) -> Dict: """Return SMHI specific attributes.""" if self.cloudiness: return {ATTR_SMHI_CLOUDINESS: self.cloudiness} diff --git a/homeassistant/components/sms/sensor.py b/homeassistant/components/sms/sensor.py index e775b4a0e05..660b1a70c01 100644 --- a/homeassistant/components/sms/sensor.py +++ b/homeassistant/components/sms/sensor.py @@ -75,7 +75,7 @@ class GSMSignalSensor(Entity): _LOGGER.error("Failed to read signal quality: %s", exc) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the sensor attributes.""" return self._state diff --git a/homeassistant/components/snapcast/media_player.py b/homeassistant/components/snapcast/media_player.py index ab4b2415034..e1c5b7d875b 100644 --- a/homeassistant/components/snapcast/media_player.py +++ b/homeassistant/components/snapcast/media_player.py @@ -164,7 +164,7 @@ class SnapcastGroupDevice(MediaPlayerEntity): return list(self._group.streams_by_name().keys()) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" name = f"{self._group.friendly_name} {GROUP_SUFFIX}" return {"friendly_name": name} @@ -261,7 +261,7 @@ class SnapcastClientDevice(MediaPlayerEntity): return STATE_OFF @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" state_attrs = {} if self.latency is not None: diff --git a/homeassistant/components/sochain/sensor.py b/homeassistant/components/sochain/sensor.py index 8f704471339..5acc8e8432a 100644 --- a/homeassistant/components/sochain/sensor.py +++ b/homeassistant/components/sochain/sensor.py @@ -69,7 +69,7 @@ class SochainSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/socialblade/sensor.py b/homeassistant/components/socialblade/sensor.py index 3d53e76a27a..3d3331f8af2 100644 --- a/homeassistant/components/socialblade/sensor.py +++ b/homeassistant/components/socialblade/sensor.py @@ -64,7 +64,7 @@ class SocialBladeSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._attributes: return self._attributes diff --git a/homeassistant/components/solaredge/sensor.py b/homeassistant/components/solaredge/sensor.py index 8609e578e5e..24932618195 100644 --- a/homeassistant/components/solaredge/sensor.py +++ b/homeassistant/components/solaredge/sensor.py @@ -162,7 +162,7 @@ class SolarEdgeDetailsSensor(SolarEdgeSensor): """Representation of an SolarEdge Monitoring API details sensor.""" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self.data_service.attributes @@ -182,7 +182,7 @@ class SolarEdgeInventorySensor(SolarEdgeSensor): self._json_key = SENSOR_TYPES[self.sensor_key][0] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self.data_service.attributes.get(self._json_key) @@ -202,7 +202,7 @@ class SolarEdgeEnergyDetailsSensor(SolarEdgeSensor): self._json_key = SENSOR_TYPES[self.sensor_key][0] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self.data_service.attributes.get(self._json_key) @@ -232,7 +232,7 @@ class SolarEdgePowerFlowSensor(SolarEdgeSensor): return DEVICE_CLASS_POWER @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self.data_service.attributes.get(self._json_key) diff --git a/homeassistant/components/solaredge_local/sensor.py b/homeassistant/components/solaredge_local/sensor.py index 59b0a5e8856..9d5eca149cf 100644 --- a/homeassistant/components/solaredge_local/sensor.py +++ b/homeassistant/components/solaredge_local/sensor.py @@ -257,7 +257,7 @@ class SolarEdgeSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._attr: try: diff --git a/homeassistant/components/sonarr/sensor.py b/homeassistant/components/sonarr/sensor.py index 8a625846744..ca489d95cfd 100644 --- a/homeassistant/components/sonarr/sensor.py +++ b/homeassistant/components/sonarr/sensor.py @@ -131,7 +131,7 @@ class SonarrCommandsSensor(SonarrSensor): self._commands = await self.sonarr.commands() @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.""" attrs = {} @@ -172,7 +172,7 @@ class SonarrDiskspaceSensor(SonarrSensor): self._total_free = sum([disk.free for disk in self._disks]) @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.""" attrs = {} @@ -217,7 +217,7 @@ class SonarrQueueSensor(SonarrSensor): self._queue = await self.sonarr.queue() @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.""" attrs = {} @@ -258,7 +258,7 @@ class SonarrSeriesSensor(SonarrSensor): self._items = await self.sonarr.series() @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.""" attrs = {} @@ -301,7 +301,7 @@ class SonarrUpcomingSensor(SonarrSensor): ) @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.""" attrs = {} @@ -342,7 +342,7 @@ class SonarrWantedSensor(SonarrSensor): self._total = self._results.total @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.""" attrs = {} diff --git a/homeassistant/components/sonos/media_player.py b/homeassistant/components/sonos/media_player.py index 1a9e9ef58df..0b01ff94462 100644 --- a/homeassistant/components/sonos/media_player.py +++ b/homeassistant/components/sonos/media_player.py @@ -1366,7 +1366,7 @@ class SonosEntity(MediaPlayerEntity): self.soco.remove_from_queue(queue_position) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return entity specific state attributes.""" attributes = {ATTR_SONOS_GROUP: [e.entity_id for e in self._sonos_group]} diff --git a/homeassistant/components/soundtouch/media_player.py b/homeassistant/components/soundtouch/media_player.py index 83c8192ccb2..1b07f01e92a 100644 --- a/homeassistant/components/soundtouch/media_player.py +++ b/homeassistant/components/soundtouch/media_player.py @@ -440,7 +440,7 @@ class SoundTouchDevice(MediaPlayerEntity): self._device.add_zone_slave([slave.device for slave in slaves]) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return entity specific state attributes.""" attributes = {} diff --git a/homeassistant/components/speedtestdotnet/sensor.py b/homeassistant/components/speedtestdotnet/sensor.py index 5607d2570c9..6f0cb4124fe 100644 --- a/homeassistant/components/speedtestdotnet/sensor.py +++ b/homeassistant/components/speedtestdotnet/sensor.py @@ -67,7 +67,7 @@ class SpeedtestSensor(CoordinatorEntity, RestoreEntity): return ICON @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if not self.coordinator.data: return None diff --git a/homeassistant/components/spotcrime/sensor.py b/homeassistant/components/spotcrime/sensor.py index 30aa80b5e7d..e44bd81ed51 100644 --- a/homeassistant/components/spotcrime/sensor.py +++ b/homeassistant/components/spotcrime/sensor.py @@ -103,7 +103,7 @@ class SpotCrimeSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/sql/sensor.py b/homeassistant/components/sql/sensor.py index 670f5e66146..ccec918832e 100644 --- a/homeassistant/components/sql/sensor.py +++ b/homeassistant/components/sql/sensor.py @@ -120,7 +120,7 @@ class SQLSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/squeezebox/media_player.py b/homeassistant/components/squeezebox/media_player.py index b87695dd159..c57f95266ff 100644 --- a/homeassistant/components/squeezebox/media_player.py +++ b/homeassistant/components/squeezebox/media_player.py @@ -265,7 +265,7 @@ class SqueezeBoxEntity(MediaPlayerEntity): self._remove_dispatcher = None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device-specific attributes.""" squeezebox_attr = { attr: getattr(self, attr) diff --git a/homeassistant/components/srp_energy/sensor.py b/homeassistant/components/srp_energy/sensor.py index 36a8798b05b..cc39bf0b898 100644 --- a/homeassistant/components/srp_energy/sensor.py +++ b/homeassistant/components/srp_energy/sensor.py @@ -122,7 +122,7 @@ class SrpEntity(entity.Entity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if not self.coordinator.data: return None diff --git a/homeassistant/components/starline/device_tracker.py b/homeassistant/components/starline/device_tracker.py index 6f202bbae52..59b9f5b4f95 100644 --- a/homeassistant/components/starline/device_tracker.py +++ b/homeassistant/components/starline/device_tracker.py @@ -26,7 +26,7 @@ class StarlineDeviceTracker(StarlineEntity, TrackerEntity, RestoreEntity): super().__init__(account, device, "location", "Location") @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific attributes.""" return self._account.gps_attrs(self._device) diff --git a/homeassistant/components/starline/lock.py b/homeassistant/components/starline/lock.py index 0b158451fb3..f19fa4896ba 100644 --- a/homeassistant/components/starline/lock.py +++ b/homeassistant/components/starline/lock.py @@ -31,7 +31,7 @@ class StarlineLock(StarlineEntity, LockEntity): return super().available and self._device.online @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the lock. Possible dictionary keys: diff --git a/homeassistant/components/starline/sensor.py b/homeassistant/components/starline/sensor.py index 8aba1b54269..a8782a87892 100644 --- a/homeassistant/components/starline/sensor.py +++ b/homeassistant/components/starline/sensor.py @@ -109,7 +109,7 @@ class StarlineSensor(StarlineEntity, Entity): return self._device_class @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" if self._key == "balance": return self._account.balance_attrs(self._device) diff --git a/homeassistant/components/starline/switch.py b/homeassistant/components/starline/switch.py index c50a7bb4973..b3214390a44 100644 --- a/homeassistant/components/starline/switch.py +++ b/homeassistant/components/starline/switch.py @@ -53,7 +53,7 @@ class StarlineSwitch(StarlineEntity, SwitchEntity): return super().available and self._device.online @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the switch.""" if self._key == "ign": return self._account.engine_attrs(self._device) diff --git a/homeassistant/components/statistics/sensor.py b/homeassistant/components/statistics/sensor.py index 11cddc88c87..3bf70060da9 100644 --- a/homeassistant/components/statistics/sensor.py +++ b/homeassistant/components/statistics/sensor.py @@ -184,7 +184,7 @@ class StatisticsSensor(Entity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" if not self.is_binary: return { diff --git a/homeassistant/components/steam_online/sensor.py b/homeassistant/components/steam_online/sensor.py index dbe83177537..e62922c67f4 100644 --- a/homeassistant/components/steam_online/sensor.py +++ b/homeassistant/components/steam_online/sensor.py @@ -194,7 +194,7 @@ class SteamSensor(Entity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attr = {} if self._game is not None: diff --git a/homeassistant/components/stiebel_eltron/climate.py b/homeassistant/components/stiebel_eltron/climate.py index d8c32575b17..5ae7a9230f7 100644 --- a/homeassistant/components/stiebel_eltron/climate.py +++ b/homeassistant/components/stiebel_eltron/climate.py @@ -96,7 +96,7 @@ class StiebelEltron(ClimateEntity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return {"filter_alarm": self._filter_alarm} diff --git a/homeassistant/components/stookalert/binary_sensor.py b/homeassistant/components/stookalert/binary_sensor.py index a1c36e9a10e..033af78560c 100644 --- a/homeassistant/components/stookalert/binary_sensor.py +++ b/homeassistant/components/stookalert/binary_sensor.py @@ -57,7 +57,7 @@ class StookalertBinarySensor(BinarySensorEntity): self._api_handler = api_handler @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the attribute(s) of the sensor.""" state_attr = {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/suez_water/sensor.py b/homeassistant/components/suez_water/sensor.py index 3bca3484298..53f6b3e9c14 100644 --- a/homeassistant/components/suez_water/sensor.py +++ b/homeassistant/components/suez_water/sensor.py @@ -73,7 +73,7 @@ class SuezSensor(Entity): return VOLUME_LITERS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/supervisord/sensor.py b/homeassistant/components/supervisord/sensor.py index 8e1d6f89eea..0817f10ed5c 100644 --- a/homeassistant/components/supervisord/sensor.py +++ b/homeassistant/components/supervisord/sensor.py @@ -61,7 +61,7 @@ class SupervisorProcessSensor(Entity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { ATTR_DESCRIPTION: self._info.get("description"), diff --git a/homeassistant/components/surepetcare/binary_sensor.py b/homeassistant/components/surepetcare/binary_sensor.py index 2a624b580ac..64e27669786 100644 --- a/homeassistant/components/surepetcare/binary_sensor.py +++ b/homeassistant/components/surepetcare/binary_sensor.py @@ -151,7 +151,7 @@ class Hub(SurePetcareBinarySensor): return self.available @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.""" attributes = None if self._state: @@ -179,7 +179,7 @@ class Pet(SurePetcareBinarySensor): return False @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.""" attributes = None if self._state: @@ -232,7 +232,7 @@ class DeviceConnectivity(SurePetcareBinarySensor): return self.available @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.""" attributes = None if self._state: diff --git a/homeassistant/components/surepetcare/sensor.py b/homeassistant/components/surepetcare/sensor.py index e2d3d070867..54e7f4d5773 100644 --- a/homeassistant/components/surepetcare/sensor.py +++ b/homeassistant/components/surepetcare/sensor.py @@ -125,7 +125,7 @@ class Flap(SurePetcareSensor): return SureLockStateID(self._state["locking"]["mode"]).name.capitalize() @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.""" attributes = None if self._state: @@ -166,7 +166,7 @@ class SureBattery(SurePetcareSensor): return DEVICE_CLASS_BATTERY @property - def device_state_attributes(self) -> Optional[Dict[str, Any]]: + def extra_state_attributes(self) -> Optional[Dict[str, Any]]: """Return state attributes.""" attributes = None if self._state: diff --git a/homeassistant/components/swiss_hydrological_data/sensor.py b/homeassistant/components/swiss_hydrological_data/sensor.py index 61423312b2a..27071afd112 100644 --- a/homeassistant/components/swiss_hydrological_data/sensor.py +++ b/homeassistant/components/swiss_hydrological_data/sensor.py @@ -119,7 +119,7 @@ class SwissHydrologicalDataSensor(Entity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" attrs = {} diff --git a/homeassistant/components/swiss_public_transport/sensor.py b/homeassistant/components/swiss_public_transport/sensor.py index 2c7fb483eff..1a7b97ce439 100644 --- a/homeassistant/components/swiss_public_transport/sensor.py +++ b/homeassistant/components/swiss_public_transport/sensor.py @@ -94,7 +94,7 @@ class SwissPublicTransportSensor(Entity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._opendata is None: return diff --git a/homeassistant/components/switchbot/switch.py b/homeassistant/components/switchbot/switch.py index 89ba7b5be5e..faf230507a2 100644 --- a/homeassistant/components/switchbot/switch.py +++ b/homeassistant/components/switchbot/switch.py @@ -86,6 +86,6 @@ class SwitchBot(SwitchEntity, RestoreEntity): return self._name @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the state attributes.""" return {"last_run_success": self._last_run_success} diff --git a/homeassistant/components/switcher_kis/switch.py b/homeassistant/components/switcher_kis/switch.py index 6b4b5026c2f..99d50c0c559 100644 --- a/homeassistant/components/switcher_kis/switch.py +++ b/homeassistant/components/switcher_kis/switch.py @@ -139,7 +139,7 @@ class SwitcherControl(SwitchEntity): return self._device_data.power_consumption @property - def device_state_attributes(self) -> Dict: + def extra_state_attributes(self) -> Dict: """Return the optional state attributes.""" attribs = {} diff --git a/homeassistant/components/syncthru/sensor.py b/homeassistant/components/syncthru/sensor.py index 639ec3ac6cb..bfada33bf38 100644 --- a/homeassistant/components/syncthru/sensor.py +++ b/homeassistant/components/syncthru/sensor.py @@ -121,7 +121,7 @@ class SyncThruSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return self._attributes diff --git a/homeassistant/components/synology_dsm/__init__.py b/homeassistant/components/synology_dsm/__init__.py index 50921944a6d..88654f02b21 100644 --- a/homeassistant/components/synology_dsm/__init__.py +++ b/homeassistant/components/synology_dsm/__init__.py @@ -610,7 +610,7 @@ class SynologyDSMBaseEntity(CoordinatorEntity): return self._class @property - def device_state_attributes(self) -> Dict[str, any]: + def extra_state_attributes(self) -> Dict[str, any]: """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/synology_dsm/binary_sensor.py b/homeassistant/components/synology_dsm/binary_sensor.py index 6e89f3d7a84..042e46c636e 100644 --- a/homeassistant/components/synology_dsm/binary_sensor.py +++ b/homeassistant/components/synology_dsm/binary_sensor.py @@ -71,7 +71,7 @@ class SynoDSMSecurityBinarySensor(SynologyDSMBaseEntity, BinarySensorEntity): return bool(self._api.security) @property - def device_state_attributes(self) -> Dict[str, str]: + def extra_state_attributes(self) -> Dict[str, str]: """Return security checks details.""" return self._api.security.status_by_check diff --git a/tests/components/srp_energy/test_sensor.py b/tests/components/srp_energy/test_sensor.py index a93e56b7b93..069dc9eb64f 100644 --- a/tests/components/srp_energy/test_sensor.py +++ b/tests/components/srp_energy/test_sensor.py @@ -91,7 +91,7 @@ async def test_srp_entity(hass): assert srp_entity.icon == ICON assert srp_entity.usage == "2.00" assert srp_entity.should_poll is False - assert srp_entity.device_state_attributes[ATTR_ATTRIBUTION] == ATTRIBUTION + assert srp_entity.extra_state_attributes[ATTR_ATTRIBUTION] == ATTRIBUTION assert srp_entity.available is not None await srp_entity.async_added_to_hass() @@ -104,7 +104,7 @@ async def test_srp_entity_no_data(hass): """Test the SrpEntity.""" fake_coordinator = MagicMock(data=False) srp_entity = SrpEntity(fake_coordinator) - assert srp_entity.device_state_attributes is None + assert srp_entity.extra_state_attributes is None async def test_srp_entity_no_coord_data(hass):