Remove deprecated device_state_attributes (#55734)

pull/55750/head
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):
"""Sensor representing FliprSensor data."""
_attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION}
@property
def name(self):
"""Return the name of the particular component."""
@ -84,8 +86,3 @@ class FliprSensor(FliprEntity, SensorEntity):
def native_unit_of_measurement(self):
"""Return unit of measurement."""
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
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
door = self._get_door()
if door.sensorid is not None:

View File

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

View File

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

View File

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

View File

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