Skip to content

Commit

Permalink
Update integrations t-z to override extra_state_attributes() (#47760)
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery committed Mar 11, 2021
1 parent 14a59d2 commit 1fc8e32
Show file tree
Hide file tree
Showing 127 changed files with 218 additions and 223 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/tado/binary_sensor.py
Expand Up @@ -231,7 +231,7 @@ def device_class(self):
return None

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._state_attributes

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tado/climate.py
Expand Up @@ -462,7 +462,7 @@ def swing_modes(self):
return None

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return temperature offset."""
return self._tado_zone_temp_offset

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tado/sensor.py
Expand Up @@ -132,7 +132,7 @@ def state(self):
return self._state

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._state_attributes

Expand Down Expand Up @@ -237,7 +237,7 @@ def state(self):
return self._state

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._state_attributes

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tahoma/__init__.py
Expand Up @@ -137,7 +137,7 @@ def name(self):
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}

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tahoma/binary_sensor.py
Expand Up @@ -57,10 +57,10 @@ def icon(self):
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)

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tahoma/cover.py
Expand Up @@ -194,10 +194,10 @@ def device_class(self):
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)

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tahoma/lock.py
Expand Up @@ -78,12 +78,12 @@ def is_locked(self):
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
2 changes: 1 addition & 1 deletion homeassistant/components/tahoma/scene.py
Expand Up @@ -37,6 +37,6 @@ def name(self):
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}
4 changes: 2 additions & 2 deletions homeassistant/components/tahoma/sensor.py
Expand Up @@ -110,10 +110,10 @@ def update(self):
_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)

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tahoma/switch.py
Expand Up @@ -105,10 +105,10 @@ def is_on(self):
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)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tank_utility/sensor.py
Expand Up @@ -97,7 +97,7 @@ def unit_of_measurement(self):
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

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tankerkoenig/sensor.py
Expand Up @@ -125,7 +125,7 @@ def unique_id(self) -> str:
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]

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tautulli/sensor.py
Expand Up @@ -130,7 +130,7 @@ def unit_of_measurement(self):
return "Watching"

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return attributes for the sensor."""
return self._attributes

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tellduslive/entry.py
Expand Up @@ -81,7 +81,7 @@ def available(self):
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:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/template/template_entity.py
Expand Up @@ -168,7 +168,7 @@ def entity_picture(self):
return self._entity_picture

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._attributes

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tensorflow/image_processing.py
Expand Up @@ -279,7 +279,7 @@ def state(self):
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,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tesla/__init__.py
Expand Up @@ -307,7 +307,7 @@ def icon(self):
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():
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/tesla/device_tracker.py
Expand Up @@ -42,9 +42,9 @@ def source_type(self):
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(
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tesla/sensor.py
Expand Up @@ -81,7 +81,7 @@ def device_class(self) -> Optional[str]:
)

@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":
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/thermoworks_smoke/sensor.py
Expand Up @@ -124,7 +124,7 @@ def state(self):
return self._state

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._attributes

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/thethingsnetwork/sensor.py
Expand Up @@ -92,7 +92,7 @@ def unit_of_measurement(self):
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 {
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/threshold/binary_sensor.py
Expand Up @@ -144,7 +144,7 @@ def threshold_type(self):
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,
Expand Down
18 changes: 9 additions & 9 deletions homeassistant/components/tibber/sensor.py
Expand Up @@ -54,7 +54,7 @@ def __init__(self, tibber_home):
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(
Expand All @@ -63,9 +63,9 @@ def __init__(self, tibber_home):
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):
Expand Down Expand Up @@ -121,10 +121,10 @@ async def async_update(self):

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
Expand Down Expand Up @@ -165,11 +165,11 @@ async def _fetch_data(self):
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"]

Expand Down Expand Up @@ -197,7 +197,7 @@ async def _async_callback(self, payload):
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()

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tile/device_tracker.py
Expand Up @@ -81,7 +81,7 @@ def battery_level(self):
return None

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
return self._attrs

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tmb/sensor.py
Expand Up @@ -101,7 +101,7 @@ def state(self):
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,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tod/binary_sensor.py
Expand Up @@ -109,7 +109,7 @@ def next_update(self):
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(),
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/todoist/calendar.py
Expand Up @@ -284,7 +284,7 @@ async def async_get_events(self, hass, start_date, end_date):
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.
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/toon/climate.py
Expand Up @@ -114,7 +114,7 @@ def max_temp(self) -> float:
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}

Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/totalconnect/alarm_control_panel.py
Expand Up @@ -44,7 +44,7 @@ def __init__(self, name, location_id, client):
self._location_id = location_id
self._client = client
self._state = None
self._device_state_attributes = {}
self._extra_state_attributes = {}

@property
def name(self):
Expand All @@ -62,9 +62,9 @@ def supported_features(self) -> int:
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."""
Expand Down Expand Up @@ -109,7 +109,7 @@ def update(self):
state = None

self._state = state
self._device_state_attributes = attr
self._extra_state_attributes = attr

def alarm_disarm(self, code=None):
"""Send disarm command."""
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/totalconnect/binary_sensor.py
Expand Up @@ -73,7 +73,7 @@ def device_class(self):
return None

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attributes = {
"zone_id": self._zone_id,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tplink/light.py
Expand Up @@ -163,7 +163,7 @@ def available(self) -> bool:
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

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tplink/switch.py
Expand Up @@ -100,7 +100,7 @@ def turn_off(self, **kwargs):
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

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/traccar/device_tracker.py
Expand Up @@ -345,7 +345,7 @@ def battery_level(self):
return self._battery

@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device specific attributes."""
return self._attributes

Expand Down

0 comments on commit 1fc8e32

Please sign in to comment.