From 1fc8e32d8662c1cdc4b097c9ffc3dd98e16af654 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 11 Mar 2021 20:16:26 +0100 Subject: [PATCH] Update integrations t-z to override extra_state_attributes() (#47760) --- .../components/tado/binary_sensor.py | 2 +- homeassistant/components/tado/climate.py | 2 +- homeassistant/components/tado/sensor.py | 4 +-- homeassistant/components/tahoma/__init__.py | 2 +- .../components/tahoma/binary_sensor.py | 4 +-- homeassistant/components/tahoma/cover.py | 4 +-- homeassistant/components/tahoma/lock.py | 4 +-- homeassistant/components/tahoma/scene.py | 2 +- homeassistant/components/tahoma/sensor.py | 4 +-- homeassistant/components/tahoma/switch.py | 4 +-- .../components/tank_utility/sensor.py | 2 +- .../components/tankerkoenig/sensor.py | 2 +- homeassistant/components/tautulli/sensor.py | 2 +- homeassistant/components/tellduslive/entry.py | 2 +- .../components/template/template_entity.py | 2 +- .../components/tensorflow/image_processing.py | 2 +- homeassistant/components/tesla/__init__.py | 2 +- .../components/tesla/device_tracker.py | 4 +-- homeassistant/components/tesla/sensor.py | 2 +- .../components/thermoworks_smoke/sensor.py | 2 +- .../components/thethingsnetwork/sensor.py | 2 +- .../components/threshold/binary_sensor.py | 2 +- homeassistant/components/tibber/sensor.py | 18 ++++++------ .../components/tile/device_tracker.py | 2 +- homeassistant/components/tmb/sensor.py | 2 +- homeassistant/components/tod/binary_sensor.py | 2 +- homeassistant/components/todoist/calendar.py | 2 +- homeassistant/components/toon/climate.py | 2 +- .../totalconnect/alarm_control_panel.py | 8 +++--- .../components/totalconnect/binary_sensor.py | 2 +- homeassistant/components/tplink/light.py | 2 +- homeassistant/components/tplink/switch.py | 2 +- .../components/traccar/device_tracker.py | 2 +- homeassistant/components/tradfri/cover.py | 2 +- .../components/trafikverket_train/sensor.py | 2 +- .../trafikverket_weatherstation/sensor.py | 2 +- .../components/transmission/sensor.py | 2 +- .../components/transport_nsw/sensor.py | 2 +- homeassistant/components/travisci/sensor.py | 2 +- .../components/trend/binary_sensor.py | 2 +- homeassistant/components/twitch/sensor.py | 2 +- .../components/uk_transport/sensor.py | 4 +-- .../components/unifi/device_tracker.py | 4 +-- homeassistant/components/unifi/switch.py | 2 +- .../components/universal/media_player.py | 2 +- homeassistant/components/upb/__init__.py | 2 +- homeassistant/components/upcloud/__init__.py | 2 +- .../components/updater/binary_sensor.py | 2 +- .../components/uptimerobot/binary_sensor.py | 2 +- homeassistant/components/uscis/sensor.py | 2 +- .../usgs_earthquakes_feed/geo_location.py | 2 +- .../components/utility_meter/sensor.py | 2 +- homeassistant/components/uvc/camera.py | 2 +- homeassistant/components/vallox/fan.py | 2 +- homeassistant/components/vasttrafik/sensor.py | 2 +- homeassistant/components/venstar/climate.py | 2 +- homeassistant/components/vera/__init__.py | 2 +- homeassistant/components/vera/lock.py | 4 +-- homeassistant/components/vera/scene.py | 2 +- homeassistant/components/version/sensor.py | 2 +- homeassistant/components/vesync/fan.py | 2 +- homeassistant/components/vesync/switch.py | 2 +- .../components/viaggiatreno/sensor.py | 2 +- homeassistant/components/vicare/climate.py | 2 +- .../components/volvooncall/__init__.py | 2 +- .../components/vultr/binary_sensor.py | 2 +- homeassistant/components/vultr/switch.py | 2 +- homeassistant/components/waqi/sensor.py | 2 +- .../components/waze_travel_time/sensor.py | 2 +- .../components/webostv/media_player.py | 2 +- homeassistant/components/wemo/fan.py | 2 +- homeassistant/components/wemo/switch.py | 2 +- homeassistant/components/whois/sensor.py | 2 +- homeassistant/components/wink/__init__.py | 10 +++---- .../components/wink/alarm_control_panel.py | 2 +- .../components/wink/binary_sensor.py | 20 ++++++------- homeassistant/components/wink/climate.py | 4 +-- homeassistant/components/wink/lock.py | 4 +-- homeassistant/components/wink/sensor.py | 4 +-- homeassistant/components/wink/switch.py | 4 +-- homeassistant/components/wink/water_heater.py | 2 +- .../components/wirelesstag/__init__.py | 2 +- homeassistant/components/wled/light.py | 2 +- homeassistant/components/wled/sensor.py | 2 +- homeassistant/components/wled/switch.py | 6 ++-- homeassistant/components/wolflink/sensor.py | 2 +- .../components/worldtidesinfo/sensor.py | 2 +- homeassistant/components/wsdot/sensor.py | 2 +- .../components/wunderground/sensor.py | 20 ++++++------- homeassistant/components/xbox_live/sensor.py | 2 +- .../components/xiaomi_aqara/__init__.py | 10 +++---- .../components/xiaomi_aqara/binary_sensor.py | 28 +++++++++---------- homeassistant/components/xiaomi_aqara/lock.py | 2 +- .../components/xiaomi_aqara/sensor.py | 2 +- .../components/xiaomi_aqara/switch.py | 4 +-- .../components/xiaomi_miio/air_quality.py | 2 +- homeassistant/components/xiaomi_miio/fan.py | 2 +- homeassistant/components/xiaomi_miio/light.py | 2 +- .../components/xiaomi_miio/sensor.py | 2 +- .../components/xiaomi_miio/switch.py | 2 +- .../components/xiaomi_miio/vacuum.py | 2 +- .../components/yandex_transport/sensor.py | 2 +- homeassistant/components/yeelight/light.py | 2 +- homeassistant/components/zabbix/sensor.py | 2 +- homeassistant/components/zamg/sensor.py | 2 +- homeassistant/components/zestimate/sensor.py | 2 +- homeassistant/components/zha/climate.py | 2 +- homeassistant/components/zha/entity.py | 8 +++--- homeassistant/components/zha/light.py | 2 +- homeassistant/components/zha/lock.py | 2 +- homeassistant/components/zha/sensor.py | 2 +- homeassistant/components/zodiac/sensor.py | 2 +- homeassistant/components/zwave/__init__.py | 2 +- homeassistant/components/zwave/climate.py | 4 +-- homeassistant/components/zwave/lock.py | 4 +-- homeassistant/components/zwave/node_entity.py | 2 +- homeassistant/components/zwave_js/climate.py | 2 +- homeassistant/components/zwave_js/sensor.py | 2 +- tests/components/uvc/test_camera.py | 2 +- tests/components/vultr/test_binary_sensor.py | 2 +- tests/components/vultr/test_switch.py | 2 +- tests/components/wsdot/test_sensor.py | 4 +-- tests/components/zwave/test_climate.py | 4 +-- tests/components/zwave/test_init.py | 2 +- tests/components/zwave/test_lock.py | 26 ++++++++--------- tests/components/zwave/test_node_entity.py | 17 ++++------- .../test/image_processing.py | 2 +- 127 files changed, 218 insertions(+), 223 deletions(-) diff --git a/homeassistant/components/tado/binary_sensor.py b/homeassistant/components/tado/binary_sensor.py index 068c3a7ce93..9f68aa8a4e7 100644 --- a/homeassistant/components/tado/binary_sensor.py +++ b/homeassistant/components/tado/binary_sensor.py @@ -231,7 +231,7 @@ class TadoZoneBinarySensor(TadoZoneEntity, BinarySensorEntity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._state_attributes diff --git a/homeassistant/components/tado/climate.py b/homeassistant/components/tado/climate.py index 9547617a36b..b86eb08b1b0 100644 --- a/homeassistant/components/tado/climate.py +++ b/homeassistant/components/tado/climate.py @@ -462,7 +462,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return temperature offset.""" return self._tado_zone_temp_offset diff --git a/homeassistant/components/tado/sensor.py b/homeassistant/components/tado/sensor.py index 8d38d9eab96..cfafeb14ddf 100644 --- a/homeassistant/components/tado/sensor.py +++ b/homeassistant/components/tado/sensor.py @@ -132,7 +132,7 @@ class TadoHomeSensor(TadoHomeEntity, Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._state_attributes @@ -237,7 +237,7 @@ class TadoZoneSensor(TadoZoneEntity, Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._state_attributes diff --git a/homeassistant/components/tahoma/__init__.py b/homeassistant/components/tahoma/__init__.py index b322d454002..8db7b23a8ce 100644 --- a/homeassistant/components/tahoma/__init__.py +++ b/homeassistant/components/tahoma/__init__.py @@ -137,7 +137,7 @@ class TahomaDevice(Entity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return {"tahoma_device_id": self.tahoma_device.url} diff --git a/homeassistant/components/tahoma/binary_sensor.py b/homeassistant/components/tahoma/binary_sensor.py index af06bf5ca4c..c0946013469 100644 --- a/homeassistant/components/tahoma/binary_sensor.py +++ b/homeassistant/components/tahoma/binary_sensor.py @@ -57,10 +57,10 @@ class TahomaBinarySensor(TahomaDevice, BinarySensorEntity): return self._icon @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" attr = {} - super_attr = super().device_state_attributes + super_attr = super().extra_state_attributes if super_attr is not None: attr.update(super_attr) diff --git a/homeassistant/components/tahoma/cover.py b/homeassistant/components/tahoma/cover.py index 2eec9160811..a02f21fb5e1 100644 --- a/homeassistant/components/tahoma/cover.py +++ b/homeassistant/components/tahoma/cover.py @@ -194,10 +194,10 @@ class TahomaCover(TahomaDevice, CoverEntity): return TAHOMA_DEVICE_CLASSES.get(self.tahoma_device.type) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" attr = {} - super_attr = super().device_state_attributes + super_attr = super().extra_state_attributes if super_attr is not None: attr.update(super_attr) diff --git a/homeassistant/components/tahoma/lock.py b/homeassistant/components/tahoma/lock.py index 93d82bffc99..3d160cd95b3 100644 --- a/homeassistant/components/tahoma/lock.py +++ b/homeassistant/components/tahoma/lock.py @@ -78,12 +78,12 @@ class TahomaLock(TahomaDevice, LockEntity): return self._lock_status == STATE_LOCKED @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the lock state attributes.""" attr = { ATTR_BATTERY_LEVEL: self._battery_level, } - super_attr = super().device_state_attributes + super_attr = super().extra_state_attributes if super_attr is not None: attr.update(super_attr) return attr diff --git a/homeassistant/components/tahoma/scene.py b/homeassistant/components/tahoma/scene.py index 1d53b65d5d5..3cfa26a5f89 100644 --- a/homeassistant/components/tahoma/scene.py +++ b/homeassistant/components/tahoma/scene.py @@ -37,6 +37,6 @@ class TahomaScene(Scene): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the scene.""" return {"tahoma_scene_oid": self.tahoma_scene.oid} diff --git a/homeassistant/components/tahoma/sensor.py b/homeassistant/components/tahoma/sensor.py index fb1129cfa0e..91629137318 100644 --- a/homeassistant/components/tahoma/sensor.py +++ b/homeassistant/components/tahoma/sensor.py @@ -110,10 +110,10 @@ class TahomaSensor(TahomaDevice, Entity): _LOGGER.debug("Update %s, value: %d", self._name, self.current_value) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" attr = {} - super_attr = super().device_state_attributes + super_attr = super().extra_state_attributes if super_attr is not None: attr.update(super_attr) diff --git a/homeassistant/components/tahoma/switch.py b/homeassistant/components/tahoma/switch.py index 808f80d8cfa..2ea68b93e6b 100644 --- a/homeassistant/components/tahoma/switch.py +++ b/homeassistant/components/tahoma/switch.py @@ -105,10 +105,10 @@ class TahomaSwitch(TahomaDevice, SwitchEntity): return bool(self._state == STATE_ON) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" attr = {} - super_attr = super().device_state_attributes + super_attr = super().extra_state_attributes if super_attr is not None: attr.update(super_attr) diff --git a/homeassistant/components/tank_utility/sensor.py b/homeassistant/components/tank_utility/sensor.py index ab1cc8b23da..d0566ec7c9e 100644 --- a/homeassistant/components/tank_utility/sensor.py +++ b/homeassistant/components/tank_utility/sensor.py @@ -97,7 +97,7 @@ class TankUtilitySensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the attributes of the device.""" return self._attributes diff --git a/homeassistant/components/tankerkoenig/sensor.py b/homeassistant/components/tankerkoenig/sensor.py index 6985072b065..a1cbed2ba11 100644 --- a/homeassistant/components/tankerkoenig/sensor.py +++ b/homeassistant/components/tankerkoenig/sensor.py @@ -125,7 +125,7 @@ class FuelPriceSensor(CoordinatorEntity): return f"{self._station_id}_{self._fuel_type}" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the attributes of the device.""" data = self.coordinator.data[self._station_id] diff --git a/homeassistant/components/tautulli/sensor.py b/homeassistant/components/tautulli/sensor.py index ed96bb62ace..2d2d005e95d 100644 --- a/homeassistant/components/tautulli/sensor.py +++ b/homeassistant/components/tautulli/sensor.py @@ -130,7 +130,7 @@ class TautulliSensor(Entity): return "Watching" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return attributes for the sensor.""" return self._attributes diff --git a/homeassistant/components/tellduslive/entry.py b/homeassistant/components/tellduslive/entry.py index 851823385dc..4453622b21e 100644 --- a/homeassistant/components/tellduslive/entry.py +++ b/homeassistant/components/tellduslive/entry.py @@ -81,7 +81,7 @@ class TelldusLiveEntity(Entity): return self._client.is_available(self.device_id) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {} if self._battery_level: diff --git a/homeassistant/components/template/template_entity.py b/homeassistant/components/template/template_entity.py index f350eb87d61..0ae540edf97 100644 --- a/homeassistant/components/template/template_entity.py +++ b/homeassistant/components/template/template_entity.py @@ -168,7 +168,7 @@ class TemplateEntity(Entity): return self._entity_picture @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/tensorflow/image_processing.py b/homeassistant/components/tensorflow/image_processing.py index 65240dc04dc..0b8fafd57a8 100644 --- a/homeassistant/components/tensorflow/image_processing.py +++ b/homeassistant/components/tensorflow/image_processing.py @@ -279,7 +279,7 @@ class TensorFlowImageProcessor(ImageProcessingEntity): return self._total_matches @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return { ATTR_MATCHES: self._matches, diff --git a/homeassistant/components/tesla/__init__.py b/homeassistant/components/tesla/__init__.py index a2ed908948f..76b7f872024 100644 --- a/homeassistant/components/tesla/__init__.py +++ b/homeassistant/components/tesla/__init__.py @@ -307,7 +307,7 @@ class TeslaDevice(CoordinatorEntity): return ICONS.get(self.tesla_device.type) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" attr = self._attributes if self.tesla_device.has_battery(): diff --git a/homeassistant/components/tesla/device_tracker.py b/homeassistant/components/tesla/device_tracker.py index cac89d58d3a..16e8ce6dbe2 100644 --- a/homeassistant/components/tesla/device_tracker.py +++ b/homeassistant/components/tesla/device_tracker.py @@ -42,9 +42,9 @@ class TeslaDeviceEntity(TeslaDevice, TrackerEntity): return SOURCE_TYPE_GPS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" - attr = super().device_state_attributes.copy() + attr = super().extra_state_attributes.copy() location = self.tesla_device.get_location() if location: attr.update( diff --git a/homeassistant/components/tesla/sensor.py b/homeassistant/components/tesla/sensor.py index 3b66845c786..9094a7d6b01 100644 --- a/homeassistant/components/tesla/sensor.py +++ b/homeassistant/components/tesla/sensor.py @@ -81,7 +81,7 @@ class TeslaSensor(TeslaDevice, Entity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" attr = self._attributes.copy() if self.tesla_device.type == "charging rate sensor": diff --git a/homeassistant/components/thermoworks_smoke/sensor.py b/homeassistant/components/thermoworks_smoke/sensor.py index 83a2fd12d24..d768f009364 100644 --- a/homeassistant/components/thermoworks_smoke/sensor.py +++ b/homeassistant/components/thermoworks_smoke/sensor.py @@ -124,7 +124,7 @@ class ThermoworksSmokeSensor(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/thethingsnetwork/sensor.py b/homeassistant/components/thethingsnetwork/sensor.py index 0afec8f7510..d758a20f384 100644 --- a/homeassistant/components/thethingsnetwork/sensor.py +++ b/homeassistant/components/thethingsnetwork/sensor.py @@ -92,7 +92,7 @@ class TtnDataSensor(Entity): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" if self._ttn_data_storage.data is not None: return { diff --git a/homeassistant/components/threshold/binary_sensor.py b/homeassistant/components/threshold/binary_sensor.py index fa05fc09687..5bd6f77253b 100644 --- a/homeassistant/components/threshold/binary_sensor.py +++ b/homeassistant/components/threshold/binary_sensor.py @@ -144,7 +144,7 @@ class ThresholdSensor(BinarySensorEntity): return TYPE_UPPER @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return { ATTR_ENTITY_ID: self._entity_id, diff --git a/homeassistant/components/tibber/sensor.py b/homeassistant/components/tibber/sensor.py index bb5ebe8011f..01e050fdd24 100644 --- a/homeassistant/components/tibber/sensor.py +++ b/homeassistant/components/tibber/sensor.py @@ -54,7 +54,7 @@ class TibberSensor(Entity): self._last_updated = None self._state = None self._is_available = False - self._device_state_attributes = {} + self._extra_state_attributes = {} self._name = tibber_home.info["viewer"]["home"]["appNickname"] if self._name is None: self._name = tibber_home.info["viewer"]["home"]["address"].get( @@ -63,9 +63,9 @@ class TibberSensor(Entity): self._spread_load_constant = randrange(3600) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - return self._device_state_attributes + return self._extra_state_attributes @property def model(self): @@ -121,10 +121,10 @@ class TibberSensorElPrice(TibberSensor): res = self._tibber_home.current_price_data() self._state, price_level, self._last_updated = res - self._device_state_attributes["price_level"] = price_level + self._extra_state_attributes["price_level"] = price_level attrs = self._tibber_home.current_attributes() - self._device_state_attributes.update(attrs) + self._extra_state_attributes.update(attrs) self._is_available = self._state is not None @property @@ -165,11 +165,11 @@ class TibberSensorElPrice(TibberSensor): except (asyncio.TimeoutError, aiohttp.ClientError): return data = self._tibber_home.info["viewer"]["home"] - self._device_state_attributes["app_nickname"] = data["appNickname"] - self._device_state_attributes["grid_company"] = data["meteringPointData"][ + self._extra_state_attributes["app_nickname"] = data["appNickname"] + self._extra_state_attributes["grid_company"] = data["meteringPointData"][ "gridCompany" ] - self._device_state_attributes["estimated_annual_consumption"] = data[ + self._extra_state_attributes["estimated_annual_consumption"] = data[ "meteringPointData" ]["estimatedAnnualConsumption"] @@ -197,7 +197,7 @@ class TibberSensorRT(TibberSensor): for key, value in live_measurement.items(): if value is None: continue - self._device_state_attributes[key] = value + self._extra_state_attributes[key] = value self.async_write_ha_state() diff --git a/homeassistant/components/tile/device_tracker.py b/homeassistant/components/tile/device_tracker.py index f7cc4e1736e..7571e235ef1 100644 --- a/homeassistant/components/tile/device_tracker.py +++ b/homeassistant/components/tile/device_tracker.py @@ -81,7 +81,7 @@ class TileDeviceTracker(CoordinatorEntity, TrackerEntity): return 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/tmb/sensor.py b/homeassistant/components/tmb/sensor.py index f731b912d65..c3f813d796a 100644 --- a/homeassistant/components/tmb/sensor.py +++ b/homeassistant/components/tmb/sensor.py @@ -101,7 +101,7 @@ class TMBSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the last update.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/tod/binary_sensor.py b/homeassistant/components/tod/binary_sensor.py index fde26acf604..26e0ead680a 100644 --- a/homeassistant/components/tod/binary_sensor.py +++ b/homeassistant/components/tod/binary_sensor.py @@ -109,7 +109,7 @@ class TodSensor(BinarySensorEntity): return self._next_update @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return { ATTR_AFTER: self.after.astimezone(self.hass.config.time_zone).isoformat(), diff --git a/homeassistant/components/todoist/calendar.py b/homeassistant/components/todoist/calendar.py index b9ab4fe6dbb..976462c95fa 100644 --- a/homeassistant/components/todoist/calendar.py +++ b/homeassistant/components/todoist/calendar.py @@ -284,7 +284,7 @@ class TodoistProjectDevice(CalendarEventDevice): return await self.data.async_get_events(hass, start_date, end_date) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" if self.data.event is None: # No tasks, we don't REALLY need to show anything. diff --git a/homeassistant/components/toon/climate.py b/homeassistant/components/toon/climate.py index ba3ef8ee807..99b76600dce 100644 --- a/homeassistant/components/toon/climate.py +++ b/homeassistant/components/toon/climate.py @@ -114,7 +114,7 @@ class ToonThermostatDevice(ToonDisplayDeviceEntity, ClimateEntity): return DEFAULT_MAX_TEMP @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return the current state of the burner.""" return {"heating_type": self.coordinator.data.agreement.heating_type} diff --git a/homeassistant/components/totalconnect/alarm_control_panel.py b/homeassistant/components/totalconnect/alarm_control_panel.py index affff382365..c277198b683 100644 --- a/homeassistant/components/totalconnect/alarm_control_panel.py +++ b/homeassistant/components/totalconnect/alarm_control_panel.py @@ -44,7 +44,7 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity): self._location_id = location_id self._client = client self._state = None - self._device_state_attributes = {} + self._extra_state_attributes = {} @property def name(self): @@ -62,9 +62,9 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity): return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" - return self._device_state_attributes + return self._extra_state_attributes def update(self): """Return the state of the device.""" @@ -109,7 +109,7 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity): state = None self._state = state - self._device_state_attributes = attr + self._extra_state_attributes = attr def alarm_disarm(self, code=None): """Send disarm command.""" diff --git a/homeassistant/components/totalconnect/binary_sensor.py b/homeassistant/components/totalconnect/binary_sensor.py index 6bee603d1b1..ef02c5d1fd3 100644 --- a/homeassistant/components/totalconnect/binary_sensor.py +++ b/homeassistant/components/totalconnect/binary_sensor.py @@ -73,7 +73,7 @@ class TotalConnectBinarySensor(BinarySensorEntity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attributes = { "zone_id": self._zone_id, diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index ceb0944efe6..31b2319ead0 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -163,7 +163,7 @@ class TPLinkSmartBulb(LightEntity): return self._is_available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return self._emeter_params diff --git a/homeassistant/components/tplink/switch.py b/homeassistant/components/tplink/switch.py index 23000fe7b59..dec20edec65 100644 --- a/homeassistant/components/tplink/switch.py +++ b/homeassistant/components/tplink/switch.py @@ -100,7 +100,7 @@ class SmartPlugSwitch(SwitchEntity): self.smartplug.turn_off() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return self._emeter_params diff --git a/homeassistant/components/traccar/device_tracker.py b/homeassistant/components/traccar/device_tracker.py index cdb20339510..d558129e323 100644 --- a/homeassistant/components/traccar/device_tracker.py +++ b/homeassistant/components/traccar/device_tracker.py @@ -345,7 +345,7 @@ class TraccarEntity(TrackerEntity, RestoreEntity): return self._battery @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific attributes.""" return self._attributes diff --git a/homeassistant/components/tradfri/cover.py b/homeassistant/components/tradfri/cover.py index 72597637bd3..4c7cde1dfd1 100644 --- a/homeassistant/components/tradfri/cover.py +++ b/homeassistant/components/tradfri/cover.py @@ -29,7 +29,7 @@ class TradfriCover(TradfriBaseDevice, CoverEntity): self._refresh(device) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {ATTR_MODEL: self._device.device_info.model_number} diff --git a/homeassistant/components/trafikverket_train/sensor.py b/homeassistant/components/trafikverket_train/sensor.py index 12f3cf73e50..45899422564 100644 --- a/homeassistant/components/trafikverket_train/sensor.py +++ b/homeassistant/components/trafikverket_train/sensor.py @@ -153,7 +153,7 @@ class TrainSensor(Entity): self._delay_in_minutes = self._state.get_delay_time() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._state is None: return None diff --git a/homeassistant/components/trafikverket_weatherstation/sensor.py b/homeassistant/components/trafikverket_weatherstation/sensor.py index bb1bad67f82..f2e2521a90b 100644 --- a/homeassistant/components/trafikverket_weatherstation/sensor.py +++ b/homeassistant/components/trafikverket_weatherstation/sensor.py @@ -172,7 +172,7 @@ class TrafikverketWeatherStation(Entity): return self._icon @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of Trafikverket Weatherstation.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/transmission/sensor.py b/homeassistant/components/transmission/sensor.py index 2a24b80be16..d2b52771124 100644 --- a/homeassistant/components/transmission/sensor.py +++ b/homeassistant/components/transmission/sensor.py @@ -148,7 +148,7 @@ class TransmissionTorrentsSensor(TransmissionSensor): return "Torrents" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes, if any.""" info = _torrents_info( torrents=self._tm_client.api.torrents, diff --git a/homeassistant/components/transport_nsw/sensor.py b/homeassistant/components/transport_nsw/sensor.py index 2aa27f8c4b3..f6d4e40e4e8 100644 --- a/homeassistant/components/transport_nsw/sensor.py +++ b/homeassistant/components/transport_nsw/sensor.py @@ -87,7 +87,7 @@ class TransportNSWSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._times is not None: return { diff --git a/homeassistant/components/travisci/sensor.py b/homeassistant/components/travisci/sensor.py index 8a548d8cb6b..6464667bffe 100644 --- a/homeassistant/components/travisci/sensor.py +++ b/homeassistant/components/travisci/sensor.py @@ -124,7 +124,7 @@ class TravisCISensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {} attrs[ATTR_ATTRIBUTION] = ATTRIBUTION diff --git a/homeassistant/components/trend/binary_sensor.py b/homeassistant/components/trend/binary_sensor.py index b7079a3311a..52a72eca8c9 100644 --- a/homeassistant/components/trend/binary_sensor.py +++ b/homeassistant/components/trend/binary_sensor.py @@ -146,7 +146,7 @@ class SensorTrend(BinarySensorEntity): return self._device_class @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" return { ATTR_ENTITY_ID: self._entity_id, diff --git a/homeassistant/components/twitch/sensor.py b/homeassistant/components/twitch/sensor.py index 4b019628158..0e5abb58747 100644 --- a/homeassistant/components/twitch/sensor.py +++ b/homeassistant/components/twitch/sensor.py @@ -88,7 +88,7 @@ class TwitchSensor(Entity): return self._preview @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attr = dict(self._statistics) diff --git a/homeassistant/components/uk_transport/sensor.py b/homeassistant/components/uk_transport/sensor.py index e7c01479a96..80b97b186be 100644 --- a/homeassistant/components/uk_transport/sensor.py +++ b/homeassistant/components/uk_transport/sensor.py @@ -191,7 +191,7 @@ class UkTransportLiveBusTimeSensor(UkTransportSensor): self._state = None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return other details about the sensor state.""" attrs = {} if self._data is not None: @@ -261,7 +261,7 @@ class UkTransportLiveTrainTimeSensor(UkTransportSensor): self._state = None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return other details about the sensor state.""" attrs = {} if self._data is not None: diff --git a/homeassistant/components/unifi/device_tracker.py b/homeassistant/components/unifi/device_tracker.py index ac28f7475f6..dddb4d0e5e3 100644 --- a/homeassistant/components/unifi/device_tracker.py +++ b/homeassistant/components/unifi/device_tracker.py @@ -249,7 +249,7 @@ class UniFiClientTracker(UniFiClient, ScannerEntity): return f"{self.client.mac}-{self.controller.site}" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the client state attributes.""" raw = self.client.raw @@ -421,7 +421,7 @@ class UniFiDeviceTracker(UniFiBase, ScannerEntity): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" if self.device.state == 0: return {} diff --git a/homeassistant/components/unifi/switch.py b/homeassistant/components/unifi/switch.py index 6c8b6ea35cd..da3139317d1 100644 --- a/homeassistant/components/unifi/switch.py +++ b/homeassistant/components/unifi/switch.py @@ -238,7 +238,7 @@ class UniFiPOEClientSwitch(UniFiClient, SwitchEntity, RestoreEntity): await self.device.async_set_port_poe_mode(self.client.sw_port, "off") @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" attributes = { "power": self.port.poe_power, diff --git a/homeassistant/components/universal/media_player.py b/homeassistant/components/universal/media_player.py index 2702f26a3d3..c814abf5a82 100644 --- a/homeassistant/components/universal/media_player.py +++ b/homeassistant/components/universal/media_player.py @@ -502,7 +502,7 @@ class UniversalMediaPlayer(MediaPlayerEntity): return flags @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" active_child = self._child_state return {ATTR_ACTIVE_CHILD: active_child.entity_id} if active_child else {} diff --git a/homeassistant/components/upb/__init__.py b/homeassistant/components/upb/__init__.py index bf23be16af2..bd591447472 100644 --- a/homeassistant/components/upb/__init__.py +++ b/homeassistant/components/upb/__init__.py @@ -110,7 +110,7 @@ class UpbEntity(Entity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the default attributes of the element.""" return self._element.as_dict() diff --git a/homeassistant/components/upcloud/__init__.py b/homeassistant/components/upcloud/__init__.py index bb96ef0f1d6..eba61058ca0 100644 --- a/homeassistant/components/upcloud/__init__.py +++ b/homeassistant/components/upcloud/__init__.py @@ -296,7 +296,7 @@ class UpCloudServerEntity(CoordinatorEntity): return DEFAULT_COMPONENT_DEVICE_CLASS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the UpCloud server.""" return { x: getattr(self._server, x, None) diff --git a/homeassistant/components/updater/binary_sensor.py b/homeassistant/components/updater/binary_sensor.py index 36e05513d43..93d19029992 100644 --- a/homeassistant/components/updater/binary_sensor.py +++ b/homeassistant/components/updater/binary_sensor.py @@ -35,7 +35,7 @@ class UpdaterBinary(CoordinatorEntity, BinarySensorEntity): return self.coordinator.data.update_available @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the optional state attributes.""" if not self.coordinator.data: return None diff --git a/homeassistant/components/uptimerobot/binary_sensor.py b/homeassistant/components/uptimerobot/binary_sensor.py index e31d8b44b10..6c0bb63c70f 100644 --- a/homeassistant/components/uptimerobot/binary_sensor.py +++ b/homeassistant/components/uptimerobot/binary_sensor.py @@ -75,7 +75,7 @@ class UptimeRobotBinarySensor(BinarySensorEntity): return DEVICE_CLASS_CONNECTIVITY @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the binary sensor.""" return {ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_TARGET: self._target} diff --git a/homeassistant/components/uscis/sensor.py b/homeassistant/components/uscis/sensor.py index 2e15a4b1422..5f26a0ff82e 100644 --- a/homeassistant/components/uscis/sensor.py +++ b/homeassistant/components/uscis/sensor.py @@ -60,7 +60,7 @@ class UscisSensor(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/usgs_earthquakes_feed/geo_location.py b/homeassistant/components/usgs_earthquakes_feed/geo_location.py index 9fd98de42df..364e0599b75 100644 --- a/homeassistant/components/usgs_earthquakes_feed/geo_location.py +++ b/homeassistant/components/usgs_earthquakes_feed/geo_location.py @@ -280,7 +280,7 @@ class UsgsEarthquakesEvent(GeolocationEvent): return DEFAULT_UNIT_OF_MEASUREMENT @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/utility_meter/sensor.py b/homeassistant/components/utility_meter/sensor.py index e8d551ba280..09f788806f6 100644 --- a/homeassistant/components/utility_meter/sensor.py +++ b/homeassistant/components/utility_meter/sensor.py @@ -324,7 +324,7 @@ class UtilityMeterSensor(RestoreEntity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the sensor.""" state_attr = { ATTR_SOURCE_ID: self._sensor_source_id, diff --git a/homeassistant/components/uvc/camera.py b/homeassistant/components/uvc/camera.py index a20b99d673a..82f59a40131 100644 --- a/homeassistant/components/uvc/camera.py +++ b/homeassistant/components/uvc/camera.py @@ -111,7 +111,7 @@ class UnifiVideoCamera(Camera): return 0 @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the camera state attributes.""" attr = {} if self.motion_detection_enabled: diff --git a/homeassistant/components/vallox/fan.py b/homeassistant/components/vallox/fan.py index 525bf00f50e..e167791e702 100644 --- a/homeassistant/components/vallox/fan.py +++ b/homeassistant/components/vallox/fan.py @@ -83,7 +83,7 @@ class ValloxFan(FanEntity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return { ATTR_PROFILE_FAN_SPEED_HOME["description"]: self._fan_speed_home, diff --git a/homeassistant/components/vasttrafik/sensor.py b/homeassistant/components/vasttrafik/sensor.py index 882274f8e84..d1a461d94fa 100644 --- a/homeassistant/components/vasttrafik/sensor.py +++ b/homeassistant/components/vasttrafik/sensor.py @@ -106,7 +106,7 @@ class VasttrafikDepartureSensor(Entity): return ICON @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/venstar/climate.py b/homeassistant/components/venstar/climate.py index 261339f70dd..b4d8264a3ab 100644 --- a/homeassistant/components/venstar/climate.py +++ b/homeassistant/components/venstar/climate.py @@ -200,7 +200,7 @@ class VenstarThermostat(ClimateEntity): return FAN_AUTO @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the optional state attributes.""" return { ATTR_FAN_STATE: self._client.fanstate, diff --git a/homeassistant/components/vera/__init__.py b/homeassistant/components/vera/__init__.py index 4bfa72b5eb6..ff8dc8b96d1 100644 --- a/homeassistant/components/vera/__init__.py +++ b/homeassistant/components/vera/__init__.py @@ -248,7 +248,7 @@ class VeraDevice(Generic[DeviceType], Entity): return self.vera_device.should_poll @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.""" attr = {} diff --git a/homeassistant/components/vera/lock.py b/homeassistant/components/vera/lock.py index b77f17d3b0a..f98319b6ccf 100644 --- a/homeassistant/components/vera/lock.py +++ b/homeassistant/components/vera/lock.py @@ -61,14 +61,14 @@ class VeraLock(VeraDevice[veraApi.VeraLock], LockEntity): return self._state == STATE_LOCKED @property - def device_state_attributes(self) -> Optional[Dict[str, Any]]: + def extra_state_attributes(self) -> Optional[Dict[str, Any]]: """Who unlocked the lock and did a low battery alert fire. Reports on the previous poll cycle. changed_by_name is a string like 'Bob'. low_battery is 1 if an alert fired, 0 otherwise. """ - data = super().device_state_attributes + data = super().extra_state_attributes last_user = self.vera_device.get_last_user_alert() if last_user is not None: diff --git a/homeassistant/components/vera/scene.py b/homeassistant/components/vera/scene.py index 2274b67f683..4ecbe8c724e 100644 --- a/homeassistant/components/vera/scene.py +++ b/homeassistant/components/vera/scene.py @@ -53,6 +53,6 @@ class VeraScene(Scene): return self._name @property - def device_state_attributes(self) -> Optional[Dict[str, Any]]: + def extra_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the state attributes of the scene.""" return {"vera_scene_id": self.vera_scene.vera_scene_id} diff --git a/homeassistant/components/version/sensor.py b/homeassistant/components/version/sensor.py index c030383a4a6..645cde63459 100644 --- a/homeassistant/components/version/sensor.py +++ b/homeassistant/components/version/sensor.py @@ -118,7 +118,7 @@ class VersionSensor(Entity): return self.haversion.api.version @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return attributes for the sensor.""" return self.haversion.api.version_data diff --git a/homeassistant/components/vesync/fan.py b/homeassistant/components/vesync/fan.py index 1d1320d8d78..d01d3d4dc5d 100644 --- a/homeassistant/components/vesync/fan.py +++ b/homeassistant/components/vesync/fan.py @@ -101,7 +101,7 @@ class VeSyncFanHA(VeSyncDevice, FanEntity): return self.smartfan.uuid @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the fan.""" return { "mode": self.smartfan.mode, diff --git a/homeassistant/components/vesync/switch.py b/homeassistant/components/vesync/switch.py index 0ce4b931def..1d01e340b20 100644 --- a/homeassistant/components/vesync/switch.py +++ b/homeassistant/components/vesync/switch.py @@ -72,7 +72,7 @@ class VeSyncSwitchHA(VeSyncBaseSwitch, SwitchEntity): self.smartplug = plug @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" if not hasattr(self.smartplug, "weekly_energy_total"): return {} diff --git a/homeassistant/components/viaggiatreno/sensor.py b/homeassistant/components/viaggiatreno/sensor.py index 5de968f5eac..e886b9d9728 100644 --- a/homeassistant/components/viaggiatreno/sensor.py +++ b/homeassistant/components/viaggiatreno/sensor.py @@ -119,7 +119,7 @@ class ViaggiaTrenoSensor(Entity): return self._unit @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return extra attributes.""" self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION return self._attributes diff --git a/homeassistant/components/vicare/climate.py b/homeassistant/components/vicare/climate.py index d1accd8ea0a..4878ea330f4 100644 --- a/homeassistant/components/vicare/climate.py +++ b/homeassistant/components/vicare/climate.py @@ -278,7 +278,7 @@ class ViCareClimate(ClimateEntity): self._api.activateProgram(vicare_program) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Show Device Attributes.""" return self._attributes diff --git a/homeassistant/components/volvooncall/__init__.py b/homeassistant/components/volvooncall/__init__.py index 743bb903c72..556a5f25114 100644 --- a/homeassistant/components/volvooncall/__init__.py +++ b/homeassistant/components/volvooncall/__init__.py @@ -277,7 +277,7 @@ class VolvoEntity(Entity): return True @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return dict( self.instrument.attributes, diff --git a/homeassistant/components/vultr/binary_sensor.py b/homeassistant/components/vultr/binary_sensor.py index c1b60479e7a..c62d5136aa6 100644 --- a/homeassistant/components/vultr/binary_sensor.py +++ b/homeassistant/components/vultr/binary_sensor.py @@ -86,7 +86,7 @@ class VultrBinarySensor(BinarySensorEntity): return DEFAULT_DEVICE_CLASS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the Vultr subscription.""" return { ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"), diff --git a/homeassistant/components/vultr/switch.py b/homeassistant/components/vultr/switch.py index a9c43717a71..f93c4f444d6 100644 --- a/homeassistant/components/vultr/switch.py +++ b/homeassistant/components/vultr/switch.py @@ -80,7 +80,7 @@ class VultrSwitch(SwitchEntity): return "mdi:server" if self.is_on else "mdi:server-off" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the Vultr subscription.""" return { ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"), diff --git a/homeassistant/components/waqi/sensor.py b/homeassistant/components/waqi/sensor.py index ec18880b5ba..ac43da68641 100644 --- a/homeassistant/components/waqi/sensor.py +++ b/homeassistant/components/waqi/sensor.py @@ -151,7 +151,7 @@ class WaqiSensor(Entity): return "AQI" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the last update.""" attrs = {} diff --git a/homeassistant/components/waze_travel_time/sensor.py b/homeassistant/components/waze_travel_time/sensor.py index 0357825cb12..be2cf7ca2da 100644 --- a/homeassistant/components/waze_travel_time/sensor.py +++ b/homeassistant/components/waze_travel_time/sensor.py @@ -176,7 +176,7 @@ class WazeTravelTime(Entity): return ICON @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the last update.""" if self._waze_data.duration is None: return None diff --git a/homeassistant/components/webostv/media_player.py b/homeassistant/components/webostv/media_player.py index 4807d780a48..0fc442b37e9 100644 --- a/homeassistant/components/webostv/media_player.py +++ b/homeassistant/components/webostv/media_player.py @@ -318,7 +318,7 @@ class LgWebOSMediaPlayerEntity(MediaPlayerEntity): return supported @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" if self._client.sound_output is None and self.state == STATE_OFF: return {} diff --git a/homeassistant/components/wemo/fan.py b/homeassistant/components/wemo/fan.py index d8f54057557..a3da5edae76 100644 --- a/homeassistant/components/wemo/fan.py +++ b/homeassistant/components/wemo/fan.py @@ -115,7 +115,7 @@ class WemoHumidifier(WemoSubscriptionEntity, FanEntity): return "mdi:water-percent" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return { ATTR_CURRENT_HUMIDITY: self._current_humidity, diff --git a/homeassistant/components/wemo/switch.py b/homeassistant/components/wemo/switch.py index 15b38550b93..5e97031786c 100644 --- a/homeassistant/components/wemo/switch.py +++ b/homeassistant/components/wemo/switch.py @@ -59,7 +59,7 @@ class WemoSwitch(WemoSubscriptionEntity, SwitchEntity): self._mode_string = None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" attr = {} if self.maker_params: diff --git a/homeassistant/components/whois/sensor.py b/homeassistant/components/whois/sensor.py index 0e3c0c6e0da..72c992456a7 100644 --- a/homeassistant/components/whois/sensor.py +++ b/homeassistant/components/whois/sensor.py @@ -81,7 +81,7 @@ class WhoisSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Get the more info attributes.""" return self._attributes diff --git a/homeassistant/components/wink/__init__.py b/homeassistant/components/wink/__init__.py index 26666bf4b15..198bddc937b 100644 --- a/homeassistant/components/wink/__init__.py +++ b/homeassistant/components/wink/__init__.py @@ -778,7 +778,7 @@ class WinkDevice(Entity): return self.wink.pubnub_channel is None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attributes = {} battery = self._battery_level @@ -855,9 +855,9 @@ class WinkSirenDevice(WinkDevice): return "mdi:bell-ring" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" - attributes = super().device_state_attributes + attributes = super().extra_state_attributes auto_shutoff = self.wink.auto_shutoff() if auto_shutoff is not None: @@ -913,9 +913,9 @@ class WinkNimbusDialDevice(WinkDevice): return f"{self.parent.name()} dial {self.wink.index() + 1}" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" - attributes = super().device_state_attributes + attributes = super().extra_state_attributes dial_attributes = self.dial_attributes() return {**attributes, **dial_attributes} diff --git a/homeassistant/components/wink/alarm_control_panel.py b/homeassistant/components/wink/alarm_control_panel.py index 5c45cc7b03d..2f5ac83c6f5 100644 --- a/homeassistant/components/wink/alarm_control_panel.py +++ b/homeassistant/components/wink/alarm_control_panel.py @@ -70,6 +70,6 @@ class WinkCameraDevice(WinkDevice, alarm.AlarmControlPanelEntity): self.wink.set_mode("away") @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return {"private": self.wink.private()} diff --git a/homeassistant/components/wink/binary_sensor.py b/homeassistant/components/wink/binary_sensor.py index 77ff464a5bf..ea864e912f0 100644 --- a/homeassistant/components/wink/binary_sensor.py +++ b/homeassistant/components/wink/binary_sensor.py @@ -119,18 +119,18 @@ class WinkBinarySensorEntity(WinkDevice, BinarySensorEntity): return SENSOR_TYPES.get(self.capability) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" - return super().device_state_attributes + return super().extra_state_attributes class WinkSmokeDetector(WinkBinarySensorEntity): """Representation of a Wink Smoke detector.""" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" - _attributes = super().device_state_attributes + _attributes = super().extra_state_attributes _attributes["test_activated"] = self.wink.test_activated() return _attributes @@ -139,9 +139,9 @@ class WinkHub(WinkBinarySensorEntity): """Representation of a Wink Hub.""" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" - _attributes = super().device_state_attributes + _attributes = super().extra_state_attributes _attributes["update_needed"] = self.wink.update_needed() _attributes["firmware_version"] = self.wink.firmware_version() _attributes["pairing_mode"] = self.wink.pairing_mode() @@ -159,9 +159,9 @@ class WinkRemote(WinkBinarySensorEntity): """Representation of a Wink Lutron Connected bulb remote.""" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - _attributes = super().device_state_attributes + _attributes = super().extra_state_attributes _attributes["button_on_pressed"] = self.wink.button_on_pressed() _attributes["button_off_pressed"] = self.wink.button_off_pressed() _attributes["button_up_pressed"] = self.wink.button_up_pressed() @@ -178,9 +178,9 @@ class WinkButton(WinkBinarySensorEntity): """Representation of a Wink Relay button.""" @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device state attributes.""" - _attributes = super().device_state_attributes + _attributes = super().extra_state_attributes _attributes["pressed"] = self.wink.pressed() _attributes["long_pressed"] = self.wink.long_pressed() return _attributes diff --git a/homeassistant/components/wink/climate.py b/homeassistant/components/wink/climate.py index 7ee05f0a729..4c783e6bde1 100644 --- a/homeassistant/components/wink/climate.py +++ b/homeassistant/components/wink/climate.py @@ -99,7 +99,7 @@ class WinkThermostat(WinkDevice, ClimateEntity): return TEMP_CELSIUS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the optional device state attributes.""" data = {} if self.external_temperature is not None: @@ -396,7 +396,7 @@ class WinkAC(WinkDevice, ClimateEntity): return TEMP_CELSIUS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the optional device state attributes.""" data = {} data[ATTR_TOTAL_CONSUMPTION] = self.wink.total_consumption() diff --git a/homeassistant/components/wink/lock.py b/homeassistant/components/wink/lock.py index f82b74e7712..63a67d9f1ac 100644 --- a/homeassistant/components/wink/lock.py +++ b/homeassistant/components/wink/lock.py @@ -187,9 +187,9 @@ class WinkLockDevice(WinkDevice, LockEntity): self.wink.set_alarm_mode(mode) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - super_attrs = super().device_state_attributes + super_attrs = super().extra_state_attributes sensitivity = dict_value_to_key( ALARM_SENSITIVITY_MAP, self.wink.alarm_sensitivity() ) diff --git a/homeassistant/components/wink/sensor.py b/homeassistant/components/wink/sensor.py index cd3eb756fb3..d2de4c43945 100644 --- a/homeassistant/components/wink/sensor.py +++ b/homeassistant/components/wink/sensor.py @@ -83,9 +83,9 @@ class WinkSensorDevice(WinkDevice): return self._unit_of_measurement @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - super_attrs = super().device_state_attributes + super_attrs = super().extra_state_attributes try: super_attrs["egg_times"] = self.wink.eggs() except AttributeError: diff --git a/homeassistant/components/wink/switch.py b/homeassistant/components/wink/switch.py index 2632036095a..d377ae0cddf 100644 --- a/homeassistant/components/wink/switch.py +++ b/homeassistant/components/wink/switch.py @@ -48,9 +48,9 @@ class WinkToggleDevice(WinkDevice, ToggleEntity): self.wink.set_state(False) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - attributes = super().device_state_attributes + attributes = super().extra_state_attributes try: event = self.wink.last_event() if event is not None: diff --git a/homeassistant/components/wink/water_heater.py b/homeassistant/components/wink/water_heater.py index 0ce31762c7a..bf5e8434746 100644 --- a/homeassistant/components/wink/water_heater.py +++ b/homeassistant/components/wink/water_heater.py @@ -66,7 +66,7 @@ class WinkWaterHeater(WinkDevice, WaterHeaterEntity): return TEMP_CELSIUS @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the optional device state attributes.""" data = {} data[ATTR_VACATION_MODE] = self.wink.vacation_mode_enabled() diff --git a/homeassistant/components/wirelesstag/__init__.py b/homeassistant/components/wirelesstag/__init__.py index 83e92c2250b..0efbc80f13c 100644 --- a/homeassistant/components/wirelesstag/__init__.py +++ b/homeassistant/components/wirelesstag/__init__.py @@ -272,7 +272,7 @@ class WirelessTagBaseSensor(Entity): self._state = self.updated_state_value() @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100), diff --git a/homeassistant/components/wled/light.py b/homeassistant/components/wled/light.py index f89cf06a44c..d25c0fc9064 100644 --- a/homeassistant/components/wled/light.py +++ b/homeassistant/components/wled/light.py @@ -188,7 +188,7 @@ class WLEDSegmentLight(LightEntity, WLEDDeviceEntity): return super().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 entity.""" playlist = self.coordinator.data.state.playlist if playlist == -1: diff --git a/homeassistant/components/wled/sensor.py b/homeassistant/components/wled/sensor.py index 89d76776a82..da002e1e8f0 100644 --- a/homeassistant/components/wled/sensor.py +++ b/homeassistant/components/wled/sensor.py @@ -92,7 +92,7 @@ class WLEDEstimatedCurrentSensor(WLEDSensor): ) @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 { ATTR_LED_COUNT: self.coordinator.data.info.leds.count, diff --git a/homeassistant/components/wled/switch.py b/homeassistant/components/wled/switch.py index 38ebd0e9b29..e58b32425cb 100644 --- a/homeassistant/components/wled/switch.py +++ b/homeassistant/components/wled/switch.py @@ -72,7 +72,7 @@ class WLEDNightlightSwitch(WLEDSwitch): ) @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 { ATTR_DURATION: self.coordinator.data.state.nightlight.duration, @@ -110,7 +110,7 @@ class WLEDSyncSendSwitch(WLEDSwitch): ) @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 {ATTR_UDP_PORT: self.coordinator.data.info.udp_port} @@ -144,7 +144,7 @@ class WLEDSyncReceiveSwitch(WLEDSwitch): ) @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 {ATTR_UDP_PORT: self.coordinator.data.info.udp_port} diff --git a/homeassistant/components/wolflink/sensor.py b/homeassistant/components/wolflink/sensor.py index 201979d4dc3..9ea7f9d1163 100644 --- a/homeassistant/components/wolflink/sensor.py +++ b/homeassistant/components/wolflink/sensor.py @@ -69,7 +69,7 @@ class WolfLinkSensor(CoordinatorEntity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { "parameter_id": self.wolf_object.parameter_id, diff --git a/homeassistant/components/worldtidesinfo/sensor.py b/homeassistant/components/worldtidesinfo/sensor.py index aaa9f2d1585..43c9446b6ce 100644 --- a/homeassistant/components/worldtidesinfo/sensor.py +++ b/homeassistant/components/worldtidesinfo/sensor.py @@ -72,7 +72,7 @@ class WorldTidesInfoSensor(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: ATTRIBUTION} diff --git a/homeassistant/components/wsdot/sensor.py b/homeassistant/components/wsdot/sensor.py index 786fd07f626..34ad5a37ec8 100644 --- a/homeassistant/components/wsdot/sensor.py +++ b/homeassistant/components/wsdot/sensor.py @@ -120,7 +120,7 @@ class WashingtonStateTravelTimeSensor(WashingtonStateTransportSensor): self._state = self._data.get(ATTR_CURRENT_TIME) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return other details about the sensor state.""" if self._data is not None: attrs = {ATTR_ATTRIBUTION: ATTRIBUTION} diff --git a/homeassistant/components/wunderground/sensor.py b/homeassistant/components/wunderground/sensor.py index e1bd79b7ea0..1f4332c35e7 100644 --- a/homeassistant/components/wunderground/sensor.py +++ b/homeassistant/components/wunderground/sensor.py @@ -70,7 +70,7 @@ class WUSensorConfig: unit_of_measurement: Optional[str] = None, entity_picture=None, icon: str = "mdi:gauge", - device_state_attributes=None, + extra_state_attributes=None, device_class=None, ): """Initialize sensor configuration. @@ -82,7 +82,7 @@ class WUSensorConfig: :param unit_of_measurement: unit of measurement :param entity_picture: value or callback returning URL of entity picture :param icon: icon name or URL - :param device_state_attributes: dictionary of attributes, or callable that returns it + :param extra_state_attributes: dictionary of attributes, or callable that returns it """ self.friendly_name = friendly_name self.unit_of_measurement = unit_of_measurement @@ -90,7 +90,7 @@ class WUSensorConfig: self.value = value self.entity_picture = entity_picture self.icon = icon - self.device_state_attributes = device_state_attributes or {} + self.extra_state_attributes = extra_state_attributes or {} self.device_class = device_class @@ -121,7 +121,7 @@ class WUCurrentConditionsSensorConfig(WUSensorConfig): entity_picture=lambda wu: wu.data["current_observation"]["icon_url"] if icon is None else None, - device_state_attributes={ + extra_state_attributes={ "date": lambda wu: wu.data["current_observation"]["observation_time"] }, device_class=device_class, @@ -152,7 +152,7 @@ class WUDailyTextForecastSensorConfig(WUSensorConfig): "forecastday" ][period]["icon_url"], unit_of_measurement=unit_of_measurement, - device_state_attributes={ + extra_state_attributes={ "date": lambda wu: wu.data["forecast"]["txt_forecast"]["date"] }, ) @@ -201,7 +201,7 @@ class WUDailySimpleForecastSensorConfig(WUSensorConfig): if not icon else None, icon=icon, - device_state_attributes={ + extra_state_attributes={ "date": lambda wu: wu.data["forecast"]["simpleforecast"]["forecastday"][ period ]["date"]["pretty"] @@ -227,7 +227,7 @@ class WUHourlyForecastSensorConfig(WUSensorConfig): feature="hourly", value=lambda wu: wu.data["hourly_forecast"][period][field], entity_picture=lambda wu: wu.data["hourly_forecast"][period]["icon_url"], - device_state_attributes={ + extra_state_attributes={ "temp_c": lambda wu: wu.data["hourly_forecast"][period]["temp"][ "metric" ], @@ -315,7 +315,7 @@ class WUAlertsSensorConfig(WUSensorConfig): icon=lambda wu: "mdi:alert-circle-outline" if wu.data["alerts"] else "mdi:check-circle-outline", - device_state_attributes=self._get_attributes, + extra_state_attributes=self._get_attributes, ) @staticmethod @@ -1157,7 +1157,7 @@ class WUndergroundSensor(Entity): def _update_attrs(self): """Parse and update device state attributes.""" - attrs = self._cfg_expand("device_state_attributes", {}) + attrs = self._cfg_expand("extra_state_attributes", {}) for (attr, callback) in attrs.items(): if callable(callback): @@ -1185,7 +1185,7 @@ class WUndergroundSensor(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/xbox_live/sensor.py b/homeassistant/components/xbox_live/sensor.py index 300fcbfb095..780051b2d87 100644 --- a/homeassistant/components/xbox_live/sensor.py +++ b/homeassistant/components/xbox_live/sensor.py @@ -104,7 +104,7 @@ class XboxSensor(Entity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attributes = {"gamerscore": self._gamerscore, "tier": self._tier} diff --git a/homeassistant/components/xiaomi_aqara/__init__.py b/homeassistant/components/xiaomi_aqara/__init__.py index 53a9427d30a..ba7f717f421 100644 --- a/homeassistant/components/xiaomi_aqara/__init__.py +++ b/homeassistant/components/xiaomi_aqara/__init__.py @@ -241,7 +241,7 @@ class XiaomiDevice(Entity): self._type = device_type self._write_to_hub = xiaomi_hub.write_to_hub self._get_from_hub = xiaomi_hub.get_from_hub - self._device_state_attributes = {} + self._extra_state_attributes = {} self._remove_unavailability_tracker = None self._xiaomi_hub = xiaomi_hub self.parse_data(device["data"], device["raw_data"]) @@ -319,9 +319,9 @@ class XiaomiDevice(Entity): return False @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" - return self._device_state_attributes + return self._extra_state_attributes @callback def _async_set_unavailable(self, now): @@ -364,11 +364,11 @@ class XiaomiDevice(Entity): max_volt = 3300 min_volt = 2800 voltage = data[voltage_key] - self._device_state_attributes[ATTR_VOLTAGE] = round(voltage / 1000.0, 2) + self._extra_state_attributes[ATTR_VOLTAGE] = round(voltage / 1000.0, 2) voltage = min(voltage, max_volt) voltage = max(voltage, min_volt) percent = ((voltage - min_volt) / (max_volt - min_volt)) * 100 - self._device_state_attributes[ATTR_BATTERY_LEVEL] = round(percent, 1) + self._extra_state_attributes[ATTR_BATTERY_LEVEL] = round(percent, 1) return True def parse_data(self, data, raw_data): diff --git a/homeassistant/components/xiaomi_aqara/binary_sensor.py b/homeassistant/components/xiaomi_aqara/binary_sensor.py index 8fbecee46e9..3d9437e3778 100644 --- a/homeassistant/components/xiaomi_aqara/binary_sensor.py +++ b/homeassistant/components/xiaomi_aqara/binary_sensor.py @@ -170,10 +170,10 @@ class XiaomiNatgasSensor(XiaomiBinarySensor): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {ATTR_DENSITY: self._density} - attrs.update(super().device_state_attributes) + attrs.update(super().extra_state_attributes) return attrs def parse_data(self, data, raw_data): @@ -214,10 +214,10 @@ class XiaomiMotionSensor(XiaomiBinarySensor): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {ATTR_NO_MOTION_SINCE: self._no_motion_since} - attrs.update(super().device_state_attributes) + attrs.update(super().extra_state_attributes) return attrs @callback @@ -308,10 +308,10 @@ class XiaomiDoorSensor(XiaomiBinarySensor): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {ATTR_OPEN_SINCE: self._open_since} - attrs.update(super().device_state_attributes) + attrs.update(super().extra_state_attributes) return attrs def parse_data(self, data, raw_data): @@ -389,10 +389,10 @@ class XiaomiSmokeSensor(XiaomiBinarySensor): ) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {ATTR_DENSITY: self._density} - attrs.update(super().device_state_attributes) + attrs.update(super().extra_state_attributes) return attrs def parse_data(self, data, raw_data): @@ -424,10 +424,10 @@ class XiaomiVibration(XiaomiBinarySensor): super().__init__(device, name, xiaomi_hub, data_key, None, config_entry) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {ATTR_LAST_ACTION: self._last_action} - attrs.update(super().device_state_attributes) + attrs.update(super().extra_state_attributes) return attrs def parse_data(self, data, raw_data): @@ -459,10 +459,10 @@ class XiaomiButton(XiaomiBinarySensor): super().__init__(device, name, xiaomi_hub, data_key, None, config_entry) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {ATTR_LAST_ACTION: self._last_action} - attrs.update(super().device_state_attributes) + attrs.update(super().extra_state_attributes) return attrs def parse_data(self, data, raw_data): @@ -519,10 +519,10 @@ class XiaomiCube(XiaomiBinarySensor): super().__init__(device, "Cube", xiaomi_hub, data_key, None, config_entry) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attrs = {ATTR_LAST_ACTION: self._last_action} - attrs.update(super().device_state_attributes) + attrs.update(super().extra_state_attributes) return attrs def parse_data(self, data, raw_data): diff --git a/homeassistant/components/xiaomi_aqara/lock.py b/homeassistant/components/xiaomi_aqara/lock.py index 7c5334e0f5c..5afb1701e33 100644 --- a/homeassistant/components/xiaomi_aqara/lock.py +++ b/homeassistant/components/xiaomi_aqara/lock.py @@ -50,7 +50,7 @@ class XiaomiAqaraLock(LockEntity, XiaomiDevice): return self._changed_by @property - def device_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict: """Return the state attributes.""" attributes = {ATTR_VERIFIED_WRONG_TIMES: self._verified_wrong_times} return attributes diff --git a/homeassistant/components/xiaomi_aqara/sensor.py b/homeassistant/components/xiaomi_aqara/sensor.py index 5b1d3467d25..969980bf7c8 100644 --- a/homeassistant/components/xiaomi_aqara/sensor.py +++ b/homeassistant/components/xiaomi_aqara/sensor.py @@ -194,7 +194,7 @@ class XiaomiBatterySensor(XiaomiDevice): succeed = super().parse_voltage(data) if not succeed: return False - battery_level = int(self._device_state_attributes.pop(ATTR_BATTERY_LEVEL)) + battery_level = int(self._extra_state_attributes.pop(ATTR_BATTERY_LEVEL)) if battery_level <= 0 or battery_level > 100: return False self._state = battery_level diff --git a/homeassistant/components/xiaomi_aqara/switch.py b/homeassistant/components/xiaomi_aqara/switch.py index 6e75ddb487e..8b16b6491c7 100644 --- a/homeassistant/components/xiaomi_aqara/switch.py +++ b/homeassistant/components/xiaomi_aqara/switch.py @@ -157,7 +157,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchEntity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" if self._supports_power_consumption: attrs = { @@ -167,7 +167,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchEntity): } else: attrs = {} - attrs.update(super().device_state_attributes) + attrs.update(super().extra_state_attributes) return attrs @property diff --git a/homeassistant/components/xiaomi_miio/air_quality.py b/homeassistant/components/xiaomi_miio/air_quality.py index b278a60bd48..1a5aabcc141 100644 --- a/homeassistant/components/xiaomi_miio/air_quality.py +++ b/homeassistant/components/xiaomi_miio/air_quality.py @@ -165,7 +165,7 @@ class AirMonitorB1(XiaomiMiioEntity, AirQualityEntity): return self._humidity @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" data = {} diff --git a/homeassistant/components/xiaomi_miio/fan.py b/homeassistant/components/xiaomi_miio/fan.py index addb1a3cbca..cc8ee74feb0 100644 --- a/homeassistant/components/xiaomi_miio/fan.py +++ b/homeassistant/components/xiaomi_miio/fan.py @@ -651,7 +651,7 @@ class XiaomiGenericDevice(XiaomiMiioEntity, FanEntity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return self._state_attrs diff --git a/homeassistant/components/xiaomi_miio/light.py b/homeassistant/components/xiaomi_miio/light.py index c0590fbb332..c6d8b67bb07 100644 --- a/homeassistant/components/xiaomi_miio/light.py +++ b/homeassistant/components/xiaomi_miio/light.py @@ -260,7 +260,7 @@ class XiaomiPhilipsAbstractLight(XiaomiMiioEntity, LightEntity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return self._state_attrs diff --git a/homeassistant/components/xiaomi_miio/sensor.py b/homeassistant/components/xiaomi_miio/sensor.py index 6d43b835f1c..5769c1fb475 100644 --- a/homeassistant/components/xiaomi_miio/sensor.py +++ b/homeassistant/components/xiaomi_miio/sensor.py @@ -185,7 +185,7 @@ class XiaomiAirQualityMonitor(XiaomiMiioEntity): return self._state @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return self._state_attrs diff --git a/homeassistant/components/xiaomi_miio/switch.py b/homeassistant/components/xiaomi_miio/switch.py index 0a35e8e0a35..fd75e9f0088 100644 --- a/homeassistant/components/xiaomi_miio/switch.py +++ b/homeassistant/components/xiaomi_miio/switch.py @@ -252,7 +252,7 @@ class XiaomiPlugGenericSwitch(XiaomiMiioEntity, SwitchEntity): return self._available @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes of the device.""" return self._state_attrs diff --git a/homeassistant/components/xiaomi_miio/vacuum.py b/homeassistant/components/xiaomi_miio/vacuum.py index bbb4cfd1b7f..b6cb2b76ae6 100644 --- a/homeassistant/components/xiaomi_miio/vacuum.py +++ b/homeassistant/components/xiaomi_miio/vacuum.py @@ -305,7 +305,7 @@ class MiroboVacuum(XiaomiMiioEntity, StateVacuumEntity): ] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the specific state attributes of this vacuum cleaner.""" attrs = {} if self.vacuum_state is not None: diff --git a/homeassistant/components/yandex_transport/sensor.py b/homeassistant/components/yandex_transport/sensor.py index 957844e519d..0df073f581d 100644 --- a/homeassistant/components/yandex_transport/sensor.py +++ b/homeassistant/components/yandex_transport/sensor.py @@ -124,7 +124,7 @@ class DiscoverYandexTransport(Entity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attrs diff --git a/homeassistant/components/yeelight/light.py b/homeassistant/components/yeelight/light.py index e4044303ef0..4c1cb9a0e82 100644 --- a/homeassistant/components/yeelight/light.py +++ b/homeassistant/components/yeelight/light.py @@ -560,7 +560,7 @@ class YeelightGenericLight(YeelightEntity, LightEntity): return YEELIGHT_MONO_EFFECT_LIST @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" attributes = { "flowing": self.device.is_color_flow_enabled, diff --git a/homeassistant/components/zabbix/sensor.py b/homeassistant/components/zabbix/sensor.py index 3fa29a07896..4ef0da85daa 100644 --- a/homeassistant/components/zabbix/sensor.py +++ b/homeassistant/components/zabbix/sensor.py @@ -116,7 +116,7 @@ class ZabbixTriggerCountSensor(Entity): self._state = len(triggers) @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/zamg/sensor.py b/homeassistant/components/zamg/sensor.py index 4852e874672..ef0a476f612 100644 --- a/homeassistant/components/zamg/sensor.py +++ b/homeassistant/components/zamg/sensor.py @@ -157,7 +157,7 @@ class ZamgSensor(Entity): return SENSOR_TYPES[self.variable][1] @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return { ATTR_ATTRIBUTION: ATTRIBUTION, diff --git a/homeassistant/components/zestimate/sensor.py b/homeassistant/components/zestimate/sensor.py index cdf7e6304ad..ed15d42b7e3 100644 --- a/homeassistant/components/zestimate/sensor.py +++ b/homeassistant/components/zestimate/sensor.py @@ -86,7 +86,7 @@ class ZestimateDataSensor(Entity): return None @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" attributes = {} if self.data is not None: diff --git a/homeassistant/components/zha/climate.py b/homeassistant/components/zha/climate.py index ab0f15f7559..f947012d3af 100644 --- a/homeassistant/components/zha/climate.py +++ b/homeassistant/components/zha/climate.py @@ -185,7 +185,7 @@ class Thermostat(ZhaEntity, ClimateEntity): return self._thrm.local_temp / ZCL_TEMP @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" data = {} if self.hvac_mode: diff --git a/homeassistant/components/zha/entity.py b/homeassistant/components/zha/entity.py index 3c8f0c59cb1..c19bad21455 100644 --- a/homeassistant/components/zha/entity.py +++ b/homeassistant/components/zha/entity.py @@ -44,7 +44,7 @@ class BaseZhaEntity(LogMixin, entity.Entity): self._should_poll: bool = False self._unique_id: str = unique_id self._state: Any = None - self._device_state_attributes: Dict[str, Any] = {} + self._extra_state_attributes: Dict[str, Any] = {} self._zha_device: ZhaDeviceType = zha_device self._unsubs: List[CALLABLE_T] = [] self.remove_future: Awaitable[None] = None @@ -65,9 +65,9 @@ class BaseZhaEntity(LogMixin, entity.Entity): return self._zha_device @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return device specific state attributes.""" - return self._device_state_attributes + return self._extra_state_attributes @property def force_update(self) -> bool: @@ -101,7 +101,7 @@ class BaseZhaEntity(LogMixin, entity.Entity): @callback def async_update_state_attribute(self, key: str, value: Any) -> None: """Update a single device state attribute.""" - self._device_state_attributes.update({key: value}) + self._extra_state_attributes.update({key: value}) self.async_write_ha_state() @callback diff --git a/homeassistant/components/zha/light.py b/homeassistant/components/zha/light.py index 32b8a064054..e7d9be62374 100644 --- a/homeassistant/components/zha/light.py +++ b/homeassistant/components/zha/light.py @@ -135,7 +135,7 @@ class BaseLight(LogMixin, light.LightEntity): self._identify_channel = None @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return state attributes.""" attributes = {"off_brightness": self._off_brightness} return attributes diff --git a/homeassistant/components/zha/lock.py b/homeassistant/components/zha/lock.py index 5cc7d7c56f6..2ed186d807c 100644 --- a/homeassistant/components/zha/lock.py +++ b/homeassistant/components/zha/lock.py @@ -73,7 +73,7 @@ class ZhaDoorLock(ZhaEntity, LockEntity): return self._state == STATE_LOCKED @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return state attributes.""" return self.state_attributes diff --git a/homeassistant/components/zha/sensor.py b/homeassistant/components/zha/sensor.py index 84d2dfb06bb..926fd4555e1 100644 --- a/homeassistant/components/zha/sensor.py +++ b/homeassistant/components/zha/sensor.py @@ -178,7 +178,7 @@ class Battery(Sensor): return value @property - def device_state_attributes(self) -> Dict[str, Any]: + def extra_state_attributes(self) -> Dict[str, Any]: """Return device state attrs for battery sensors.""" state_attrs = {} battery_size = self._channel.cluster.get("battery_size") diff --git a/homeassistant/components/zodiac/sensor.py b/homeassistant/components/zodiac/sensor.py index 5113c5c6e18..b602d7a50c4 100644 --- a/homeassistant/components/zodiac/sensor.py +++ b/homeassistant/components/zodiac/sensor.py @@ -196,7 +196,7 @@ class ZodiacSensor(Entity): return ZODIAC_ICONS.get(self._state) @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the state attributes.""" return self._attrs diff --git a/homeassistant/components/zwave/__init__.py b/homeassistant/components/zwave/__init__.py index 649f17ff08f..b8265f1e089 100644 --- a/homeassistant/components/zwave/__init__.py +++ b/homeassistant/components/zwave/__init__.py @@ -1362,7 +1362,7 @@ class ZWaveDeviceEntity(ZWaveBaseEntity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" attrs = { const.ATTR_NODE_ID: self.node_id, diff --git a/homeassistant/components/zwave/climate.py b/homeassistant/components/zwave/climate.py index 9c9c1ed6128..20eb52c2c19 100644 --- a/homeassistant/components/zwave/climate.py +++ b/homeassistant/components/zwave/climate.py @@ -571,9 +571,9 @@ class ZWaveClimateBase(ZWaveDeviceEntity, ClimateEntity): self.values.zxt_120_swing_mode.data = swing_mode @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._fan_action: data[ATTR_FAN_ACTION] = self._fan_action return data diff --git a/homeassistant/components/zwave/lock.py b/homeassistant/components/zwave/lock.py index c9601679f57..605a64ada5d 100644 --- a/homeassistant/components/zwave/lock.py +++ b/homeassistant/components/zwave/lock.py @@ -374,9 +374,9 @@ class ZwaveLock(ZWaveDeviceEntity, LockEntity): self.values.primary.data = False @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 if self._notification: data[ATTR_NOTIFICATION] = self._notification if self._lock_status: diff --git a/homeassistant/components/zwave/node_entity.py b/homeassistant/components/zwave/node_entity.py index 05e5951f921..3fa26439ad5 100644 --- a/homeassistant/components/zwave/node_entity.py +++ b/homeassistant/components/zwave/node_entity.py @@ -351,7 +351,7 @@ class ZWaveNodeEntity(ZWaveBaseEntity): return self._name @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return the device specific state attributes.""" attrs = { ATTR_NODE_ID: self.node_id, diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index 26e9e730283..1a15c45049b 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -326,7 +326,7 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity): return None @property - def device_state_attributes(self) -> Optional[Dict[str, str]]: + def extra_state_attributes(self) -> Optional[Dict[str, str]]: """Return the optional state attributes.""" if ( self._fan_state diff --git a/homeassistant/components/zwave_js/sensor.py b/homeassistant/components/zwave_js/sensor.py index 8e22323c733..a6d44cb62d0 100644 --- a/homeassistant/components/zwave_js/sensor.py +++ b/homeassistant/components/zwave_js/sensor.py @@ -199,7 +199,7 @@ class ZWaveListSensor(ZwaveSensorBase): ) @property - def device_state_attributes(self) -> Optional[Dict[str, str]]: + def extra_state_attributes(self) -> Optional[Dict[str, str]]: """Return the device specific state attributes.""" # add the value's int value as property for multi-value (list) items return {"value": self.info.primary_value.value} diff --git a/tests/components/uvc/test_camera.py b/tests/components/uvc/test_camera.py index 1dd44625ebe..24d73272f18 100644 --- a/tests/components/uvc/test_camera.py +++ b/tests/components/uvc/test_camera.py @@ -257,7 +257,7 @@ class TestUVC(unittest.TestCase): assert not self.uvc.is_recording assert ( datetime(2021, 1, 8, 1, 56, 32, 367000) - == self.uvc.device_state_attributes["last_recording_start_time"] + == self.uvc.extra_state_attributes["last_recording_start_time"] ) self.nvr.get_camera.return_value["recordingIndicator"] = "DISABLED" diff --git a/tests/components/vultr/test_binary_sensor.py b/tests/components/vultr/test_binary_sensor.py index ab12bfda12c..7fb0c90362a 100644 --- a/tests/components/vultr/test_binary_sensor.py +++ b/tests/components/vultr/test_binary_sensor.py @@ -76,7 +76,7 @@ class TestVultrBinarySensorSetup(unittest.TestCase): assert "Vultr {}" == device.name device.update() - device_attrs = device.device_state_attributes + device_attrs = device.extra_state_attributes if device.subscription == "555555": assert "Vultr Another Server" == device.name diff --git a/tests/components/vultr/test_switch.py b/tests/components/vultr/test_switch.py index 12af400a44a..d6b7392ca9c 100644 --- a/tests/components/vultr/test_switch.py +++ b/tests/components/vultr/test_switch.py @@ -77,7 +77,7 @@ class TestVultrSwitchSetup(unittest.TestCase): tested += 1 device.update() - device_attrs = device.device_state_attributes + device_attrs = device.extra_state_attributes if device.subscription == "555555": assert device.name == "Vultr Another Server" diff --git a/tests/components/wsdot/test_sensor.py b/tests/components/wsdot/test_sensor.py index 1b1c2e090f2..bbb56efdeda 100644 --- a/tests/components/wsdot/test_sensor.py +++ b/tests/components/wsdot/test_sensor.py @@ -50,9 +50,9 @@ async def test_setup(hass, requests_mock): assert sensor.name == "I90 EB" assert sensor.state == 11 assert ( - sensor.device_state_attributes[ATTR_DESCRIPTION] + sensor.extra_state_attributes[ATTR_DESCRIPTION] == "Downtown Seattle to Downtown Bellevue via I-90" ) - assert sensor.device_state_attributes[ATTR_TIME_UPDATED] == datetime( + assert sensor.extra_state_attributes[ATTR_TIME_UPDATED] == datetime( 2017, 1, 21, 15, 10, tzinfo=timezone(timedelta(hours=-8)) ) diff --git a/tests/components/zwave/test_climate.py b/tests/components/zwave/test_climate.py index 5275ca79506..1afe9617097 100644 --- a/tests/components/zwave/test_climate.py +++ b/tests/components/zwave/test_climate.py @@ -845,10 +845,10 @@ def test_hvac_action_value_changed_unknown(device_unknown): def test_fan_action_value_changed(device): """Test values changed for climate device.""" - assert device.device_state_attributes[climate.ATTR_FAN_ACTION] == 7 + assert device.extra_state_attributes[climate.ATTR_FAN_ACTION] == 7 device.values.fan_action.data = 9 value_changed(device.values.fan_action) - assert device.device_state_attributes[climate.ATTR_FAN_ACTION] == 9 + assert device.extra_state_attributes[climate.ATTR_FAN_ACTION] == 9 def test_aux_heat_unsupported_set(device): diff --git a/tests/components/zwave/test_init.py b/tests/components/zwave/test_init.py index 878513da579..e76754a9872 100644 --- a/tests/components/zwave/test_init.py +++ b/tests/components/zwave/test_init.py @@ -242,7 +242,7 @@ async def test_device_entity(hass, mock_openzwave): assert not device.should_poll assert device.unique_id == "10-11" assert device.name == "Mock Node Sensor" - assert device.device_state_attributes[zwave.ATTR_POWER] == 50.123 + assert device.extra_state_attributes[zwave.ATTR_POWER] == 50.123 async def test_node_removed(hass, mock_openzwave): diff --git a/tests/components/zwave/test_lock.py b/tests/components/zwave/test_lock.py index d5b6d0a0d27..9050f06f87b 100644 --- a/tests/components/zwave/test_lock.py +++ b/tests/components/zwave/test_lock.py @@ -98,7 +98,7 @@ def test_track_message_workaround(mock_openzwave): device = lock.get_device(node=node, values=values) value_changed(values.primary) assert device.is_locked - assert device.device_state_attributes[lock.ATTR_NOTIFICATION] == "RF Lock" + assert device.extra_state_attributes[lock.ATTR_NOTIFICATION] == "RF Lock" # Simulate a keypad unlock. We trigger a value_changed() which simulates # the Alarm notification received from the lock. Then, we trigger @@ -113,7 +113,7 @@ def test_track_message_workaround(mock_openzwave): value_changed(values.primary) assert not device.is_locked assert ( - device.device_state_attributes[lock.ATTR_LOCK_STATUS] + device.extra_state_attributes[lock.ATTR_LOCK_STATUS] == "Unlocked with Keypad by user 3" ) @@ -122,7 +122,7 @@ def test_track_message_workaround(mock_openzwave): node.stats["lastReceivedMessage"][5] = const.COMMAND_CLASS_DOOR_LOCK value_changed(values.primary) assert device.is_locked - assert device.device_state_attributes[lock.ATTR_NOTIFICATION] == "RF Lock" + assert device.extra_state_attributes[lock.ATTR_NOTIFICATION] == "RF Lock" def test_v2btze_value_changed(mock_openzwave): @@ -198,7 +198,7 @@ def test_lock_access_control(mock_openzwave): ) device = lock.get_device(node=node, values=values, node_config={}) - assert device.device_state_attributes[lock.ATTR_NOTIFICATION] == "Lock Jammed" + assert device.extra_state_attributes[lock.ATTR_NOTIFICATION] == "Lock Jammed" def test_lock_alarm_type(mock_openzwave): @@ -212,28 +212,28 @@ def test_lock_alarm_type(mock_openzwave): ) device = lock.get_device(node=node, values=values, node_config={}) - assert lock.ATTR_LOCK_STATUS not in device.device_state_attributes + assert lock.ATTR_LOCK_STATUS not in device.extra_state_attributes values.alarm_type.data = 21 value_changed(values.alarm_type) assert ( - device.device_state_attributes[lock.ATTR_LOCK_STATUS] == "Manually Locked None" + device.extra_state_attributes[lock.ATTR_LOCK_STATUS] == "Manually Locked None" ) values.alarm_type.data = 18 value_changed(values.alarm_type) assert ( - device.device_state_attributes[lock.ATTR_LOCK_STATUS] + device.extra_state_attributes[lock.ATTR_LOCK_STATUS] == "Locked with Keypad by user None" ) values.alarm_type.data = 161 value_changed(values.alarm_type) - assert device.device_state_attributes[lock.ATTR_LOCK_STATUS] == "Tamper Alarm: None" + assert device.extra_state_attributes[lock.ATTR_LOCK_STATUS] == "Tamper Alarm: None" values.alarm_type.data = 9 value_changed(values.alarm_type) - assert device.device_state_attributes[lock.ATTR_LOCK_STATUS] == "Deadbolt Jammed" + assert device.extra_state_attributes[lock.ATTR_LOCK_STATUS] == "Deadbolt Jammed" def test_lock_alarm_level(mock_openzwave): @@ -247,14 +247,14 @@ def test_lock_alarm_level(mock_openzwave): ) device = lock.get_device(node=node, values=values, node_config={}) - assert lock.ATTR_LOCK_STATUS not in device.device_state_attributes + assert lock.ATTR_LOCK_STATUS not in device.extra_state_attributes values.alarm_type.data = 21 values.alarm_level.data = 1 value_changed(values.alarm_type) value_changed(values.alarm_level) assert ( - device.device_state_attributes[lock.ATTR_LOCK_STATUS] + device.extra_state_attributes[lock.ATTR_LOCK_STATUS] == "Manually Locked by Key Cylinder or Inside thumb turn" ) @@ -263,7 +263,7 @@ def test_lock_alarm_level(mock_openzwave): value_changed(values.alarm_type) value_changed(values.alarm_level) assert ( - device.device_state_attributes[lock.ATTR_LOCK_STATUS] + device.extra_state_attributes[lock.ATTR_LOCK_STATUS] == "Locked with Keypad by user alice" ) @@ -272,7 +272,7 @@ def test_lock_alarm_level(mock_openzwave): value_changed(values.alarm_type) value_changed(values.alarm_level) assert ( - device.device_state_attributes[lock.ATTR_LOCK_STATUS] + device.extra_state_attributes[lock.ATTR_LOCK_STATUS] == "Tamper Alarm: Too many keypresses" ) diff --git a/tests/components/zwave/test_node_entity.py b/tests/components/zwave/test_node_entity.py index ba77aabc923..c47201fb168 100644 --- a/tests/components/zwave/test_node_entity.py +++ b/tests/components/zwave/test_node_entity.py @@ -193,8 +193,7 @@ async def test_application_version(hass, mock_openzwave): # Make sure application version isn't set before assert ( - node_entity.ATTR_APPLICATION_VERSION - not in entity.device_state_attributes.keys() + node_entity.ATTR_APPLICATION_VERSION not in entity.extra_state_attributes.keys() ) # Add entity to hass @@ -212,9 +211,7 @@ async def test_application_version(hass, mock_openzwave): ) await hass.async_block_till_done() - assert ( - entity.device_state_attributes[node_entity.ATTR_APPLICATION_VERSION] == "5.10" - ) + assert entity.extra_state_attributes[node_entity.ATTR_APPLICATION_VERSION] == "5.10" # Fire off a changed value = mock_zwave.MockValue( @@ -227,9 +224,7 @@ async def test_application_version(hass, mock_openzwave): ) await hass.async_block_till_done() - assert ( - entity.device_state_attributes[node_entity.ATTR_APPLICATION_VERSION] == "4.14" - ) + assert entity.extra_state_attributes[node_entity.ATTR_APPLICATION_VERSION] == "4.14" async def test_network_node_changed_from_value(hass, mock_openzwave): @@ -306,7 +301,7 @@ async def test_node_changed(hass, mock_openzwave): "node_name": "Mock Node", "manufacturer_name": "Test Manufacturer", "product_name": "Test Product", - } == entity.device_state_attributes + } == entity.extra_state_attributes node.get_values.return_value = {1: mock_zwave.MockValue(data=1800)} zwave_network.manager.getNodeStatistics.return_value = { @@ -616,12 +611,12 @@ async def test_node_changed(hass, mock_openzwave): "sentCnt": 7, "sentFailed": 1, "sentTS": "2017-03-27 15:38:15:620 ", - } == entity.device_state_attributes + } == entity.extra_state_attributes node.can_wake_up_value = False entity.node_changed() - assert "wake_up_interval" not in entity.device_state_attributes + assert "wake_up_interval" not in entity.extra_state_attributes async def test_name(hass, mock_openzwave): diff --git a/tests/testing_config/custom_components/test/image_processing.py b/tests/testing_config/custom_components/test/image_processing.py index a2004fe32bd..343c60a78fe 100644 --- a/tests/testing_config/custom_components/test/image_processing.py +++ b/tests/testing_config/custom_components/test/image_processing.py @@ -41,7 +41,7 @@ class TestImageProcessing(ImageProcessingEntity): return self._count @property - def device_state_attributes(self): + def extra_state_attributes(self): """Return device specific state attributes.""" return {"image": self._image}