Remove deprecated device_state_attributes (#55734)

This commit is contained in:
Marc Mueller 2021-09-04 22:16:01 +02:00 committed by GitHub
parent 58da58c008
commit f5a543b220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 15 deletions

View file

@ -57,6 +57,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class FliprSensor(FliprEntity, SensorEntity): class FliprSensor(FliprEntity, SensorEntity):
"""Sensor representing FliprSensor data.""" """Sensor representing FliprSensor data."""
_attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION}
@property @property
def name(self): def name(self):
"""Return the name of the particular component.""" """Return the name of the particular component."""
@ -84,8 +86,3 @@ class FliprSensor(FliprEntity, SensorEntity):
def native_unit_of_measurement(self): def native_unit_of_measurement(self):
"""Return unit of measurement.""" """Return unit of measurement."""
return SENSORS[self.info_type]["unit"] return SENSORS[self.info_type]["unit"]
@property
def device_state_attributes(self):
"""Return device attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -121,7 +121,7 @@ class DoorSensorTemperature(GoGoGate2Entity, SensorEntity):
return TEMP_CELSIUS return TEMP_CELSIUS
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
door = self._get_door() door = self._get_door()
if door.sensorid is not None: if door.sensorid is not None:

View file

@ -205,7 +205,7 @@ class MediaGroup(MediaPlayerEntity):
return False return False
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the state attributes for the media group.""" """Return the state attributes for the media group."""
return {ATTR_ENTITY_ID: self._entities} return {ATTR_ENTITY_ID: self._entities}

View file

@ -55,6 +55,7 @@ class NWSSensor(CoordinatorEntity, SensorEntity):
"""An NWS Sensor Entity.""" """An NWS Sensor Entity."""
entity_description: NWSSensorEntityDescription entity_description: NWSSensorEntityDescription
_attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION}
def __init__( def __init__(
self, self,
@ -95,11 +96,6 @@ class NWSSensor(CoordinatorEntity, SensorEntity):
return round(value) return round(value)
return value return value
@property
def device_state_attributes(self):
"""Return the attribution."""
return {ATTR_ATTRIBUTION: ATTRIBUTION}
@property @property
def unique_id(self): def unique_id(self):
"""Return a unique_id for this entity.""" """Return a unique_id for this entity."""

View file

@ -26,7 +26,7 @@ UNDO_UPDATE_LISTENER = "undo_update_listener"
DEFAULT_SCAN_INTERVAL = 5 DEFAULT_SCAN_INTERVAL = 5
MIN_UPDATE_INTERVAL = timedelta(minutes=1) MIN_UPDATE_INTERVAL = timedelta(minutes=1)
DEVICE_STATE_ATTRIBUTES = { EXTRA_STATE_ATTRIBUTES = {
"beer_name": "beer_name", "beer_name": "beer_name",
"keg_date": "keg_date", "keg_date": "keg_date",
"mode": "mode", "mode": "mode",

View file

@ -7,9 +7,9 @@ from .const import (
DEVICE, DEVICE,
DEVICE_ID, DEVICE_ID,
DEVICE_NAME, DEVICE_NAME,
DEVICE_STATE_ATTRIBUTES,
DEVICE_TYPE, DEVICE_TYPE,
DOMAIN, DOMAIN,
EXTRA_STATE_ATTRIBUTES,
SENSOR_DATA, SENSOR_DATA,
SENSOR_SIGNAL, SENSOR_SIGNAL,
) )
@ -73,7 +73,7 @@ class PlaatoEntity(entity.Entity):
if self._attributes: if self._attributes:
return { return {
attr_key: self._attributes[plaato_key] attr_key: self._attributes[plaato_key]
for attr_key, plaato_key in DEVICE_STATE_ATTRIBUTES.items() for attr_key, plaato_key in EXTRA_STATE_ATTRIBUTES.items()
if plaato_key in self._attributes if plaato_key in self._attributes
and self._attributes[plaato_key] is not None and self._attributes[plaato_key] is not None
} }