Update integrations p-s to override extra_state_attributes() (#47759)

This commit is contained in:
Erik Montnemery 2021-03-11 21:23:20 +01:00 committed by GitHub
parent 1fc8e32d86
commit 14ff6d4d1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
106 changed files with 144 additions and 146 deletions

View file

@ -93,6 +93,6 @@ class PencomRelay(SwitchEntity):
self._state = self._hub.get(self._board, self._addr) self._state = self._hub.get(self._board, self._addr)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return supported attributes.""" """Return supported attributes."""
return {"board": self._board, "addr": self._addr} return {"board": self._board, "addr": self._addr}

View file

@ -73,6 +73,6 @@ class PiHoleSensor(PiHoleEntity):
return self.api.data[self._condition] return self.api.data[self._condition]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the Pi-hole.""" """Return the state attributes of the Pi-hole."""
return {ATTR_BLOCKED_DOMAINS: self.api.data["domains_being_blocked"]} return {ATTR_BLOCKED_DOMAINS: self.api.data["domains_being_blocked"]}

View file

@ -105,7 +105,7 @@ class PingBinarySensor(BinarySensorEntity):
return self._ping.available return self._ping.available
@property @property
def device_state_attributes(self) -> Dict[str, Any]: def extra_state_attributes(self) -> Dict[str, Any]:
"""Return the state attributes of the ICMP checo request.""" """Return the state attributes of the ICMP checo request."""
if self._ping.data is not False: if self._ping.data is not False:
return { return {

View file

@ -68,7 +68,7 @@ class PlaatoEntity(entity.Entity):
return device_info return device_info
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the monitored installation.""" """Return the state attributes of the monitored installation."""
if self._attributes: if self._attributes:
return { return {

View file

@ -522,7 +522,7 @@ class PlexMediaPlayer(MediaPlayerEntity):
_LOGGER.error("Timed out playing on %s", self.name) _LOGGER.error("Timed out playing on %s", self.name)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the scene state attributes.""" """Return the scene state attributes."""
attributes = {} attributes = {}
for attr in [ for attr in [

View file

@ -89,7 +89,7 @@ class PlexSensor(Entity):
return "mdi:plex" return "mdi:plex"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._server.sensor_attributes return self._server.sensor_attributes

View file

@ -143,7 +143,7 @@ class PwNotifySensor(SmileBinarySensor, BinarySensorEntity):
self._attributes = {} self._attributes = {}
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._attributes return self._attributes

View file

@ -124,7 +124,7 @@ class PwThermostat(SmileGateway, ClimateEntity):
return SUPPORT_FLAGS return SUPPORT_FLAGS
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device specific state attributes.""" """Return the device specific state attributes."""
attributes = {} attributes = {}
if self._schema_names: if self._schema_names:

View file

@ -296,7 +296,7 @@ class MinutPointEntity(Entity):
return self._id return self._id
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return status of device.""" """Return status of device."""
attrs = self.device.device_status attrs = self.device.device_status
attrs["last_heard_from"] = as_local(self.last_update).strftime( attrs["last_heard_from"] = as_local(self.last_update).strftime(

View file

@ -108,6 +108,6 @@ class PoolSenseSensor(PoolSenseEntity, Entity):
return SENSORS[self.info_type]["unit"] return SENSORS[self.info_type]["unit"]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device attributes.""" """Return device attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -136,7 +136,7 @@ class PowerWallEnergySensor(PowerWallEntity):
) )
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device specific state attributes.""" """Return the device specific state attributes."""
meter = self.coordinator.data[POWERWALL_API_METERS].get_meter(self._meter) meter = self.coordinator.data[POWERWALL_API_METERS].get_meter(self._meter)
return { return {

View file

@ -84,7 +84,7 @@ class ProliphixThermostat(ClimateEntity):
return PRECISION_TENTHS return PRECISION_TENTHS
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device specific state attributes.""" """Return the device specific state attributes."""
return {ATTR_FAN: self._pdp.fan_state} return {ATTR_FAN: self._pdp.fan_state}

View file

@ -175,7 +175,7 @@ class PushCamera(Camera):
return False return False
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
name: value name: value

View file

@ -85,7 +85,7 @@ class PushBulletNotificationSensor(Entity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return all known attributes of the sensor.""" """Return all known attributes of the sensor."""
return self._state_attributes return self._state_attributes

View file

@ -100,7 +100,7 @@ class PvoutputSensor(Entity):
return None return None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the monitored installation.""" """Return the state attributes of the monitored installation."""
if self.pvcoutput is not None: if self.pvcoutput is not None:
return { return {

View file

@ -112,7 +112,7 @@ class ElecPriceSensor(RestoreEntity):
return self._pvpc_data.state_available return self._pvpc_data.state_available
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._pvpc_data.attributes return self._pvpc_data.attributes

View file

@ -234,7 +234,7 @@ class QldBushfireLocationEvent(GeolocationEvent):
return LENGTH_KILOMETERS return LENGTH_KILOMETERS
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
attributes = {} attributes = {}
for key, value in ( for key, value in (

View file

@ -268,7 +268,7 @@ class QNAPMemorySensor(QNAPSensor):
return round(used / total * 100) return round(used / total * 100)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._api.data: if self._api.data:
data = self._api.data["system_stats"]["memory"] data = self._api.data["system_stats"]["memory"]
@ -294,7 +294,7 @@ class QNAPNetworkSensor(QNAPSensor):
return round_nicely(data["rx"] / 1024 / 1024) return round_nicely(data["rx"] / 1024 / 1024)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._api.data: if self._api.data:
data = self._api.data["system_stats"]["nics"][self.monitor_device] data = self._api.data["system_stats"]["nics"][self.monitor_device]
@ -322,7 +322,7 @@ class QNAPSystemSensor(QNAPSensor):
return int(self._api.data["system_stats"]["system"]["temp_c"]) return int(self._api.data["system_stats"]["system"]["temp_c"])
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._api.data: if self._api.data:
data = self._api.data["system_stats"] data = self._api.data["system_stats"]
@ -360,7 +360,7 @@ class QNAPDriveSensor(QNAPSensor):
return f"{server_name} {self.var_name} (Drive {self.monitor_device})" return f"{server_name} {self.var_name} (Drive {self.monitor_device})"
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._api.data: if self._api.data:
data = self._api.data["smart_drive_health"][self.monitor_device] data = self._api.data["smart_drive_health"][self.monitor_device]
@ -394,7 +394,7 @@ class QNAPVolumeSensor(QNAPSensor):
return round(used_gb / total_gb * 100) return round(used_gb / total_gb * 100)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._api.data: if self._api.data:
data = self._api.data["volumes"][self.monitor_device] data = self._api.data["volumes"][self.monitor_device]

View file

@ -82,7 +82,7 @@ class QVRProCamera(Camera):
return self._brand return self._brand
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Get the state attributes.""" """Get the state attributes."""
attrs = {"qvr_guid": self.guid} attrs = {"qvr_guid": self.guid}

View file

@ -388,7 +388,7 @@ class RachioZone(RachioSwitch):
return self._entity_picture return self._entity_picture
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the optional state attributes.""" """Return the optional state attributes."""
props = {ATTR_ZONE_NUMBER: self._zone_number, ATTR_ZONE_SUMMARY: self._summary} props = {ATTR_ZONE_NUMBER: self._zone_number, ATTR_ZONE_SUMMARY: self._summary}
if self._shade_type: if self._shade_type:
@ -494,7 +494,7 @@ class RachioSchedule(RachioSwitch):
return "mdi:water" if self.schedule_is_enabled else "mdi:water-off" return "mdi:water" if self.schedule_is_enabled else "mdi:water-off"
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the optional state attributes.""" """Return the optional state attributes."""
return { return {
ATTR_SCHEDULE_SUMMARY: self._summary, ATTR_SCHEDULE_SUMMARY: self._summary,

View file

@ -144,7 +144,7 @@ class RadarrSensor(Entity):
return self._unit return self._unit
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
attributes = {} attributes = {}
if self.type == "upcoming": if self.type == "upcoming":

View file

@ -181,7 +181,7 @@ class RadioThermostat(ClimateEntity):
return PRECISION_HALVES return PRECISION_HALVES
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device specific state attributes.""" """Return the device specific state attributes."""
return {ATTR_FAN_ACTION: self._fstate} return {ATTR_FAN_ACTION: self._fstate}

View file

@ -78,7 +78,7 @@ class RainBirdSwitch(SwitchEntity):
self._attributes = {ATTR_DURATION: self._duration, "zone": self._zone} self._attributes = {ATTR_DURATION: self._duration, "zone": self._zone}
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return state attributes.""" """Return state attributes."""
return self._attributes return self._attributes

View file

@ -166,7 +166,7 @@ class RainCloudEntity(Entity):
return UNIT_OF_MEASUREMENT_MAP.get(self._sensor_type) return UNIT_OF_MEASUREMENT_MAP.get(self._sensor_type)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION, "identifier": self.data.serial} return {ATTR_ATTRIBUTION: ATTRIBUTION, "identifier": self.data.serial}

View file

@ -83,7 +83,7 @@ class RainCloudSwitch(RainCloudEntity, SwitchEntity):
self._state = self.data.auto_watering self._state = self.data.auto_watering
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View file

@ -225,7 +225,7 @@ class RainMachineEntity(CoordinatorEntity):
} }
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the state attributes.""" """Return the state attributes."""
return self._attrs return self._attrs

View file

@ -74,7 +74,7 @@ class RandomSensor(Entity):
return self._unit_of_measurement return self._unit_of_measurement
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the attributes of the sensor.""" """Return the attributes of the sensor."""
return {ATTR_MAXIMUM: self._maximum, ATTR_MINIMUM: self._minimum} return {ATTR_MAXIMUM: self._maximum, ATTR_MINIMUM: self._minimum}

View file

@ -86,7 +86,7 @@ class ReCollectWasteSensor(CoordinatorEntity):
self._state = None self._state = None
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the state attributes.""" """Return the state attributes."""
return self._attributes return self._attributes

View file

@ -105,7 +105,7 @@ class RedditSensor(Entity):
return len(self._subreddit_data) return len(self._subreddit_data)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_SUBREDDIT: self._subreddit, ATTR_SUBREDDIT: self._subreddit,

View file

@ -110,7 +110,7 @@ class RejseplanenTransportSensor(Entity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if not self._times: if not self._times:
return {ATTR_STOP_ID: self._stop_id, ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_STOP_ID: self._stop_id, ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -66,7 +66,7 @@ class RepetierSensor(Entity):
return self._available return self._available
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return sensor attributes.""" """Return sensor attributes."""
return self._attributes return self._attributes

View file

@ -119,7 +119,7 @@ class RestSensor(RestEntity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._attributes return self._attributes

View file

@ -194,7 +194,7 @@ class DimmableRflinkLight(SwitchableRflinkDevice, LightEntity):
return self._brightness return self._brightness
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
if self._brightness is None: if self._brightness is None:
return {} return {}
@ -256,7 +256,7 @@ class HybridRflinkLight(SwitchableRflinkDevice, LightEntity):
return self._brightness return self._brightness
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
if self._brightness is None: if self._brightness is None:
return {} return {}

View file

@ -505,7 +505,7 @@ class RfxtrxEntity(RestoreEntity):
return self._name return self._name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
if not self._event: if not self._event:
return None return None

View file

@ -111,9 +111,9 @@ class RingBinarySensor(RingEntityMixin, BinarySensorEntity):
return self._unique_id return self._unique_id
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attrs = super().device_state_attributes attrs = super().extra_state_attributes
if self._active_alert is None: if self._active_alert is None:
return attrs return attrs

View file

@ -93,7 +93,7 @@ class RingCam(RingEntityMixin, Camera):
return self._device.id return self._device.id
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View file

@ -38,7 +38,7 @@ class RingEntityMixin:
return False return False
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -180,9 +180,9 @@ class HistoryRingSensor(RingSensor):
return self._latest_event["created_at"].isoformat() return self._latest_event["created_at"].isoformat()
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attrs = super().device_state_attributes attrs = super().extra_state_attributes
if self._latest_event: if self._latest_event:
attrs["created_at"] = self._latest_event["created_at"] attrs["created_at"] = self._latest_event["created_at"]

View file

@ -57,7 +57,7 @@ class RippleSensor(Entity):
return self._unit_of_measurement return self._unit_of_measurement
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -60,7 +60,7 @@ class RiscoBinarySensor(BinarySensorEntity, RiscoEntity):
return binary_sensor_unique_id(self._risco, self._zone_id) return binary_sensor_unique_id(self._risco, self._zone_id)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {"zone_id": self._zone_id, "bypassed": self._zone.bypassed} return {"zone_id": self._zone_id, "bypassed": self._zone.bypassed}

View file

@ -94,7 +94,7 @@ class RiscoSensor(CoordinatorEntity):
return self._event.time return self._event.time
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""State attributes.""" """State attributes."""
if self._event is None: if self._event is None:
return None return None

View file

@ -66,7 +66,7 @@ class DiffuserSwitch(SwitchEntity):
return ICON return ICON
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
attributes = { attributes = {
"fan_speed": self._diffuser.data["hub"]["attributes"]["speedc"], "fan_speed": self._diffuser.data["hub"]["attributes"]["speedc"],

View file

@ -116,9 +116,9 @@ class BraavaJet(IRobotVacuum):
) )
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the device.""" """Return the state attributes of the device."""
state_attrs = super().device_state_attributes state_attrs = super().extra_state_attributes
# Get Braava state # Get Braava state
state = self.vacuum_state state = self.vacuum_state

View file

@ -168,7 +168,7 @@ class IRobotVacuum(IRobotEntity, StateVacuumEntity):
return self._name return self._name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the device.""" """Return the state attributes of the device."""
state = self.vacuum_state state = self.vacuum_state

View file

@ -23,9 +23,9 @@ class RoombaVacuum(IRobotVacuum):
"""Basic Roomba robot (without carpet boost).""" """Basic Roomba robot (without carpet boost)."""
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the device.""" """Return the state attributes of the device."""
state_attrs = super().device_state_attributes state_attrs = super().extra_state_attributes
# Get bin state # Get bin state
bin_raw_state = self.vacuum_state.get("bin", {}) bin_raw_state = self.vacuum_state.get("bin", {})

View file

@ -101,7 +101,7 @@ class SenseDevice(BinarySensorEntity):
return self._id return self._id
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -163,7 +163,7 @@ class SenseActiveSensor(Entity):
return POWER_WATT return POWER_WATT
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}
@ -247,7 +247,7 @@ class SenseVoltageSensor(Entity):
return VOLT return VOLT
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}
@ -333,7 +333,7 @@ class SenseTrendsSensor(Entity):
return self._unit_of_measurement return self._unit_of_measurement
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}
@ -415,7 +415,7 @@ class SenseEnergyDevice(Entity):
return POWER_WATT return POWER_WATT
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -191,7 +191,7 @@ class SensiboClimate(ClimateEntity):
return self._external_state or super().state return self._external_state or super().state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return {"battery": self.current_battery} return {"battery": self.current_battery}

View file

@ -241,7 +241,7 @@ class SerialSensor(Entity):
return False return False
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the attributes of the entity (if any JSON present).""" """Return the attributes of the entity (if any JSON present)."""
return self._attributes return self._attributes

View file

@ -86,7 +86,7 @@ class SesameDevice(LockEntity):
self._responsive = status["responsive"] self._responsive = status["responsive"]
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_DEVICE_ID: self._device_id, ATTR_DEVICE_ID: self._device_id,

View file

@ -109,7 +109,7 @@ class SeventeenTrackSummarySensor(Entity):
return self._state is not None return self._state is not None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
return self._attrs return self._attrs
@ -190,7 +190,7 @@ class SeventeenTrackPackageSensor(Entity):
return self._data.packages.get(self._tracking_number) is not None return self._data.packages.get(self._tracking_number) is not None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
return self._attrs return self._attrs

View file

@ -255,7 +255,7 @@ class SharkVacuumEntity(CoordinatorEntity, StateVacuumEntity):
return self.sharkiq.get_property_value(Properties.LOW_LIGHT_MISSION) return self.sharkiq.get_property_value(Properties.LOW_LIGHT_MISSION)
@property @property
def device_state_attributes(self) -> Dict: def extra_state_attributes(self) -> Dict:
"""Return a dictionary of device state attributes specific to sharkiq.""" """Return a dictionary of device state attributes specific to sharkiq."""
data = { data = {
ATTR_ERROR_CODE: self.error_code, ATTR_ERROR_CODE: self.error_code,

View file

@ -47,7 +47,7 @@ SENSORS = {
name="Gas", name="Gas",
device_class=DEVICE_CLASS_GAS, device_class=DEVICE_CLASS_GAS,
value=lambda value: value in ["mild", "heavy"], value=lambda value: value in ["mild", "heavy"],
device_state_attributes=lambda block: {"detected": block.gas}, extra_state_attributes=lambda block: {"detected": block.gas},
), ),
("sensor", "smoke"): BlockAttributeDescription( ("sensor", "smoke"): BlockAttributeDescription(
name="Smoke", device_class=DEVICE_CLASS_SMOKE name="Smoke", device_class=DEVICE_CLASS_SMOKE
@ -95,7 +95,7 @@ REST_SENSORS = {
icon="mdi:update", icon="mdi:update",
value=lambda status, _: status["update"]["has_update"], value=lambda status, _: status["update"]["has_update"],
default_enabled=False, default_enabled=False,
device_state_attributes=lambda status: { extra_state_attributes=lambda status: {
"latest_stable_version": status["update"]["new_version"], "latest_stable_version": status["update"]["new_version"],
"installed_version": status["update"]["old_version"], "installed_version": status["update"]["old_version"],
}, },

View file

@ -150,9 +150,7 @@ class BlockAttributeDescription:
available: Optional[Callable[[aioshelly.Block], bool]] = None available: Optional[Callable[[aioshelly.Block], bool]] = None
# Callable (settings, block), return true if entity should be removed # Callable (settings, block), return true if entity should be removed
removal_condition: Optional[Callable[[dict, aioshelly.Block], bool]] = None removal_condition: Optional[Callable[[dict, aioshelly.Block], bool]] = None
device_state_attributes: Optional[ extra_state_attributes: Optional[Callable[[aioshelly.Block], Optional[dict]]] = None
Callable[[aioshelly.Block], Optional[dict]]
] = None
@dataclass @dataclass
@ -165,7 +163,7 @@ class RestAttributeDescription:
value: Callable[[dict, Any], Any] = None value: Callable[[dict, Any], Any] = None
device_class: Optional[str] = None device_class: Optional[str] = None
default_enabled: bool = True default_enabled: bool = True
device_state_attributes: Optional[Callable[[dict], Optional[dict]]] = None extra_state_attributes: Optional[Callable[[dict], Optional[dict]]] = None
class ShellyBlockEntity(entity.Entity): class ShellyBlockEntity(entity.Entity):
@ -293,12 +291,12 @@ class ShellyBlockAttributeEntity(ShellyBlockEntity, entity.Entity):
return self.description.available(self.block) return self.description.available(self.block)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self.description.device_state_attributes is None: if self.description.extra_state_attributes is None:
return None return None
return self.description.device_state_attributes(self.block) return self.description.extra_state_attributes(self.block)
class ShellyRestAttributeEntity(update_coordinator.CoordinatorEntity): class ShellyRestAttributeEntity(update_coordinator.CoordinatorEntity):
@ -369,12 +367,12 @@ class ShellyRestAttributeEntity(update_coordinator.CoordinatorEntity):
return f"{self.wrapper.mac}-{self.attribute}" return f"{self.wrapper.mac}-{self.attribute}"
@property @property
def device_state_attributes(self) -> dict: def extra_state_attributes(self) -> dict:
"""Return the state attributes.""" """Return the state attributes."""
if self.description.device_state_attributes is None: if self.description.extra_state_attributes is None:
return None return None
return self.description.device_state_attributes(self.wrapper.device.status) return self.description.extra_state_attributes(self.wrapper.device.status)
class ShellySleepingBlockAttributeEntity(ShellyBlockAttributeEntity, RestoreEntity): class ShellySleepingBlockAttributeEntity(ShellyBlockAttributeEntity, RestoreEntity):

View file

@ -159,7 +159,7 @@ SENSORS = {
unit=PERCENTAGE, unit=PERCENTAGE,
icon="mdi:progress-wrench", icon="mdi:progress-wrench",
value=lambda value: round(100 - (value / 3600 / SHAIR_MAX_WORK_HOURS), 1), value=lambda value: round(100 - (value / 3600 / SHAIR_MAX_WORK_HOURS), 1),
device_state_attributes=lambda block: { extra_state_attributes=lambda block: {
"Operational hours": round(block.totalWorkTime / 3600, 1) "Operational hours": round(block.totalWorkTime / 3600, 1)
}, },
), ),

View file

@ -78,7 +78,7 @@ class ShodanSensor(Entity):
return ICON return ICON
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -155,6 +155,6 @@ class SigfoxDevice(Entity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return other details about the last message.""" """Return other details about the last message."""
return self._message_data return self._message_data

View file

@ -170,7 +170,7 @@ class SighthoundEntity(ImageProcessingEntity):
return ATTR_PEOPLE return ATTR_PEOPLE
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the attributes.""" """Return the attributes."""
if not self._last_detection: if not self._last_detection:
return {} return {}

View file

@ -634,7 +634,7 @@ class SimpliSafeEntity(CoordinatorEntity):
return self._device_info return self._device_info
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._attrs return self._attrs

View file

@ -137,7 +137,7 @@ class SimulatedSensor(Entity):
return self._unit return self._unit
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return other details about the sensor state.""" """Return other details about the sensor state."""
return { return {
"amplitude": self._amp, "amplitude": self._amp,

View file

@ -86,7 +86,7 @@ class SkybeaconHumid(Entity):
return PERCENTAGE return PERCENTAGE
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1} return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1}
@ -115,7 +115,7 @@ class SkybeaconTemp(Entity):
return TEMP_CELSIUS return TEMP_CELSIUS
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1} return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1}

View file

@ -82,7 +82,7 @@ class SkybellDevice(Entity):
self._device.refresh() self._device.refresh()
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_ATTRIBUTION: ATTRIBUTION,

View file

@ -76,9 +76,9 @@ class SkybellBinarySensor(SkybellDevice, BinarySensorEntity):
return self._device_class return self._device_class
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attrs = super().device_state_attributes attrs = super().extra_state_attributes
attrs["event_date"] = self._event.get("createdAt") attrs["event_date"] = self._event.get("createdAt")

View file

@ -55,7 +55,7 @@ class SlideCover(CoverEntity):
return self._name return self._name
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific state attributes.""" """Return device specific state attributes."""
return {ATTR_ID: self._id} return {ATTR_ID: self._id}

View file

@ -196,7 +196,7 @@ class SMAsensor(Entity):
return self._sensor.unit return self._sensor.unit
@property @property
def device_state_attributes(self): # Can be remove from 0.99 def extra_state_attributes(self): # Can be remove from 0.99
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
return self._attr return self._attr

View file

@ -65,7 +65,7 @@ class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device specific state attributes.""" """Return the device specific state attributes."""
attributes = { attributes = {
METER_NUMBER: self.meter.meter, METER_NUMBER: self.meter.meter,

View file

@ -415,7 +415,7 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
return self._device.status.temperature return self._device.status.temperature
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
""" """
Return device specific state attributes. Return device specific state attributes.

View file

@ -147,7 +147,7 @@ class SmartThingsCover(SmartThingsEntity, CoverEntity):
return self._device_class return self._device_class
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Get additional state attributes.""" """Get additional state attributes."""
return self._state_attrs return self._state_attrs

View file

@ -57,7 +57,7 @@ class SmartThingsLock(SmartThingsEntity, LockEntity):
return self._device.status.lock == ST_STATE_LOCKED return self._device.status.lock == ST_STATE_LOCKED
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific state attributes.""" """Return device specific state attributes."""
state_attrs = {} state_attrs = {}
status = self._device.status.attributes[Attribute.lock] status = self._device.status.attributes[Attribute.lock]

View file

@ -24,7 +24,7 @@ class SmartThingsScene(Scene):
await self._scene.execute() await self._scene.execute()
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Get attributes about the state.""" """Get attributes about the state."""
return { return {
"icon": self._scene.icon, "icon": self._scene.icon,

View file

@ -70,7 +70,7 @@ class SmartTubPrimaryFiltrationCycle(SmartTubSensor):
return self._state.status.name.lower() return self._state.status.name.lower()
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
state = self._state state = self._state
return { return {
@ -96,7 +96,7 @@ class SmartTubSecondaryFiltrationCycle(SmartTubSensor):
return self._state.status.name.lower() return self._state.status.name.lower()
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
state = self._state state = self._state
return { return {

View file

@ -235,7 +235,7 @@ class SmhiWeather(WeatherEntity):
return data return data
@property @property
def device_state_attributes(self) -> Dict: def extra_state_attributes(self) -> Dict:
"""Return SMHI specific attributes.""" """Return SMHI specific attributes."""
if self.cloudiness: if self.cloudiness:
return {ATTR_SMHI_CLOUDINESS: self.cloudiness} return {ATTR_SMHI_CLOUDINESS: self.cloudiness}

View file

@ -75,7 +75,7 @@ class GSMSignalSensor(Entity):
_LOGGER.error("Failed to read signal quality: %s", exc) _LOGGER.error("Failed to read signal quality: %s", exc)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the sensor attributes.""" """Return the sensor attributes."""
return self._state return self._state

View file

@ -164,7 +164,7 @@ class SnapcastGroupDevice(MediaPlayerEntity):
return list(self._group.streams_by_name().keys()) return list(self._group.streams_by_name().keys())
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
name = f"{self._group.friendly_name} {GROUP_SUFFIX}" name = f"{self._group.friendly_name} {GROUP_SUFFIX}"
return {"friendly_name": name} return {"friendly_name": name}
@ -261,7 +261,7 @@ class SnapcastClientDevice(MediaPlayerEntity):
return STATE_OFF return STATE_OFF
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
state_attrs = {} state_attrs = {}
if self.latency is not None: if self.latency is not None:

View file

@ -69,7 +69,7 @@ class SochainSensor(Entity):
return self._unit_of_measurement return self._unit_of_measurement
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
return {ATTR_ATTRIBUTION: ATTRIBUTION} return {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -64,7 +64,7 @@ class SocialBladeSensor(Entity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._attributes: if self._attributes:
return self._attributes return self._attributes

View file

@ -162,7 +162,7 @@ class SolarEdgeDetailsSensor(SolarEdgeSensor):
"""Representation of an SolarEdge Monitoring API details sensor.""" """Representation of an SolarEdge Monitoring API details sensor."""
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self.data_service.attributes return self.data_service.attributes
@ -182,7 +182,7 @@ class SolarEdgeInventorySensor(SolarEdgeSensor):
self._json_key = SENSOR_TYPES[self.sensor_key][0] self._json_key = SENSOR_TYPES[self.sensor_key][0]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self.data_service.attributes.get(self._json_key) return self.data_service.attributes.get(self._json_key)
@ -202,7 +202,7 @@ class SolarEdgeEnergyDetailsSensor(SolarEdgeSensor):
self._json_key = SENSOR_TYPES[self.sensor_key][0] self._json_key = SENSOR_TYPES[self.sensor_key][0]
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self.data_service.attributes.get(self._json_key) return self.data_service.attributes.get(self._json_key)
@ -232,7 +232,7 @@ class SolarEdgePowerFlowSensor(SolarEdgeSensor):
return DEVICE_CLASS_POWER return DEVICE_CLASS_POWER
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self.data_service.attributes.get(self._json_key) return self.data_service.attributes.get(self._json_key)

View file

@ -257,7 +257,7 @@ class SolarEdgeSensor(Entity):
return self._unit_of_measurement return self._unit_of_measurement
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._attr: if self._attr:
try: try:

View file

@ -131,7 +131,7 @@ class SonarrCommandsSensor(SonarrSensor):
self._commands = await self.sonarr.commands() self._commands = await self.sonarr.commands()
@property @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 the state attributes of the entity."""
attrs = {} attrs = {}
@ -172,7 +172,7 @@ class SonarrDiskspaceSensor(SonarrSensor):
self._total_free = sum([disk.free for disk in self._disks]) self._total_free = sum([disk.free for disk in self._disks])
@property @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 the state attributes of the entity."""
attrs = {} attrs = {}
@ -217,7 +217,7 @@ class SonarrQueueSensor(SonarrSensor):
self._queue = await self.sonarr.queue() self._queue = await self.sonarr.queue()
@property @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 the state attributes of the entity."""
attrs = {} attrs = {}
@ -258,7 +258,7 @@ class SonarrSeriesSensor(SonarrSensor):
self._items = await self.sonarr.series() self._items = await self.sonarr.series()
@property @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 the state attributes of the entity."""
attrs = {} attrs = {}
@ -301,7 +301,7 @@ class SonarrUpcomingSensor(SonarrSensor):
) )
@property @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 the state attributes of the entity."""
attrs = {} attrs = {}
@ -342,7 +342,7 @@ class SonarrWantedSensor(SonarrSensor):
self._total = self._results.total self._total = self._results.total
@property @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 the state attributes of the entity."""
attrs = {} attrs = {}

View file

@ -1366,7 +1366,7 @@ class SonosEntity(MediaPlayerEntity):
self.soco.remove_from_queue(queue_position) self.soco.remove_from_queue(queue_position)
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return entity specific state attributes.""" """Return entity specific state attributes."""
attributes = {ATTR_SONOS_GROUP: [e.entity_id for e in self._sonos_group]} attributes = {ATTR_SONOS_GROUP: [e.entity_id for e in self._sonos_group]}

View file

@ -440,7 +440,7 @@ class SoundTouchDevice(MediaPlayerEntity):
self._device.add_zone_slave([slave.device for slave in slaves]) self._device.add_zone_slave([slave.device for slave in slaves])
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return entity specific state attributes.""" """Return entity specific state attributes."""
attributes = {} attributes = {}

View file

@ -67,7 +67,7 @@ class SpeedtestSensor(CoordinatorEntity, RestoreEntity):
return ICON return ICON
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if not self.coordinator.data: if not self.coordinator.data:
return None return None

View file

@ -103,7 +103,7 @@ class SpotCrimeSensor(Entity):
return self._state return self._state
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._attributes return self._attributes

View file

@ -120,7 +120,7 @@ class SQLSensor(Entity):
return self._unit_of_measurement return self._unit_of_measurement
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._attributes return self._attributes

View file

@ -265,7 +265,7 @@ class SqueezeBoxEntity(MediaPlayerEntity):
self._remove_dispatcher = None self._remove_dispatcher = None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device-specific attributes.""" """Return device-specific attributes."""
squeezebox_attr = { squeezebox_attr = {
attr: getattr(self, attr) attr: getattr(self, attr)

View file

@ -122,7 +122,7 @@ class SrpEntity(entity.Entity):
return False return False
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if not self.coordinator.data: if not self.coordinator.data:
return None return None

View file

@ -26,7 +26,7 @@ class StarlineDeviceTracker(StarlineEntity, TrackerEntity, RestoreEntity):
super().__init__(account, device, "location", "Location") super().__init__(account, device, "location", "Location")
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific attributes.""" """Return device specific attributes."""
return self._account.gps_attrs(self._device) return self._account.gps_attrs(self._device)

View file

@ -31,7 +31,7 @@ class StarlineLock(StarlineEntity, LockEntity):
return super().available and self._device.online return super().available and self._device.online
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the lock. """Return the state attributes of the lock.
Possible dictionary keys: Possible dictionary keys:

View file

@ -109,7 +109,7 @@ class StarlineSensor(StarlineEntity, Entity):
return self._device_class return self._device_class
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
if self._key == "balance": if self._key == "balance":
return self._account.balance_attrs(self._device) return self._account.balance_attrs(self._device)

View file

@ -53,7 +53,7 @@ class StarlineSwitch(StarlineEntity, SwitchEntity):
return super().available and self._device.online return super().available and self._device.online
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the switch.""" """Return the state attributes of the switch."""
if self._key == "ign": if self._key == "ign":
return self._account.engine_attrs(self._device) return self._account.engine_attrs(self._device)

View file

@ -184,7 +184,7 @@ class StatisticsSensor(Entity):
return False return False
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the sensor.""" """Return the state attributes of the sensor."""
if not self.is_binary: if not self.is_binary:
return { return {

View file

@ -194,7 +194,7 @@ class SteamSensor(Entity):
return None return None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
attr = {} attr = {}
if self._game is not None: if self._game is not None:

View file

@ -96,7 +96,7 @@ class StiebelEltron(ClimateEntity):
) )
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return device specific state attributes.""" """Return device specific state attributes."""
return {"filter_alarm": self._filter_alarm} return {"filter_alarm": self._filter_alarm}

View file

@ -57,7 +57,7 @@ class StookalertBinarySensor(BinarySensorEntity):
self._api_handler = api_handler self._api_handler = api_handler
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the attribute(s) of the sensor.""" """Return the attribute(s) of the sensor."""
state_attr = {ATTR_ATTRIBUTION: ATTRIBUTION} state_attr = {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -73,7 +73,7 @@ class SuezSensor(Entity):
return VOLUME_LITERS return VOLUME_LITERS
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return self._attributes return self._attributes

View file

@ -61,7 +61,7 @@ class SupervisorProcessSensor(Entity):
return self._available return self._available
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
return { return {
ATTR_DESCRIPTION: self._info.get("description"), ATTR_DESCRIPTION: self._info.get("description"),

View file

@ -151,7 +151,7 @@ class Hub(SurePetcareBinarySensor):
return self.available return self.available
@property @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.""" """Return the state attributes of the device."""
attributes = None attributes = None
if self._state: if self._state:
@ -179,7 +179,7 @@ class Pet(SurePetcareBinarySensor):
return False return False
@property @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.""" """Return the state attributes of the device."""
attributes = None attributes = None
if self._state: if self._state:
@ -232,7 +232,7 @@ class DeviceConnectivity(SurePetcareBinarySensor):
return self.available return self.available
@property @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.""" """Return the state attributes of the device."""
attributes = None attributes = None
if self._state: if self._state:

View file

@ -125,7 +125,7 @@ class Flap(SurePetcareSensor):
return SureLockStateID(self._state["locking"]["mode"]).name.capitalize() return SureLockStateID(self._state["locking"]["mode"]).name.capitalize()
@property @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.""" """Return the state attributes of the device."""
attributes = None attributes = None
if self._state: if self._state:
@ -166,7 +166,7 @@ class SureBattery(SurePetcareSensor):
return DEVICE_CLASS_BATTERY return DEVICE_CLASS_BATTERY
@property @property
def device_state_attributes(self) -> Optional[Dict[str, Any]]: def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
"""Return state attributes.""" """Return state attributes."""
attributes = None attributes = None
if self._state: if self._state:

View file

@ -119,7 +119,7 @@ class SwissHydrologicalDataSensor(Entity):
return None return None
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the device state attributes.""" """Return the device state attributes."""
attrs = {} attrs = {}

View file

@ -94,7 +94,7 @@ class SwissPublicTransportSensor(Entity):
) )
@property @property
def device_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes.""" """Return the state attributes."""
if self._opendata is None: if self._opendata is None:
return return

Some files were not shown because too many files have changed in this diff Show more