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)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return supported attributes."""
return {"board": self._board, "addr": self._addr}

View File

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

View File

@ -105,7 +105,7 @@ class PingBinarySensor(BinarySensorEntity):
return self._ping.available
@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."""
if self._ping.data is not False:
return {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -296,7 +296,7 @@ class MinutPointEntity(Entity):
return self._id
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return status of device."""
attrs = self.device.device_status
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"]
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device attributes."""
return {ATTR_ATTRIBUTION: ATTRIBUTION}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ SENSORS = {
name="Gas",
device_class=DEVICE_CLASS_GAS,
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(
name="Smoke", device_class=DEVICE_CLASS_SMOKE
@ -95,7 +95,7 @@ REST_SENSORS = {
icon="mdi:update",
value=lambda status, _: status["update"]["has_update"],
default_enabled=False,
device_state_attributes=lambda status: {
extra_state_attributes=lambda status: {
"latest_stable_version": status["update"]["new_version"],
"installed_version": status["update"]["old_version"],
},

View File

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

View File

@ -159,7 +159,7 @@ SENSORS = {
unit=PERCENTAGE,
icon="mdi:progress-wrench",
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)
},
),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -196,7 +196,7 @@ class SMAsensor(Entity):
return self._sensor.unit
@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 self._attr

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -235,7 +235,7 @@ class SmhiWeather(WeatherEntity):
return data
@property
def device_state_attributes(self) -> Dict:
def extra_state_attributes(self) -> Dict:
"""Return SMHI specific attributes."""
if 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)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the sensor attributes."""
return self._state

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1366,7 +1366,7 @@ class SonosEntity(MediaPlayerEntity):
self.soco.remove_from_queue(queue_position)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return entity specific state attributes."""
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])
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return entity specific state attributes."""
attributes = {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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