From 14a59d290a3f25e58a705a156945e3853257d9c4 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 11 Mar 2021 20:11:25 +0100 Subject: [PATCH] Update integrations j-o to override extra_state_attributes() (#47758) --- homeassistant/components/homematic/entity.py | 2 +- homeassistant/components/isy994/entity.py | 4 ++-- .../components/jewish_calendar/sensor.py | 4 ++-- .../components/kaiterra/air_quality.py | 2 +- .../components/keba/binary_sensor.py | 2 +- homeassistant/components/keba/sensor.py | 2 +- .../keenetic_ndms2/device_tracker.py | 2 +- homeassistant/components/kef/media_player.py | 2 +- homeassistant/components/kira/sensor.py | 2 +- homeassistant/components/kiwi/lock.py | 2 +- homeassistant/components/knx/binary_sensor.py | 2 +- homeassistant/components/lacrosse/sensor.py | 2 +- homeassistant/components/lastfm/sensor.py | 2 +- .../components/launch_library/sensor.py | 2 +- .../components/linode/binary_sensor.py | 2 +- homeassistant/components/linode/switch.py | 2 +- .../components/linux_battery/sensor.py | 2 +- homeassistant/components/litejet/light.py | 2 +- homeassistant/components/litejet/scene.py | 2 +- homeassistant/components/litejet/switch.py | 2 +- .../components/litterrobot/vacuum.py | 2 +- homeassistant/components/local_file/camera.py | 2 +- .../components/logi_circle/camera.py | 2 +- .../components/logi_circle/sensor.py | 2 +- homeassistant/components/london_air/sensor.py | 2 +- .../components/london_underground/sensor.py | 2 +- homeassistant/components/luftdaten/sensor.py | 2 +- .../components/lutron/binary_sensor.py | 2 +- homeassistant/components/lutron/cover.py | 2 +- homeassistant/components/lutron/light.py | 2 +- homeassistant/components/lutron/switch.py | 4 ++-- .../components/lutron_caseta/__init__.py | 2 +- .../components/lutron_caseta/binary_sensor.py | 2 +- homeassistant/components/lyft/sensor.py | 2 +- .../components/magicseaweed/sensor.py | 2 +- .../components/manual/alarm_control_panel.py | 2 +- .../manual_mqtt/alarm_control_panel.py | 2 +- homeassistant/components/maxcube/climate.py | 2 +- homeassistant/components/melcloud/climate.py | 4 ++-- .../components/melcloud/water_heater.py | 2 +- .../components/meteo_france/sensor.py | 6 ++--- .../components/meteoalarm/binary_sensor.py | 2 +- homeassistant/components/metoffice/sensor.py | 2 +- homeassistant/components/mfi/switch.py | 2 +- homeassistant/components/mhz19/sensor.py | 2 +- .../components/microsoft_face/__init__.py | 2 +- homeassistant/components/miflora/sensor.py | 2 +- .../components/mikrotik/device_tracker.py | 2 +- homeassistant/components/mill/climate.py | 2 +- homeassistant/components/min_max/sensor.py | 2 +- .../components/minecraft_server/__init__.py | 2 +- .../components/minecraft_server/sensor.py | 10 ++++---- .../components/mobile_app/device_tracker.py | 2 +- homeassistant/components/mobile_app/entity.py | 2 +- .../components/modem_callerid/sensor.py | 2 +- .../components/mold_indicator/sensor.py | 2 +- .../components/motion_blinds/cover.py | 2 +- .../components/motion_blinds/sensor.py | 4 ++-- .../mqtt/device_tracker/schema_discovery.py | 24 +++++++++---------- homeassistant/components/mqtt/mixins.py | 2 +- homeassistant/components/mqtt_room/sensor.py | 2 +- homeassistant/components/mvglive/sensor.py | 2 +- homeassistant/components/mychevy/sensor.py | 2 +- homeassistant/components/mysensors/device.py | 2 +- .../components/mysensors/device_tracker.py | 2 +- homeassistant/components/n26/sensor.py | 6 ++--- homeassistant/components/neato/camera.py | 2 +- homeassistant/components/neato/vacuum.py | 2 +- .../nederlandse_spoorwegen/sensor.py | 2 +- homeassistant/components/nello/lock.py | 2 +- homeassistant/components/netatmo/camera.py | 2 +- homeassistant/components/netatmo/climate.py | 2 +- homeassistant/components/netatmo/sensor.py | 2 +- homeassistant/components/nexia/climate.py | 4 ++-- homeassistant/components/nexia/entity.py | 2 +- homeassistant/components/nexia/scene.py | 4 ++-- homeassistant/components/nextbus/sensor.py | 2 +- homeassistant/components/nightscout/sensor.py | 2 +- homeassistant/components/nilu/air_quality.py | 2 +- .../components/nissan_leaf/__init__.py | 2 +- .../components/nissan_leaf/switch.py | 4 ++-- homeassistant/components/nmbs/sensor.py | 4 ++-- homeassistant/components/noaa_tides/sensor.py | 2 +- .../components/norway_air/air_quality.py | 2 +- homeassistant/components/notion/__init__.py | 2 +- .../components/nsw_fuel_station/sensor.py | 2 +- .../geo_location.py | 2 +- homeassistant/components/nuki/lock.py | 2 +- homeassistant/components/nut/sensor.py | 2 +- .../components/nx584/binary_sensor.py | 2 +- .../components/oasa_telematics/sensor.py | 2 +- homeassistant/components/ohmconnect/sensor.py | 2 +- homeassistant/components/omnilogic/common.py | 2 +- .../components/onewire/onewire_entities.py | 2 +- .../components/onkyo/media_player.py | 2 +- .../components/openexchangerates/sensor.py | 2 +- homeassistant/components/opengarage/cover.py | 12 +++++----- homeassistant/components/opensky/sensor.py | 2 +- homeassistant/components/openuv/__init__.py | 2 +- .../openweathermap/abstract_owm_sensor.py | 2 +- .../components/osramlightify/light.py | 2 +- homeassistant/components/ovo_energy/sensor.py | 8 +++---- .../components/owntracks/device_tracker.py | 2 +- homeassistant/components/ozw/climate.py | 4 ++-- homeassistant/components/ozw/entity.py | 2 +- homeassistant/components/ozw/sensor.py | 4 ++-- tests/components/kira/test_sensor.py | 2 +- tests/components/mfi/test_switch.py | 4 ++-- tests/components/mhz19/test_sensor.py | 4 ++-- tests/components/nx584/test_binary_sensor.py | 2 +- 110 files changed, 150 insertions(+), 150 deletions(-) diff --git a/homeassistant/components/homematic/entity.py b/homeassistant/components/homematic/entity.py index bb87d691fc0..3643871c607 100644 --- a/homeassistant/components/homematic/entity.py +++ b/homeassistant/components/homematic/entity.py @@ -71,7 +71,7 @@ class HMDevice(Entity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" # Static attributes attr = { diff --git a/homeassistant/components/isy994/entity.py b/homeassistant/components/isy994/entity.py index a484b56b145..f3dbe579dd8 100644 --- a/homeassistant/components/isy994/entity.py +++ b/homeassistant/components/isy994/entity.py @@ -134,7 +134,7 @@ class ISYNodeEntity(ISYEntity): """Representation of a ISY Nodebase (Node/Group) entity.""" @property - def device_state_attributes(self) -> Dict: + def extra_state_attributes(self) -> Dict: """Get the state attributes for the device. The 'aux_properties' in the pyisy Node class are combined with the @@ -186,7 +186,7 @@ class ISYProgramEntity(ISYEntity): self._actions = actions @property - def device_state_attributes(self) -> Dict: + def extra_state_attributes(self) -> Dict: """Get the state attributes for the device.""" attr = {} if self._actions: diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index 6881f29b963..14336b1f935 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -111,7 +111,7 @@ class JewishCalendarSensor(Entity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._type != "holiday": return {} @@ -153,7 +153,7 @@ class JewishCalendarTimeSensor(JewishCalendarSensor): return DEVICE_CLASS_TIMESTAMP @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {} diff --git a/homeassistant/components/kaiterra/air_quality.py b/homeassistant/components/kaiterra/air_quality.py index ae5df387884..68377d6b254 100644 --- a/homeassistant/components/kaiterra/air_quality.py +++ b/homeassistant/components/kaiterra/air_quality.py @@ -96,7 +96,7 @@ class KaiterraAirQuality(AirQualityEntity): return f"{self._device_id}_air_quality" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" data = {} attributes = [ diff --git a/homeassistant/components/keba/binary_sensor.py b/homeassistant/components/keba/binary_sensor.py index 3fed7bbf5ab..29292470155 100644 --- a/homeassistant/components/keba/binary_sensor.py +++ b/homeassistant/components/keba/binary_sensor.py @@ -71,7 +71,7 @@ class KebaBinarySensor(BinarySensorEntity): return self._is_on @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the binary sensor.""" return self._attributes diff --git a/homeassistant/components/keba/sensor.py b/homeassistant/components/keba/sensor.py index f7993c28393..ed85ccd06a6 100644 --- a/homeassistant/components/keba/sensor.py +++ b/homeassistant/components/keba/sensor.py @@ -114,7 +114,7 @@ class KebaSensor(Entity): return self._unit @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the binary sensor.""" return self._attributes diff --git a/homeassistant/components/keenetic_ndms2/device_tracker.py b/homeassistant/components/keenetic_ndms2/device_tracker.py index 9df222a326c..a8b0f943dd6 100644 --- a/homeassistant/components/keenetic_ndms2/device_tracker.py +++ b/homeassistant/components/keenetic_ndms2/device_tracker.py @@ -207,7 +207,7 @@ class KeeneticTracker(ScannerEntity): return self._router.available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" if self.is_connected: return { diff --git a/homeassistant/components/kef/media_player.py b/homeassistant/components/kef/media_player.py index a36fe11ef65..5316568ab52 100644 --- a/homeassistant/components/kef/media_player.py +++ b/homeassistant/components/kef/media_player.py @@ -395,7 +395,7 @@ class KefMediaPlayer(MediaPlayerEntity): self._update_dsp_task_remover = None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the DSP settings of the KEF device.""" return self._dsp or {} diff --git a/homeassistant/components/kira/sensor.py b/homeassistant/components/kira/sensor.py index 2d6322918c7..a8c49d1c04b 100644 --- a/homeassistant/components/kira/sensor.py +++ b/homeassistant/components/kira/sensor.py @@ -55,7 +55,7 @@ class KiraReceiver(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return {CONF_DEVICE: self._device} diff --git a/homeassistant/components/kiwi/lock.py b/homeassistant/components/kiwi/lock.py index 047eaa1ed3c..6a94cc5a393 100644 --- a/homeassistant/components/kiwi/lock.py +++ b/homeassistant/components/kiwi/lock.py @@ -86,7 +86,7 @@ class KiwiLock(LockEntity): return self._state == STATE_LOCKED @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" return self._device_attrs diff --git a/homeassistant/components/knx/binary_sensor.py b/homeassistant/components/knx/binary_sensor.py index f7ec3e80fa1..ecb79664afd 100644 --- a/homeassistant/components/knx/binary_sensor.py +++ b/homeassistant/components/knx/binary_sensor.py @@ -38,7 +38,7 @@ class KNXBinarySensor(KnxEntity, BinarySensorEntity): return self._device.is_on() @property - def device_state_attributes(self) -> Optional[Dict[str, Any]]: + def extra_state_attributes(self) -> Optional[Dict[str, Any]]: """Return device specific state attributes.""" if self._device.counter is not None: return {ATTR_COUNTER: self._device.counter} diff --git a/homeassistant/components/lacrosse/sensor.py b/homeassistant/components/lacrosse/sensor.py index f65c792ddb0..35cdcecddba 100644 --- a/homeassistant/components/lacrosse/sensor.py +++ b/homeassistant/components/lacrosse/sensor.py @@ -138,7 +138,7 @@ class LaCrosseSensor(Entity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attributes = { "low_battery": self._low_battery, diff --git a/homeassistant/components/lastfm/sensor.py b/homeassistant/components/lastfm/sensor.py index 56124e2c0fe..2f599ad37fd 100644 --- a/homeassistant/components/lastfm/sensor.py +++ b/homeassistant/components/lastfm/sensor.py @@ -107,7 +107,7 @@ class LastfmSensor(Entity): self._state = f"{now_playing.artist} - {now_playing.title}" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/launch_library/sensor.py b/homeassistant/components/launch_library/sensor.py index ef816eef0ba..366cd4e7d44 100644 --- a/homeassistant/components/launch_library/sensor.py +++ b/homeassistant/components/launch_library/sensor.py @@ -76,7 +76,7 @@ class LaunchLibrarySensor(Entity): return "mdi:rocket" @property - def device_state_attributes(self) -> Optional[dict]: + def extra_state_attributes(self) -> Optional[dict]: """Return attributes for the sensor.""" if self.next_launch: return { diff --git a/homeassistant/components/linode/binary_sensor.py b/homeassistant/components/linode/binary_sensor.py index bb81a022891..70a15eaf4e0 100644 --- a/homeassistant/components/linode/binary_sensor.py +++ b/homeassistant/components/linode/binary_sensor.py @@ -75,7 +75,7 @@ class LinodeBinarySensor(BinarySensorEntity): return DEVICE_CLASS_MOVING @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the Linode Node.""" return self._attrs diff --git a/homeassistant/components/linode/switch.py b/homeassistant/components/linode/switch.py index c9207ec1be7..9002cb7bd11 100644 --- a/homeassistant/components/linode/switch.py +++ b/homeassistant/components/linode/switch.py @@ -67,7 +67,7 @@ class LinodeSwitch(SwitchEntity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the Linode Node.""" return self._attrs diff --git a/homeassistant/components/linux_battery/sensor.py b/homeassistant/components/linux_battery/sensor.py index f4d4e92cb78..feefa34a7a7 100644 --- a/homeassistant/components/linux_battery/sensor.py +++ b/homeassistant/components/linux_battery/sensor.py @@ -101,7 +101,7 @@ class LinuxBatterySensor(Entity): return PERCENTAGE @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" if self._system == "android": return { diff --git a/homeassistant/components/litejet/light.py b/homeassistant/components/litejet/light.py index 27ce904cc2c..5248afb4dbd 100644 --- a/homeassistant/components/litejet/light.py +++ b/homeassistant/components/litejet/light.py @@ -85,7 +85,7 @@ class LiteJetLight(LightEntity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" return {ATTR_NUMBER: self._index} diff --git a/homeassistant/components/litejet/scene.py b/homeassistant/components/litejet/scene.py index daadfce90dc..5ae0aec9559 100644 --- a/homeassistant/components/litejet/scene.py +++ b/homeassistant/components/litejet/scene.py @@ -47,7 +47,7 @@ class LiteJetScene(Scene): return f"{self._entry_id}_{self._index}" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device-specific state attributes.""" return {ATTR_NUMBER: self._index} diff --git a/homeassistant/components/litejet/switch.py b/homeassistant/components/litejet/switch.py index b782a4a9d98..343d8393f1c 100644 --- a/homeassistant/components/litejet/switch.py +++ b/homeassistant/components/litejet/switch.py @@ -77,7 +77,7 @@ class LiteJetSwitch(SwitchEntity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device-specific state attributes.""" return {ATTR_NUMBER: self._index} diff --git a/homeassistant/components/litterrobot/vacuum.py b/homeassistant/components/litterrobot/vacuum.py index 4fe76d446f4..a36ef656361 100644 --- a/homeassistant/components/litterrobot/vacuum.py +++ b/homeassistant/components/litterrobot/vacuum.py @@ -111,7 +111,7 @@ class LitterRobotCleaner(LitterRobotEntity, VacuumEntity): raise NotImplementedError() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return { "clean_cycle_wait_time_minutes": self.robot.clean_cycle_wait_time_minutes, diff --git a/homeassistant/components/local_file/camera.py b/homeassistant/components/local_file/camera.py index b0b84677183..c94aeff24b0 100644 --- a/homeassistant/components/local_file/camera.py +++ b/homeassistant/components/local_file/camera.py @@ -105,6 +105,6 @@ class LocalFile(Camera): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the camera state attributes.""" return {"file_path": self._file_path} diff --git a/homeassistant/components/logi_circle/camera.py b/homeassistant/components/logi_circle/camera.py index 20bc829d75d..1afeb190c8b 100644 --- a/homeassistant/components/logi_circle/camera.py +++ b/homeassistant/components/logi_circle/camera.py @@ -125,7 +125,7 @@ class LogiCam(Camera): } @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" state = { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/logi_circle/sensor.py b/homeassistant/components/logi_circle/sensor.py index 4a5fedaf57a..3d980b1dae3 100644 --- a/homeassistant/components/logi_circle/sensor.py +++ b/homeassistant/components/logi_circle/sensor.py @@ -83,7 +83,7 @@ class LogiSensor(Entity): } @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" state = { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/london_air/sensor.py b/homeassistant/components/london_air/sensor.py index a8bebc20cf5..c39d77585a8 100644 --- a/homeassistant/components/london_air/sensor.py +++ b/homeassistant/components/london_air/sensor.py @@ -124,7 +124,7 @@ class AirSensor(Entity): return self.ICON @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return other details about the sensor state.""" attrs = {} attrs["updated"] = self._updated diff --git a/homeassistant/components/london_underground/sensor.py b/homeassistant/components/london_underground/sensor.py index c39ef2885b0..acb605901c9 100644 --- a/homeassistant/components/london_underground/sensor.py +++ b/homeassistant/components/london_underground/sensor.py @@ -78,7 +78,7 @@ class LondonTubeSensor(Entity): return ICON @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return other details about the sensor state.""" self.attrs["Description"] = self._description return self.attrs diff --git a/homeassistant/components/luftdaten/sensor.py b/homeassistant/components/luftdaten/sensor.py index 515d8ad577f..5985c63801e 100644 --- a/homeassistant/components/luftdaten/sensor.py +++ b/homeassistant/components/luftdaten/sensor.py @@ -94,7 +94,7 @@ class LuftdatenSensor(Entity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" self._attrs[ATTR_ATTRIBUTION] = DEFAULT_ATTRIBUTION diff --git a/homeassistant/components/lutron/binary_sensor.py b/homeassistant/components/lutron/binary_sensor.py index f77a2b120da..6fb394d333c 100644 --- a/homeassistant/components/lutron/binary_sensor.py +++ b/homeassistant/components/lutron/binary_sensor.py @@ -49,6 +49,6 @@ class LutronOccupancySensor(LutronDevice, BinarySensorEntity): return f"{self._area_name} Occupancy" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"lutron_integration_id": self._lutron_device.id} diff --git a/homeassistant/components/lutron/cover.py b/homeassistant/components/lutron/cover.py index f1faed32161..6ee53950ef2 100644 --- a/homeassistant/components/lutron/cover.py +++ b/homeassistant/components/lutron/cover.py @@ -64,6 +64,6 @@ class LutronCover(LutronDevice, CoverEntity): _LOGGER.debug("Lutron ID: %d updated to %f", self._lutron_device.id, level) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"lutron_integration_id": self._lutron_device.id} diff --git a/homeassistant/components/lutron/light.py b/homeassistant/components/lutron/light.py index d74d24f71a1..de94b6d6ead 100644 --- a/homeassistant/components/lutron/light.py +++ b/homeassistant/components/lutron/light.py @@ -65,7 +65,7 @@ class LutronLight(LutronDevice, LightEntity): self._lutron_device.level = 0 @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"lutron_integration_id": self._lutron_device.id} diff --git a/homeassistant/components/lutron/switch.py b/homeassistant/components/lutron/switch.py index 21586aaa266..f78f46b6733 100644 --- a/homeassistant/components/lutron/switch.py +++ b/homeassistant/components/lutron/switch.py @@ -42,7 +42,7 @@ class LutronSwitch(LutronDevice, SwitchEntity): self._lutron_device.level = 0 @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"lutron_integration_id": self._lutron_device.id} @@ -75,7 +75,7 @@ class LutronLed(LutronDevice, SwitchEntity): self._lutron_device.state = 0 @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { "keypad": self._keypad_name, diff --git a/homeassistant/components/lutron_caseta/__init__.py b/homeassistant/components/lutron_caseta/__init__.py index 07851db1e23..89eef781c25 100644 --- a/homeassistant/components/lutron_caseta/__init__.py +++ b/homeassistant/components/lutron_caseta/__init__.py @@ -349,7 +349,7 @@ class LutronCasetaDevice(Entity): } @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"device_id": self.device_id, "zone_id": self._device["zone"]} diff --git a/homeassistant/components/lutron_caseta/binary_sensor.py b/homeassistant/components/lutron_caseta/binary_sensor.py index b58afd22a90..c2fc311de43 100644 --- a/homeassistant/components/lutron_caseta/binary_sensor.py +++ b/homeassistant/components/lutron_caseta/binary_sensor.py @@ -69,6 +69,6 @@ class LutronOccupancySensor(LutronCasetaDevice, BinarySensorEntity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"device_id": self.device_id} diff --git a/homeassistant/components/lyft/sensor.py b/homeassistant/components/lyft/sensor.py index 98084b28f0c..872281f685c 100644 --- a/homeassistant/components/lyft/sensor.py +++ b/homeassistant/components/lyft/sensor.py @@ -110,7 +110,7 @@ class LyftSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" params = { "Product ID": self._product["ride_type"], diff --git a/homeassistant/components/magicseaweed/sensor.py b/homeassistant/components/magicseaweed/sensor.py index 9364bee27b2..406f5e53955 100644 --- a/homeassistant/components/magicseaweed/sensor.py +++ b/homeassistant/components/magicseaweed/sensor.py @@ -136,7 +136,7 @@ class MagicSeaweedSensor(Entity): return ICON @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attrs diff --git a/homeassistant/components/manual/alarm_control_panel.py b/homeassistant/components/manual/alarm_control_panel.py index 2313bcace19..00c155615ee 100644 --- a/homeassistant/components/manual/alarm_control_panel.py +++ b/homeassistant/components/manual/alarm_control_panel.py @@ -394,7 +394,7 @@ class ManualAlarm(alarm.AlarmControlPanelEntity, RestoreEntity): return check @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self.state == STATE_ALARM_PENDING or self.state == STATE_ALARM_ARMING: return { diff --git a/homeassistant/components/manual_mqtt/alarm_control_panel.py b/homeassistant/components/manual_mqtt/alarm_control_panel.py index f11938396a7..2fa0e631c1d 100644 --- a/homeassistant/components/manual_mqtt/alarm_control_panel.py +++ b/homeassistant/components/manual_mqtt/alarm_control_panel.py @@ -415,7 +415,7 @@ class ManualMQTTAlarm(alarm.AlarmControlPanelEntity): return check @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self.state != STATE_ALARM_PENDING: return {} diff --git a/homeassistant/components/maxcube/climate.py b/homeassistant/components/maxcube/climate.py index 5db4cc1e7bd..87da5953f26 100644 --- a/homeassistant/components/maxcube/climate.py +++ b/homeassistant/components/maxcube/climate.py @@ -286,7 +286,7 @@ class MaxCubeClimate(ClimateEntity): return @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the optional state attributes.""" cube = self._cubehandle.cube device = cube.device_by_rf(self._rf_address) diff --git a/homeassistant/components/melcloud/climate.py b/homeassistant/components/melcloud/climate.py index 4c409ec5a4d..1abb86cf5e5 100644 --- a/homeassistant/components/melcloud/climate.py +++ b/homeassistant/components/melcloud/climate.py @@ -138,7 +138,7 @@ class AtaDeviceClimate(MelCloudClimate): return self._name @property - def device_state_attributes(self) -> Optional[Dict[str, Any]]: + def extra_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the optional state attributes with device specific additions.""" attr = {} @@ -310,7 +310,7 @@ class AtwDeviceZoneClimate(MelCloudClimate): return f"{self._name} {self._zone.name}" @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the optional state attributes with device specific additions.""" data = { ATTR_STATUS: ATW_ZONE_HVAC_MODE_LOOKUP.get( diff --git a/homeassistant/components/melcloud/water_heater.py b/homeassistant/components/melcloud/water_heater.py index ae10b5140f7..3474fc07540 100644 --- a/homeassistant/components/melcloud/water_heater.py +++ b/homeassistant/components/melcloud/water_heater.py @@ -72,7 +72,7 @@ class AtwWaterHeater(WaterHeaterEntity): await self._device.set({PROPERTY_POWER: False}) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the optional state attributes with device specific additions.""" data = {ATTR_STATUS: self._device.status} return data diff --git a/homeassistant/components/meteo_france/sensor.py b/homeassistant/components/meteo_france/sensor.py index 4802c20c1e5..74b4ab5a6d1 100644 --- a/homeassistant/components/meteo_france/sensor.py +++ b/homeassistant/components/meteo_france/sensor.py @@ -154,7 +154,7 @@ class MeteoFranceSensor(CoordinatorEntity): return SENSOR_TYPES[self._type][ENTITY_ENABLE] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} @@ -177,7 +177,7 @@ class MeteoFranceRainSensor(MeteoFranceSensor): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" reference_dt = self.coordinator.data.forecast[0]["dt"] return { @@ -208,7 +208,7 @@ class MeteoFranceAlertSensor(MeteoFranceSensor): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { **readeable_phenomenoms_dict(self.coordinator.data.phenomenons_max_colors), diff --git a/homeassistant/components/meteoalarm/binary_sensor.py b/homeassistant/components/meteoalarm/binary_sensor.py index 6b13d03ebba..6d237c696f6 100644 --- a/homeassistant/components/meteoalarm/binary_sensor.py +++ b/homeassistant/components/meteoalarm/binary_sensor.py @@ -73,7 +73,7 @@ class MeteoAlertBinarySensor(BinarySensorEntity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION return self._attributes diff --git a/homeassistant/components/metoffice/sensor.py b/homeassistant/components/metoffice/sensor.py index aed763ca4a4..2f4dd72b3a1 100644 --- a/homeassistant/components/metoffice/sensor.py +++ b/homeassistant/components/metoffice/sensor.py @@ -171,7 +171,7 @@ class MetOfficeCurrentSensor(Entity): return SENSOR_TYPES[self._type][1] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/mfi/switch.py b/homeassistant/components/mfi/switch.py index 21963140547..150f81298cd 100644 --- a/homeassistant/components/mfi/switch.py +++ b/homeassistant/components/mfi/switch.py @@ -107,7 +107,7 @@ class MfiSwitch(SwitchEntity): return int(self._port.data.get("active_pwr", 0)) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes for the device.""" return { "volts": round(self._port.data.get("v_rms", 0), 1), diff --git a/homeassistant/components/mhz19/sensor.py b/homeassistant/components/mhz19/sensor.py index e77f17c9140..f26481f9d25 100644 --- a/homeassistant/components/mhz19/sensor.py +++ b/homeassistant/components/mhz19/sensor.py @@ -107,7 +107,7 @@ class MHZ19Sensor(Entity): self._ppm = data.get(SENSOR_CO2) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" result = {} if self._sensor_type == SENSOR_TEMPERATURE and self._ppm is not None: diff --git a/homeassistant/components/microsoft_face/__init__.py b/homeassistant/components/microsoft_face/__init__.py index b9046429603..9f7131d1935 100644 --- a/homeassistant/components/microsoft_face/__init__.py +++ b/homeassistant/components/microsoft_face/__init__.py @@ -231,7 +231,7 @@ class MicrosoftFaceGroupEntity(Entity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" attr = {} for name, p_id in self._api.store[self._id].items(): diff --git a/homeassistant/components/miflora/sensor.py b/homeassistant/components/miflora/sensor.py index fa1d8b57734..8db81ecf5dd 100644 --- a/homeassistant/components/miflora/sensor.py +++ b/homeassistant/components/miflora/sensor.py @@ -189,7 +189,7 @@ class MiFloraSensor(Entity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return {ATTR_LAST_SUCCESSFUL_UPDATE: self.last_successful_update} diff --git a/homeassistant/components/mikrotik/device_tracker.py b/homeassistant/components/mikrotik/device_tracker.py index b9e0b051aba..025eff8d07a 100644 --- a/homeassistant/components/mikrotik/device_tracker.py +++ b/homeassistant/components/mikrotik/device_tracker.py @@ -123,7 +123,7 @@ class MikrotikHubTracker(ScannerEntity): return self.hub.available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" if self.is_connected: return {k: v for k, v in self.device.attrs.items() if k not in FILTER_ATTRS} diff --git a/homeassistant/components/mill/climate.py b/homeassistant/components/mill/climate.py index 0bb94242d64..7a1adc6a0bc 100644 --- a/homeassistant/components/mill/climate.py +++ b/homeassistant/components/mill/climate.py @@ -107,7 +107,7 @@ class MillHeater(ClimateEntity): return self._heater.name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" res = { "open_window": self._heater.open_window, diff --git a/homeassistant/components/min_max/sensor.py b/homeassistant/components/min_max/sensor.py index d2ffb9f5ec0..5bea9379690 100644 --- a/homeassistant/components/min_max/sensor.py +++ b/homeassistant/components/min_max/sensor.py @@ -188,7 +188,7 @@ class MinMaxSensor(Entity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return { attr: getattr(self, attr) diff --git a/homeassistant/components/minecraft_server/__init__.py b/homeassistant/components/minecraft_server/__init__.py index 164bb264f90..0e7096881f5 100644 --- a/homeassistant/components/minecraft_server/__init__.py +++ b/homeassistant/components/minecraft_server/__init__.py @@ -246,7 +246,7 @@ class MinecraftServerEntity(Entity): "sw_version": self._server.protocol_version, } self._device_class = device_class - self._device_state_attributes = None + self._extra_state_attributes = None self._disconnect_dispatcher = None @property diff --git a/homeassistant/components/minecraft_server/sensor.py b/homeassistant/components/minecraft_server/sensor.py index 171ff9d1701..8cc626390dd 100644 --- a/homeassistant/components/minecraft_server/sensor.py +++ b/homeassistant/components/minecraft_server/sensor.py @@ -141,19 +141,19 @@ class MinecraftServerPlayersOnlineSensor(MinecraftServerSensorEntity): """Update online players state and device state attributes.""" self._state = self._server.players_online - device_state_attributes = None + extra_state_attributes = None players_list = self._server.players_list if players_list is not None: if len(players_list) != 0: - device_state_attributes = {ATTR_PLAYERS_LIST: self._server.players_list} + extra_state_attributes = {ATTR_PLAYERS_LIST: self._server.players_list} - self._device_state_attributes = device_state_attributes + self._extra_state_attributes = extra_state_attributes @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return players list in device state attributes.""" - return self._device_state_attributes + return self._extra_state_attributes class MinecraftServerPlayersMaxSensor(MinecraftServerSensorEntity): diff --git a/homeassistant/components/mobile_app/device_tracker.py b/homeassistant/components/mobile_app/device_tracker.py index f0cd30074fa..1b006f69827 100644 --- a/homeassistant/components/mobile_app/device_tracker.py +++ b/homeassistant/components/mobile_app/device_tracker.py @@ -56,7 +56,7 @@ class MobileAppEntity(TrackerEntity, RestoreEntity): return self._data.get(ATTR_BATTERY) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific attributes.""" attrs = {} for key in ATTR_KEYS: diff --git a/homeassistant/components/mobile_app/entity.py b/homeassistant/components/mobile_app/entity.py index 748f680da5e..2f30c4b9f1b 100644 --- a/homeassistant/components/mobile_app/entity.py +++ b/homeassistant/components/mobile_app/entity.py @@ -81,7 +81,7 @@ class MobileAppEntity(RestoreEntity): return self._config.get(ATTR_SENSOR_DEVICE_CLASS) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" return self._config[ATTR_SENSOR_ATTRIBUTES] diff --git a/homeassistant/components/modem_callerid/sensor.py b/homeassistant/components/modem_callerid/sensor.py index c58a4b67eed..f91b6d7a169 100644 --- a/homeassistant/components/modem_callerid/sensor.py +++ b/homeassistant/components/modem_callerid/sensor.py @@ -86,7 +86,7 @@ class ModemCalleridSensor(Entity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/mold_indicator/sensor.py b/homeassistant/components/mold_indicator/sensor.py index e2d9909c7ca..126b57cb412 100644 --- a/homeassistant/components/mold_indicator/sensor.py +++ b/homeassistant/components/mold_indicator/sensor.py @@ -375,7 +375,7 @@ class MoldIndicator(Entity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._is_metric: return { diff --git a/homeassistant/components/motion_blinds/cover.py b/homeassistant/components/motion_blinds/cover.py index 3087401c3ae..4ac09a5fd11 100644 --- a/homeassistant/components/motion_blinds/cover.py +++ b/homeassistant/components/motion_blinds/cover.py @@ -294,7 +294,7 @@ class MotionTDBUDevice(MotionPositionDevice): return self._blind.position[self._motor_key] == 100 @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" attributes = {} if self._blind.position is not None: diff --git a/homeassistant/components/motion_blinds/sensor.py b/homeassistant/components/motion_blinds/sensor.py index f8a673b3079..9f80c85b959 100644 --- a/homeassistant/components/motion_blinds/sensor.py +++ b/homeassistant/components/motion_blinds/sensor.py @@ -88,7 +88,7 @@ class MotionBatterySensor(CoordinatorEntity, Entity): return self._blind.battery_level @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return {ATTR_BATTERY_VOLTAGE: self._blind.battery_voltage} @@ -134,7 +134,7 @@ class MotionTDBUBatterySensor(MotionBatterySensor): return self._blind.battery_level[self._motor[0]] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" attributes = {} if self._blind.battery_voltage is not None: diff --git a/homeassistant/components/mqtt/device_tracker/schema_discovery.py b/homeassistant/components/mqtt/device_tracker/schema_discovery.py index a1279f512a5..d6688636bb2 100644 --- a/homeassistant/components/mqtt/device_tracker/schema_discovery.py +++ b/homeassistant/components/mqtt/device_tracker/schema_discovery.py @@ -109,32 +109,32 @@ class MqttDeviceTracker(MqttEntity, TrackerEntity): @property def latitude(self): - """Return latitude if provided in device_state_attributes or None.""" + """Return latitude if provided in extra_state_attributes or None.""" if ( - self.device_state_attributes is not None - and ATTR_LATITUDE in self.device_state_attributes + self.extra_state_attributes is not None + and ATTR_LATITUDE in self.extra_state_attributes ): - return self.device_state_attributes[ATTR_LATITUDE] + return self.extra_state_attributes[ATTR_LATITUDE] return None @property def location_accuracy(self): - """Return location accuracy if provided in device_state_attributes or None.""" + """Return location accuracy if provided in extra_state_attributes or None.""" if ( - self.device_state_attributes is not None - and ATTR_GPS_ACCURACY in self.device_state_attributes + self.extra_state_attributes is not None + and ATTR_GPS_ACCURACY in self.extra_state_attributes ): - return self.device_state_attributes[ATTR_GPS_ACCURACY] + return self.extra_state_attributes[ATTR_GPS_ACCURACY] return None @property def longitude(self): - """Return longitude if provided in device_state_attributes or None.""" + """Return longitude if provided in extra_state_attributes or None.""" if ( - self.device_state_attributes is not None - and ATTR_LONGITUDE in self.device_state_attributes + self.extra_state_attributes is not None + and ATTR_LONGITUDE in self.extra_state_attributes ): - return self.device_state_attributes[ATTR_LONGITUDE] + return self.extra_state_attributes[ATTR_LONGITUDE] return None @property diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index 8bcb5e5ca97..898072de5f9 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -229,7 +229,7 @@ class MqttAttributes(Entity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/mqtt_room/sensor.py b/homeassistant/components/mqtt_room/sensor.py index 3b61003e601..e15dfd179da 100644 --- a/homeassistant/components/mqtt_room/sensor.py +++ b/homeassistant/components/mqtt_room/sensor.py @@ -135,7 +135,7 @@ class MQTTRoomSensor(Entity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_DISTANCE: self._distance} diff --git a/homeassistant/components/mvglive/sensor.py b/homeassistant/components/mvglive/sensor.py index 2ceca024a6f..15b0d2d218e 100644 --- a/homeassistant/components/mvglive/sensor.py +++ b/homeassistant/components/mvglive/sensor.py @@ -114,7 +114,7 @@ class MVGLiveSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" dep = self.data.departures if not dep: diff --git a/homeassistant/components/mychevy/sensor.py b/homeassistant/components/mychevy/sensor.py index df8b136741a..832f1a03f25 100644 --- a/homeassistant/components/mychevy/sensor.py +++ b/homeassistant/components/mychevy/sensor.py @@ -172,7 +172,7 @@ class EVSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return all the state attributes.""" return self._state_attributes diff --git a/homeassistant/components/mysensors/device.py b/homeassistant/components/mysensors/device.py index 25b892d70b3..d5ae6c0c156 100644 --- a/homeassistant/components/mysensors/device.py +++ b/homeassistant/components/mysensors/device.py @@ -122,7 +122,7 @@ class MySensorsDevice: return f"{self.node_name} {self.child_id}" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" node = self.gateway.sensors[self.node_id] child = node.children[self.child_id] diff --git a/homeassistant/components/mysensors/device_tracker.py b/homeassistant/components/mysensors/device_tracker.py index d1f89e4fe04..068029af960 100644 --- a/homeassistant/components/mysensors/device_tracker.py +++ b/homeassistant/components/mysensors/device_tracker.py @@ -72,5 +72,5 @@ class MySensorsDeviceScanner(mysensors.device.MySensorsDevice): host_name=self.name, gps=(latitude, longitude), battery=node.battery_level, - attributes=self.device_state_attributes, + attributes=self.extra_state_attributes, ) diff --git a/homeassistant/components/n26/sensor.py b/homeassistant/components/n26/sensor.py index b9a8b21f9d0..df687d9689a 100644 --- a/homeassistant/components/n26/sensor.py +++ b/homeassistant/components/n26/sensor.py @@ -86,7 +86,7 @@ class N26Account(Entity): return self._data.balance.get("currency") @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Additional attributes of the sensor.""" attributes = { ATTR_IBAN: self._data.balance.get("iban"), @@ -147,7 +147,7 @@ class N26Card(Entity): return self._card["status"] @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Additional attributes of the sensor.""" attributes = { "apple_pay_eligible": self._card.get("applePayEligible"), @@ -220,7 +220,7 @@ class N26Space(Entity): return self._space["balance"]["currency"] @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Additional attributes of the sensor.""" goal_value = "" if "goal" in self._space: diff --git a/homeassistant/components/neato/camera.py b/homeassistant/components/neato/camera.py index 1698a1d944a..74a3cb4bc77 100644 --- a/homeassistant/components/neato/camera.py +++ b/homeassistant/components/neato/camera.py @@ -126,7 +126,7 @@ class NeatoCleaningMap(Camera): return {"identifiers": {(NEATO_DOMAIN, self._robot_serial)}} @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the vacuum cleaner.""" data = {} diff --git a/homeassistant/components/neato/vacuum.py b/homeassistant/components/neato/vacuum.py index ce4156244b7..3b6711d3b72 100644 --- a/homeassistant/components/neato/vacuum.py +++ b/homeassistant/components/neato/vacuum.py @@ -284,7 +284,7 @@ class NeatoConnectedVacuum(StateVacuumEntity): return self._robot_serial @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the vacuum cleaner.""" data = {} diff --git a/homeassistant/components/nederlandse_spoorwegen/sensor.py b/homeassistant/components/nederlandse_spoorwegen/sensor.py index 3d15e3c4d9b..7d90c2c3c0d 100644 --- a/homeassistant/components/nederlandse_spoorwegen/sensor.py +++ b/homeassistant/components/nederlandse_spoorwegen/sensor.py @@ -124,7 +124,7 @@ class NSDepartureSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if not self._trips: return diff --git a/homeassistant/components/nello/lock.py b/homeassistant/components/nello/lock.py index 61241660847..93e63b05da9 100644 --- a/homeassistant/components/nello/lock.py +++ b/homeassistant/components/nello/lock.py @@ -48,7 +48,7 @@ class NelloLock(LockEntity): return True @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" return self._device_attrs diff --git a/homeassistant/components/netatmo/camera.py b/homeassistant/components/netatmo/camera.py index 5163c9582b0..b02d77e45fb 100644 --- a/homeassistant/components/netatmo/camera.py +++ b/homeassistant/components/netatmo/camera.py @@ -217,7 +217,7 @@ class NetatmoCamera(NetatmoBase, Camera): return response.content @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the Netatmo-specific camera state attributes.""" return { "id": self._id, diff --git a/homeassistant/components/netatmo/climate.py b/homeassistant/components/netatmo/climate.py index d12ee9263db..c2a6e484771 100644 --- a/homeassistant/components/netatmo/climate.py +++ b/homeassistant/components/netatmo/climate.py @@ -418,7 +418,7 @@ class NetatmoThermostat(NetatmoBase, ClimateEntity): self.async_write_ha_state() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the thermostat.""" attr = {} diff --git a/homeassistant/components/netatmo/sensor.py b/homeassistant/components/netatmo/sensor.py index efda94d6399..ac86e86b960 100644 --- a/homeassistant/components/netatmo/sensor.py +++ b/homeassistant/components/netatmo/sensor.py @@ -536,7 +536,7 @@ class NetatmoPublicSensor(NetatmoBase): return self._device_class @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the attributes of the device.""" attrs = {} diff --git a/homeassistant/components/nexia/climate.py b/homeassistant/components/nexia/climate.py index 2b3f7de4489..4084f4d297c 100644 --- a/homeassistant/components/nexia/climate.py +++ b/homeassistant/components/nexia/climate.py @@ -354,9 +354,9 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity): return self._thermostat.is_emergency_heat_active() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" - data = super().device_state_attributes + data = super().extra_state_attributes data[ATTR_ZONE_STATUS] = self._zone.get_status() diff --git a/homeassistant/components/nexia/entity.py b/homeassistant/components/nexia/entity.py index 62f6e8275c4..fc69c7ef389 100644 --- a/homeassistant/components/nexia/entity.py +++ b/homeassistant/components/nexia/entity.py @@ -33,7 +33,7 @@ class NexiaEntity(CoordinatorEntity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/nexia/scene.py b/homeassistant/components/nexia/scene.py index d3a6691d59e..495a8fb4d3a 100644 --- a/homeassistant/components/nexia/scene.py +++ b/homeassistant/components/nexia/scene.py @@ -41,9 +41,9 @@ class NexiaAutomationScene(NexiaEntity, Scene): self._automation = automation @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the scene specific state attributes.""" - data = super().device_state_attributes + data = super().extra_state_attributes data[ATTR_DESCRIPTION] = self._automation.description return data diff --git a/homeassistant/components/nextbus/sensor.py b/homeassistant/components/nextbus/sensor.py index 2b5da2a97fa..3357d84fd69 100644 --- a/homeassistant/components/nextbus/sensor.py +++ b/homeassistant/components/nextbus/sensor.py @@ -156,7 +156,7 @@ class NextBusDepartureSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return additional state attributes.""" return self._attributes diff --git a/homeassistant/components/nightscout/sensor.py b/homeassistant/components/nightscout/sensor.py index efa625577d9..53f13f3b69b 100644 --- a/homeassistant/components/nightscout/sensor.py +++ b/homeassistant/components/nightscout/sensor.py @@ -115,6 +115,6 @@ class NightscoutSensor(Entity): return switcher.get(self._attributes[ATTR_DIRECTION], "mdi:cloud-question") @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/nilu/air_quality.py b/homeassistant/components/nilu/air_quality.py index 8e851592de3..d6fcad3ac7e 100644 --- a/homeassistant/components/nilu/air_quality.py +++ b/homeassistant/components/nilu/air_quality.py @@ -175,7 +175,7 @@ class NiluSensor(AirQualityEntity): return ATTRIBUTION @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return other details about the sensor state.""" return self._attrs diff --git a/homeassistant/components/nissan_leaf/__init__.py b/homeassistant/components/nissan_leaf/__init__.py index bace7f14556..967857aedc5 100644 --- a/homeassistant/components/nissan_leaf/__init__.py +++ b/homeassistant/components/nissan_leaf/__init__.py @@ -450,7 +450,7 @@ class LeafEntity(Entity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return default attributes for Nissan leaf entities.""" return { "next_update": self.car.next_update, diff --git a/homeassistant/components/nissan_leaf/switch.py b/homeassistant/components/nissan_leaf/switch.py index d95d3e4ed39..2b8d557c2dd 100644 --- a/homeassistant/components/nissan_leaf/switch.py +++ b/homeassistant/components/nissan_leaf/switch.py @@ -37,9 +37,9 @@ class LeafClimateSwitch(LeafEntity, ToggleEntity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return climate control attributes.""" - attrs = super().device_state_attributes + attrs = super().extra_state_attributes attrs["updated_on"] = self.car.last_climate_response return attrs diff --git a/homeassistant/components/nmbs/sensor.py b/homeassistant/components/nmbs/sensor.py index bdf4658434c..ac6753ce0d6 100644 --- a/homeassistant/components/nmbs/sensor.py +++ b/homeassistant/components/nmbs/sensor.py @@ -126,7 +126,7 @@ class NMBSLiveBoard(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the sensor attributes if data is available.""" if self._state is None or not self._attrs: return None @@ -202,7 +202,7 @@ class NMBSSensor(Entity): return "mdi:train" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return sensor attributes if data is available.""" if self._state is None or not self._attrs: return None diff --git a/homeassistant/components/noaa_tides/sensor.py b/homeassistant/components/noaa_tides/sensor.py index 0759c5093c8..b6771d9293a 100644 --- a/homeassistant/components/noaa_tides/sensor.py +++ b/homeassistant/components/noaa_tides/sensor.py @@ -90,7 +90,7 @@ class NOAATidesAndCurrentsSensor(Entity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of this device.""" attr = {ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION} if self.data is None: diff --git a/homeassistant/components/norway_air/air_quality.py b/homeassistant/components/norway_air/air_quality.py index 8e6c13260e5..788f900ef70 100644 --- a/homeassistant/components/norway_air/air_quality.py +++ b/homeassistant/components/norway_air/air_quality.py @@ -80,7 +80,7 @@ class AirSensor(AirQualityEntity): return ATTRIBUTION @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return other details about the sensor state.""" return { "level": self._api.data.get("level"), diff --git a/homeassistant/components/notion/__init__.py b/homeassistant/components/notion/__init__.py index c2cbdb85289..c8c385143cf 100644 --- a/homeassistant/components/notion/__init__.py +++ b/homeassistant/components/notion/__init__.py @@ -180,7 +180,7 @@ class NotionEntity(CoordinatorEntity): return self._device_class @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the state attributes.""" return self._attrs diff --git a/homeassistant/components/nsw_fuel_station/sensor.py b/homeassistant/components/nsw_fuel_station/sensor.py index b6c0d1a5d9b..0bf82c1d162 100644 --- a/homeassistant/components/nsw_fuel_station/sensor.py +++ b/homeassistant/components/nsw_fuel_station/sensor.py @@ -168,7 +168,7 @@ class StationPriceSensor(Entity): return None @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the state attributes of the device.""" return { ATTR_STATION_ID: self._station_data.station_id, diff --git a/homeassistant/components/nsw_rural_fire_service_feed/geo_location.py b/homeassistant/components/nsw_rural_fire_service_feed/geo_location.py index 12ae9d8990a..0467b9cc353 100644 --- a/homeassistant/components/nsw_rural_fire_service_feed/geo_location.py +++ b/homeassistant/components/nsw_rural_fire_service_feed/geo_location.py @@ -284,7 +284,7 @@ class NswRuralFireServiceLocationEvent(GeolocationEvent): return LENGTH_KILOMETERS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" attributes = {} for key, value in ( diff --git a/homeassistant/components/nuki/lock.py b/homeassistant/components/nuki/lock.py index 818784a2b2e..360153d14fe 100644 --- a/homeassistant/components/nuki/lock.py +++ b/homeassistant/components/nuki/lock.py @@ -99,7 +99,7 @@ class NukiDeviceEntity(LockEntity, ABC): """Return true if lock is locked.""" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" data = { ATTR_BATTERY_CRITICAL: self._nuki_device.battery_critical, diff --git a/homeassistant/components/nut/sensor.py b/homeassistant/components/nut/sensor.py index 174405e22e2..d4fdd03adc8 100644 --- a/homeassistant/components/nut/sensor.py +++ b/homeassistant/components/nut/sensor.py @@ -160,7 +160,7 @@ class NUTSensor(CoordinatorEntity): return self._unit @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the sensor attributes.""" return {ATTR_STATE: _format_display_state(self._data.status)} diff --git a/homeassistant/components/nx584/binary_sensor.py b/homeassistant/components/nx584/binary_sensor.py index 2db3531f879..058ac6c5795 100644 --- a/homeassistant/components/nx584/binary_sensor.py +++ b/homeassistant/components/nx584/binary_sensor.py @@ -105,7 +105,7 @@ class NX584ZoneSensor(BinarySensorEntity): return self._zone["state"] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"zone_number": self._zone["number"]} diff --git a/homeassistant/components/oasa_telematics/sensor.py b/homeassistant/components/oasa_telematics/sensor.py index 4bf6b395d5f..8af74b5cd0e 100644 --- a/homeassistant/components/oasa_telematics/sensor.py +++ b/homeassistant/components/oasa_telematics/sensor.py @@ -79,7 +79,7 @@ class OASATelematicsSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" params = {} if self._times is not None: diff --git a/homeassistant/components/ohmconnect/sensor.py b/homeassistant/components/ohmconnect/sensor.py index 7c7331990ea..6c7c04b25cb 100644 --- a/homeassistant/components/ohmconnect/sensor.py +++ b/homeassistant/components/ohmconnect/sensor.py @@ -56,7 +56,7 @@ class OhmconnectSensor(Entity): return "Inactive" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"Address": self._data.get("address"), "ID": self._ohmid} diff --git a/homeassistant/components/omnilogic/common.py b/homeassistant/components/omnilogic/common.py index 791d81b6757..6f7ee6e5eb5 100644 --- a/homeassistant/components/omnilogic/common.py +++ b/homeassistant/components/omnilogic/common.py @@ -141,7 +141,7 @@ class OmniLogicEntity(CoordinatorEntity): return self._icon @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the attributes.""" return self._attrs diff --git a/homeassistant/components/onewire/onewire_entities.py b/homeassistant/components/onewire/onewire_entities.py index 9238bb5d32c..724783b5686 100644 --- a/homeassistant/components/onewire/onewire_entities.py +++ b/homeassistant/components/onewire/onewire_entities.py @@ -58,7 +58,7 @@ class OneWireBaseEntity(Entity): return self._unit_of_measurement @property - def device_state_attributes(self) -> Optional[Dict[str, Any]]: + def extra_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the state attributes of the entity.""" return {"device_file": self._device_file, "raw_value": self._value_raw} diff --git a/homeassistant/components/onkyo/media_player.py b/homeassistant/components/onkyo/media_player.py index 7ac9b5fdfc6..3d882884aa2 100644 --- a/homeassistant/components/onkyo/media_player.py +++ b/homeassistant/components/onkyo/media_player.py @@ -392,7 +392,7 @@ class OnkyoDevice(MediaPlayerEntity): return self._source_list @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return self._attributes diff --git a/homeassistant/components/openexchangerates/sensor.py b/homeassistant/components/openexchangerates/sensor.py index 9846e305291..f3f0d825ff6 100644 --- a/homeassistant/components/openexchangerates/sensor.py +++ b/homeassistant/components/openexchangerates/sensor.py @@ -79,7 +79,7 @@ class OpenexchangeratesSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return other attributes of the sensor.""" attr = self.rest.data attr[ATTR_ATTRIBUTION] = ATTRIBUTION diff --git a/homeassistant/components/opengarage/cover.py b/homeassistant/components/opengarage/cover.py index cf6825c867b..154cb4df3ae 100644 --- a/homeassistant/components/opengarage/cover.py +++ b/homeassistant/components/opengarage/cover.py @@ -92,7 +92,7 @@ class OpenGarageCover(CoverEntity): self._open_garage = open_garage self._state = None self._state_before_move = None - self._device_state_attributes = {} + self._extra_state_attributes = {} self._available = True self._device_id = device_id @@ -107,9 +107,9 @@ class OpenGarageCover(CoverEntity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" - return self._device_state_attributes + return self._extra_state_attributes @property def is_closed(self): @@ -154,11 +154,11 @@ class OpenGarageCover(CoverEntity): _LOGGER.debug("%s status: %s", self._name, self._state) if status.get("rssi") is not None: - self._device_state_attributes[ATTR_SIGNAL_STRENGTH] = status.get("rssi") + self._extra_state_attributes[ATTR_SIGNAL_STRENGTH] = status.get("rssi") if status.get("dist") is not None: - self._device_state_attributes[ATTR_DISTANCE_SENSOR] = status.get("dist") + self._extra_state_attributes[ATTR_DISTANCE_SENSOR] = status.get("dist") if self._state is not None: - self._device_state_attributes[ATTR_DOOR_STATE] = self._state + self._extra_state_attributes[ATTR_DOOR_STATE] = self._state self._available = True diff --git a/homeassistant/components/opensky/sensor.py b/homeassistant/components/opensky/sensor.py index 06132e83e88..e5ffb2384f5 100644 --- a/homeassistant/components/opensky/sensor.py +++ b/homeassistant/components/opensky/sensor.py @@ -174,7 +174,7 @@ class OpenSkySensor(Entity): self._previously_tracked = currently_tracked @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: OPENSKY_ATTRIBUTION} diff --git a/homeassistant/components/openuv/__init__.py b/homeassistant/components/openuv/__init__.py index 387b7547514..aeefe435845 100644 --- a/homeassistant/components/openuv/__init__.py +++ b/homeassistant/components/openuv/__init__.py @@ -187,7 +187,7 @@ class OpenUvEntity(Entity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attrs diff --git a/homeassistant/components/openweathermap/abstract_owm_sensor.py b/homeassistant/components/openweathermap/abstract_owm_sensor.py index 809d2c2e572..a69f542589b 100644 --- a/homeassistant/components/openweathermap/abstract_owm_sensor.py +++ b/homeassistant/components/openweathermap/abstract_owm_sensor.py @@ -57,7 +57,7 @@ class AbstractOpenWeatherMapSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/osramlightify/light.py b/homeassistant/components/osramlightify/light.py index 49c32da69bc..e01ad970488 100644 --- a/homeassistant/components/osramlightify/light.py +++ b/homeassistant/components/osramlightify/light.py @@ -269,7 +269,7 @@ class Luminary(LightEntity): return self._unique_id @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return self._device_attributes diff --git a/homeassistant/components/ovo_energy/sensor.py b/homeassistant/components/ovo_energy/sensor.py index 2f2e1b8dd50..3171b3231dc 100644 --- a/homeassistant/components/ovo_energy/sensor.py +++ b/homeassistant/components/ovo_energy/sensor.py @@ -100,7 +100,7 @@ class OVOEnergyLastElectricityReading(OVOEnergySensor): return usage.electricity[-1].consumption @property - def device_state_attributes(self) -> object: + def extra_state_attributes(self) -> object: """Return the attributes of the sensor.""" usage: OVODailyUsage = self.coordinator.data if usage is None or not usage.electricity: @@ -135,7 +135,7 @@ class OVOEnergyLastGasReading(OVOEnergySensor): return usage.gas[-1].consumption @property - def device_state_attributes(self) -> object: + def extra_state_attributes(self) -> object: """Return the attributes of the sensor.""" usage: OVODailyUsage = self.coordinator.data if usage is None or not usage.gas: @@ -171,7 +171,7 @@ class OVOEnergyLastElectricityCost(OVOEnergySensor): return usage.electricity[-1].cost.amount @property - def device_state_attributes(self) -> object: + def extra_state_attributes(self) -> object: """Return the attributes of the sensor.""" usage: OVODailyUsage = self.coordinator.data if usage is None or not usage.electricity: @@ -207,7 +207,7 @@ class OVOEnergyLastGasCost(OVOEnergySensor): return usage.gas[-1].cost.amount @property - def device_state_attributes(self) -> object: + def extra_state_attributes(self) -> object: """Return the attributes of the sensor.""" usage: OVODailyUsage = self.coordinator.data if usage is None or not usage.gas: diff --git a/homeassistant/components/owntracks/device_tracker.py b/homeassistant/components/owntracks/device_tracker.py index 8a8fdc52fb1..d50e5b9c414 100644 --- a/homeassistant/components/owntracks/device_tracker.py +++ b/homeassistant/components/owntracks/device_tracker.py @@ -74,7 +74,7 @@ class OwnTracksEntity(TrackerEntity, RestoreEntity): return self._data.get("battery") @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific attributes.""" return self._data.get("attributes") diff --git a/homeassistant/components/ozw/climate.py b/homeassistant/components/ozw/climate.py index a74fd869f0f..a6532af4d26 100644 --- a/homeassistant/components/ozw/climate.py +++ b/homeassistant/components/ozw/climate.py @@ -308,9 +308,9 @@ class ZWaveClimateEntity(ZWaveDeviceEntity, ClimateEntity): self.values.mode.send_value(preset_mode_value) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the optional state attributes.""" - data = super().device_state_attributes + data = super().extra_state_attributes if self.values.fan_action: data[ATTR_FAN_ACTION] = self.values.fan_action.value if self.values.valve_position: diff --git a/homeassistant/components/ozw/entity.py b/homeassistant/components/ozw/entity.py index c1cb9617a5c..305601a2333 100644 --- a/homeassistant/components/ozw/entity.py +++ b/homeassistant/components/ozw/entity.py @@ -209,7 +209,7 @@ class ZWaveDeviceEntity(Entity): return device_info @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" return {const.ATTR_NODE_ID: self.values.primary.node.node_id} diff --git a/homeassistant/components/ozw/sensor.py b/homeassistant/components/ozw/sensor.py index 5bd0d1c482f..db695bcf6bc 100644 --- a/homeassistant/components/ozw/sensor.py +++ b/homeassistant/components/ozw/sensor.py @@ -149,9 +149,9 @@ class ZWaveListSensor(ZwaveSensorBase): return self.values.primary.value["Selected_id"] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" - attributes = super().device_state_attributes + attributes = super().extra_state_attributes # add the value's label as property attributes["label"] = self.values.primary.value["Selected"] return attributes diff --git a/tests/components/kira/test_sensor.py b/tests/components/kira/test_sensor.py index cd4bee60ae6..b835a25ae90 100644 --- a/tests/components/kira/test_sensor.py +++ b/tests/components/kira/test_sensor.py @@ -47,4 +47,4 @@ class TestKiraSensor(unittest.TestCase): sensor._update_callback(codeTuple) assert sensor.state == codeName - assert sensor.device_state_attributes == {kira.CONF_DEVICE: deviceName} + assert sensor.extra_state_attributes == {kira.CONF_DEVICE: deviceName} diff --git a/tests/components/mfi/test_switch.py b/tests/components/mfi/test_switch.py index 0409a4f387a..1e9f56853c3 100644 --- a/tests/components/mfi/test_switch.py +++ b/tests/components/mfi/test_switch.py @@ -118,7 +118,7 @@ async def test_current_power_w_no_data(port, switch): assert switch.current_power_w == 0 -async def test_device_state_attributes(port, switch): +async def test_extra_state_attributes(port, switch): """Test the state attributes.""" port.data = {"v_rms": 1.25, "i_rms": 2.75} - assert switch.device_state_attributes == {"volts": 1.2, "amps": 2.8} + assert switch.extra_state_attributes == {"volts": 1.2, "amps": 2.8} diff --git a/tests/components/mhz19/test_sensor.py b/tests/components/mhz19/test_sensor.py index 5b6e1e9fa37..e827b5dfbd2 100644 --- a/tests/components/mhz19/test_sensor.py +++ b/tests/components/mhz19/test_sensor.py @@ -93,7 +93,7 @@ async def test_co2_sensor(mock_function): assert sensor.state == 1000 assert sensor.unit_of_measurement == CONCENTRATION_PARTS_PER_MILLION assert sensor.should_poll - assert sensor.device_state_attributes == {"temperature": 24} + assert sensor.extra_state_attributes == {"temperature": 24} @patch("pmsensor.co2sensor.read_mh_z19_with_temperature", return_value=(1000, 24)) @@ -107,7 +107,7 @@ async def test_temperature_sensor(mock_function): assert sensor.state == 24 assert sensor.unit_of_measurement == TEMP_CELSIUS assert sensor.should_poll - assert sensor.device_state_attributes == {"co2_concentration": 1000} + assert sensor.extra_state_attributes == {"co2_concentration": 1000} @patch("pmsensor.co2sensor.read_mh_z19_with_temperature", return_value=(1000, 24)) diff --git a/tests/components/nx584/test_binary_sensor.py b/tests/components/nx584/test_binary_sensor.py index c12e8e24ebc..d6d410b3700 100644 --- a/tests/components/nx584/test_binary_sensor.py +++ b/tests/components/nx584/test_binary_sensor.py @@ -146,7 +146,7 @@ def test_nx584_zone_sensor_normal(): assert "foo" == sensor.name assert not sensor.should_poll assert sensor.is_on - assert sensor.device_state_attributes["zone_number"] == 1 + assert sensor.extra_state_attributes["zone_number"] == 1 zone["state"] = False assert not sensor.is_on