Update integrations t-z to override extra_state_attributes() (#47760)

This commit is contained in:
Erik Montnemery 2021-03-11 20:16:26 +01:00 committed by GitHub
parent 14a59d290a
commit 1fc8e32d86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
127 changed files with 218 additions and 223 deletions

View file

@ -231,7 +231,7 @@ class TadoZoneBinarySensor(TadoZoneEntity, BinarySensorEntity):
return None
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._state_attributes

View file

@ -462,7 +462,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
return None
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return temperature offset."""
return self._tado_zone_temp_offset

View file

@ -132,7 +132,7 @@ class TadoHomeSensor(TadoHomeEntity, Entity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._state_attributes
@ -237,7 +237,7 @@ class TadoZoneSensor(TadoZoneEntity, Entity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._state_attributes

View file

@ -137,7 +137,7 @@ class TahomaDevice(Entity):
return self._name
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
return {"tahoma_device_id": self.tahoma_device.url}

View file

@ -57,10 +57,10 @@ class TahomaBinarySensor(TahomaDevice, BinarySensorEntity):
return self._icon
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
attr = {}
super_attr = super().device_state_attributes
super_attr = super().extra_state_attributes
if super_attr is not None:
attr.update(super_attr)

View file

@ -194,10 +194,10 @@ class TahomaCover(TahomaDevice, CoverEntity):
return TAHOMA_DEVICE_CLASSES.get(self.tahoma_device.type)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
attr = {}
super_attr = super().device_state_attributes
super_attr = super().extra_state_attributes
if super_attr is not None:
attr.update(super_attr)

View file

@ -78,12 +78,12 @@ class TahomaLock(TahomaDevice, LockEntity):
return self._lock_status == STATE_LOCKED
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the lock state attributes."""
attr = {
ATTR_BATTERY_LEVEL: self._battery_level,
}
super_attr = super().device_state_attributes
super_attr = super().extra_state_attributes
if super_attr is not None:
attr.update(super_attr)
return attr

View file

@ -37,6 +37,6 @@ class TahomaScene(Scene):
return self._name
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the scene."""
return {"tahoma_scene_oid": self.tahoma_scene.oid}

View file

@ -110,10 +110,10 @@ class TahomaSensor(TahomaDevice, Entity):
_LOGGER.debug("Update %s, value: %d", self._name, self.current_value)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
attr = {}
super_attr = super().device_state_attributes
super_attr = super().extra_state_attributes
if super_attr is not None:
attr.update(super_attr)

View file

@ -105,10 +105,10 @@ class TahomaSwitch(TahomaDevice, SwitchEntity):
return bool(self._state == STATE_ON)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
attr = {}
super_attr = super().device_state_attributes
super_attr = super().extra_state_attributes
if super_attr is not None:
attr.update(super_attr)

View file

@ -97,7 +97,7 @@ class TankUtilitySensor(Entity):
return self._unit_of_measurement
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the attributes of the device."""
return self._attributes

View file

@ -125,7 +125,7 @@ class FuelPriceSensor(CoordinatorEntity):
return f"{self._station_id}_{self._fuel_type}"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the attributes of the device."""
data = self.coordinator.data[self._station_id]

View file

@ -130,7 +130,7 @@ class TautulliSensor(Entity):
return "Watching"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return attributes for the sensor."""
return self._attributes

View file

@ -81,7 +81,7 @@ class TelldusLiveEntity(Entity):
return self._client.is_available(self.device_id)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {}
if self._battery_level:

View file

@ -168,7 +168,7 @@ class TemplateEntity(Entity):
return self._entity_picture
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._attributes

View file

@ -279,7 +279,7 @@ class TensorFlowImageProcessor(ImageProcessingEntity):
return self._total_matches
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device specific state attributes."""
return {
ATTR_MATCHES: self._matches,

View file

@ -307,7 +307,7 @@ class TeslaDevice(CoordinatorEntity):
return ICONS.get(self.tesla_device.type)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
attr = self._attributes
if self.tesla_device.has_battery():

View file

@ -42,9 +42,9 @@ class TeslaDeviceEntity(TeslaDevice, TrackerEntity):
return SOURCE_TYPE_GPS
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
attr = super().device_state_attributes.copy()
attr = super().extra_state_attributes.copy()
location = self.tesla_device.get_location()
if location:
attr.update(

View file

@ -81,7 +81,7 @@ class TeslaSensor(TeslaDevice, Entity):
)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
attr = self._attributes.copy()
if self.tesla_device.type == "charging rate sensor":

View file

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

View file

@ -92,7 +92,7 @@ class TtnDataSensor(Entity):
return self._unit_of_measurement
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the sensor."""
if self._ttn_data_storage.data is not None:
return {

View file

@ -144,7 +144,7 @@ class ThresholdSensor(BinarySensorEntity):
return TYPE_UPPER
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the sensor."""
return {
ATTR_ENTITY_ID: self._entity_id,

View file

@ -54,7 +54,7 @@ class TibberSensor(Entity):
self._last_updated = None
self._state = None
self._is_available = False
self._device_state_attributes = {}
self._extra_state_attributes = {}
self._name = tibber_home.info["viewer"]["home"]["appNickname"]
if self._name is None:
self._name = tibber_home.info["viewer"]["home"]["address"].get(
@ -63,9 +63,9 @@ class TibberSensor(Entity):
self._spread_load_constant = randrange(3600)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._device_state_attributes
return self._extra_state_attributes
@property
def model(self):
@ -121,10 +121,10 @@ class TibberSensorElPrice(TibberSensor):
res = self._tibber_home.current_price_data()
self._state, price_level, self._last_updated = res
self._device_state_attributes["price_level"] = price_level
self._extra_state_attributes["price_level"] = price_level
attrs = self._tibber_home.current_attributes()
self._device_state_attributes.update(attrs)
self._extra_state_attributes.update(attrs)
self._is_available = self._state is not None
@property
@ -165,11 +165,11 @@ class TibberSensorElPrice(TibberSensor):
except (asyncio.TimeoutError, aiohttp.ClientError):
return
data = self._tibber_home.info["viewer"]["home"]
self._device_state_attributes["app_nickname"] = data["appNickname"]
self._device_state_attributes["grid_company"] = data["meteringPointData"][
self._extra_state_attributes["app_nickname"] = data["appNickname"]
self._extra_state_attributes["grid_company"] = data["meteringPointData"][
"gridCompany"
]
self._device_state_attributes["estimated_annual_consumption"] = data[
self._extra_state_attributes["estimated_annual_consumption"] = data[
"meteringPointData"
]["estimatedAnnualConsumption"]
@ -197,7 +197,7 @@ class TibberSensorRT(TibberSensor):
for key, value in live_measurement.items():
if value is None:
continue
self._device_state_attributes[key] = value
self._extra_state_attributes[key] = value
self.async_write_ha_state()

View file

@ -81,7 +81,7 @@ class TileDeviceTracker(CoordinatorEntity, TrackerEntity):
return None
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
return self._attrs

View file

@ -101,7 +101,7 @@ class TMBSensor(Entity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the last update."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,

View file

@ -109,7 +109,7 @@ class TodSensor(BinarySensorEntity):
return self._next_update
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the sensor."""
return {
ATTR_AFTER: self.after.astimezone(self.hass.config.time_zone).isoformat(),

View file

@ -284,7 +284,7 @@ class TodoistProjectDevice(CalendarEventDevice):
return await self.data.async_get_events(hass, start_date, end_date)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
if self.data.event is None:
# No tasks, we don't REALLY need to show anything.

View file

@ -114,7 +114,7 @@ class ToonThermostatDevice(ToonDisplayDeviceEntity, ClimateEntity):
return DEFAULT_MAX_TEMP
@property
def device_state_attributes(self) -> Dict[str, Any]:
def extra_state_attributes(self) -> Dict[str, Any]:
"""Return the current state of the burner."""
return {"heating_type": self.coordinator.data.agreement.heating_type}

View file

@ -44,7 +44,7 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity):
self._location_id = location_id
self._client = client
self._state = None
self._device_state_attributes = {}
self._extra_state_attributes = {}
@property
def name(self):
@ -62,9 +62,9 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity):
return SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
return self._device_state_attributes
return self._extra_state_attributes
def update(self):
"""Return the state of the device."""
@ -109,7 +109,7 @@ class TotalConnectAlarm(alarm.AlarmControlPanelEntity):
state = None
self._state = state
self._device_state_attributes = attr
self._extra_state_attributes = attr
def alarm_disarm(self, code=None):
"""Send disarm command."""

View file

@ -73,7 +73,7 @@ class TotalConnectBinarySensor(BinarySensorEntity):
return None
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attributes = {
"zone_id": self._zone_id,

View file

@ -163,7 +163,7 @@ class TPLinkSmartBulb(LightEntity):
return self._is_available
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
return self._emeter_params

View file

@ -100,7 +100,7 @@ class SmartPlugSwitch(SwitchEntity):
self.smartplug.turn_off()
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
return self._emeter_params

View file

@ -345,7 +345,7 @@ class TraccarEntity(TrackerEntity, RestoreEntity):
return self._battery
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device specific attributes."""
return self._attributes

View file

@ -29,7 +29,7 @@ class TradfriCover(TradfriBaseDevice, CoverEntity):
self._refresh(device)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return {ATTR_MODEL: self._device.device_info.model_number}

View file

@ -153,7 +153,7 @@ class TrainSensor(Entity):
self._delay_in_minutes = self._state.get_delay_time()
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
if self._state is None:
return None

View file

@ -172,7 +172,7 @@ class TrafikverketWeatherStation(Entity):
return self._icon
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of Trafikverket Weatherstation."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,

View file

@ -148,7 +148,7 @@ class TransmissionTorrentsSensor(TransmissionSensor):
return "Torrents"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes, if any."""
info = _torrents_info(
torrents=self._tm_client.api.torrents,

View file

@ -87,7 +87,7 @@ class TransportNSWSensor(Entity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
if self._times is not None:
return {

View file

@ -124,7 +124,7 @@ class TravisCISensor(Entity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {}
attrs[ATTR_ATTRIBUTION] = ATTRIBUTION

View file

@ -146,7 +146,7 @@ class SensorTrend(BinarySensorEntity):
return self._device_class
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the sensor."""
return {
ATTR_ENTITY_ID: self._entity_id,

View file

@ -88,7 +88,7 @@ class TwitchSensor(Entity):
return self._preview
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attr = dict(self._statistics)

View file

@ -191,7 +191,7 @@ class UkTransportLiveBusTimeSensor(UkTransportSensor):
self._state = None
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return other details about the sensor state."""
attrs = {}
if self._data is not None:
@ -261,7 +261,7 @@ class UkTransportLiveTrainTimeSensor(UkTransportSensor):
self._state = None
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return other details about the sensor state."""
attrs = {}
if self._data is not None:

View file

@ -249,7 +249,7 @@ class UniFiClientTracker(UniFiClient, ScannerEntity):
return f"{self.client.mac}-{self.controller.site}"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the client state attributes."""
raw = self.client.raw
@ -421,7 +421,7 @@ class UniFiDeviceTracker(UniFiBase, ScannerEntity):
)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
if self.device.state == 0:
return {}

View file

@ -238,7 +238,7 @@ class UniFiPOEClientSwitch(UniFiClient, SwitchEntity, RestoreEntity):
await self.device.async_set_port_poe_mode(self.client.sw_port, "off")
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
attributes = {
"power": self.port.poe_power,

View file

@ -502,7 +502,7 @@ class UniversalMediaPlayer(MediaPlayerEntity):
return flags
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device specific state attributes."""
active_child = self._child_state
return {ATTR_ACTIVE_CHILD: active_child.entity_id} if active_child else {}

View file

@ -110,7 +110,7 @@ class UpbEntity(Entity):
return False
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the default attributes of the element."""
return self._element.as_dict()

View file

@ -296,7 +296,7 @@ class UpCloudServerEntity(CoordinatorEntity):
return DEFAULT_COMPONENT_DEVICE_CLASS
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the UpCloud server."""
return {
x: getattr(self._server, x, None)

View file

@ -35,7 +35,7 @@ class UpdaterBinary(CoordinatorEntity, BinarySensorEntity):
return self.coordinator.data.update_available
@property
def device_state_attributes(self) -> dict:
def extra_state_attributes(self) -> dict:
"""Return the optional state attributes."""
if not self.coordinator.data:
return None

View file

@ -75,7 +75,7 @@ class UptimeRobotBinarySensor(BinarySensorEntity):
return DEVICE_CLASS_CONNECTIVITY
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the binary sensor."""
return {ATTR_ATTRIBUTION: ATTRIBUTION, ATTR_TARGET: self._target}

View file

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

View file

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

View file

@ -324,7 +324,7 @@ class UtilityMeterSensor(RestoreEntity):
return False
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the sensor."""
state_attr = {
ATTR_SOURCE_ID: self._sensor_source_id,

View file

@ -111,7 +111,7 @@ class UnifiVideoCamera(Camera):
return 0
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the camera state attributes."""
attr = {}
if self.motion_detection_enabled:

View file

@ -83,7 +83,7 @@ class ValloxFan(FanEntity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device specific state attributes."""
return {
ATTR_PROFILE_FAN_SPEED_HOME["description"]: self._fan_speed_home,

View file

@ -106,7 +106,7 @@ class VasttrafikDepartureSensor(Entity):
return ICON
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._attributes

View file

@ -200,7 +200,7 @@ class VenstarThermostat(ClimateEntity):
return FAN_AUTO
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the optional state attributes."""
return {
ATTR_FAN_STATE: self._client.fanstate,

View file

@ -248,7 +248,7 @@ class VeraDevice(Generic[DeviceType], Entity):
return self.vera_device.should_poll
@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."""
attr = {}

View file

@ -61,14 +61,14 @@ class VeraLock(VeraDevice[veraApi.VeraLock], LockEntity):
return self._state == STATE_LOCKED
@property
def device_state_attributes(self) -> Optional[Dict[str, Any]]:
def extra_state_attributes(self) -> Optional[Dict[str, Any]]:
"""Who unlocked the lock and did a low battery alert fire.
Reports on the previous poll cycle.
changed_by_name is a string like 'Bob'.
low_battery is 1 if an alert fired, 0 otherwise.
"""
data = super().device_state_attributes
data = super().extra_state_attributes
last_user = self.vera_device.get_last_user_alert()
if last_user is not None:

View file

@ -53,6 +53,6 @@ class VeraScene(Scene):
return self._name
@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 scene."""
return {"vera_scene_id": self.vera_scene.vera_scene_id}

View file

@ -118,7 +118,7 @@ class VersionSensor(Entity):
return self.haversion.api.version
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return attributes for the sensor."""
return self.haversion.api.version_data

View file

@ -101,7 +101,7 @@ class VeSyncFanHA(VeSyncDevice, FanEntity):
return self.smartfan.uuid
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the fan."""
return {
"mode": self.smartfan.mode,

View file

@ -72,7 +72,7 @@ class VeSyncSwitchHA(VeSyncBaseSwitch, SwitchEntity):
self.smartplug = plug
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
if not hasattr(self.smartplug, "weekly_energy_total"):
return {}

View file

@ -119,7 +119,7 @@ class ViaggiaTrenoSensor(Entity):
return self._unit
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return extra attributes."""
self._attributes[ATTR_ATTRIBUTION] = ATTRIBUTION
return self._attributes

View file

@ -278,7 +278,7 @@ class ViCareClimate(ClimateEntity):
self._api.activateProgram(vicare_program)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Show Device Attributes."""
return self._attributes

View file

@ -277,7 +277,7 @@ class VolvoEntity(Entity):
return True
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device specific state attributes."""
return dict(
self.instrument.attributes,

View file

@ -86,7 +86,7 @@ class VultrBinarySensor(BinarySensorEntity):
return DEFAULT_DEVICE_CLASS
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the Vultr subscription."""
return {
ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"),

View file

@ -80,7 +80,7 @@ class VultrSwitch(SwitchEntity):
return "mdi:server" if self.is_on else "mdi:server-off"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the Vultr subscription."""
return {
ATTR_ALLOWED_BANDWIDTH: self.data.get("allowed_bandwidth_gb"),

View file

@ -151,7 +151,7 @@ class WaqiSensor(Entity):
return "AQI"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the last update."""
attrs = {}

View file

@ -176,7 +176,7 @@ class WazeTravelTime(Entity):
return ICON
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the last update."""
if self._waze_data.duration is None:
return None

View file

@ -318,7 +318,7 @@ class LgWebOSMediaPlayerEntity(MediaPlayerEntity):
return supported
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device specific state attributes."""
if self._client.sound_output is None and self.state == STATE_OFF:
return {}

View file

@ -115,7 +115,7 @@ class WemoHumidifier(WemoSubscriptionEntity, FanEntity):
return "mdi:water-percent"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return device specific state attributes."""
return {
ATTR_CURRENT_HUMIDITY: self._current_humidity,

View file

@ -59,7 +59,7 @@ class WemoSwitch(WemoSubscriptionEntity, SwitchEntity):
self._mode_string = None
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
attr = {}
if self.maker_params:

View file

@ -81,7 +81,7 @@ class WhoisSensor(Entity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Get the more info attributes."""
return self._attributes

View file

@ -778,7 +778,7 @@ class WinkDevice(Entity):
return self.wink.pubnub_channel is None
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attributes = {}
battery = self._battery_level
@ -855,9 +855,9 @@ class WinkSirenDevice(WinkDevice):
return "mdi:bell-ring"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
attributes = super().device_state_attributes
attributes = super().extra_state_attributes
auto_shutoff = self.wink.auto_shutoff()
if auto_shutoff is not None:
@ -913,9 +913,9 @@ class WinkNimbusDialDevice(WinkDevice):
return f"{self.parent.name()} dial {self.wink.index() + 1}"
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
attributes = super().device_state_attributes
attributes = super().extra_state_attributes
dial_attributes = self.dial_attributes()
return {**attributes, **dial_attributes}

View file

@ -70,6 +70,6 @@ class WinkCameraDevice(WinkDevice, alarm.AlarmControlPanelEntity):
self.wink.set_mode("away")
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return {"private": self.wink.private()}

View file

@ -119,18 +119,18 @@ class WinkBinarySensorEntity(WinkDevice, BinarySensorEntity):
return SENSOR_TYPES.get(self.capability)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
return super().device_state_attributes
return super().extra_state_attributes
class WinkSmokeDetector(WinkBinarySensorEntity):
"""Representation of a Wink Smoke detector."""
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
_attributes = super().device_state_attributes
_attributes = super().extra_state_attributes
_attributes["test_activated"] = self.wink.test_activated()
return _attributes
@ -139,9 +139,9 @@ class WinkHub(WinkBinarySensorEntity):
"""Representation of a Wink Hub."""
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
_attributes = super().device_state_attributes
_attributes = super().extra_state_attributes
_attributes["update_needed"] = self.wink.update_needed()
_attributes["firmware_version"] = self.wink.firmware_version()
_attributes["pairing_mode"] = self.wink.pairing_mode()
@ -159,9 +159,9 @@ class WinkRemote(WinkBinarySensorEntity):
"""Representation of a Wink Lutron Connected bulb remote."""
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
_attributes = super().device_state_attributes
_attributes = super().extra_state_attributes
_attributes["button_on_pressed"] = self.wink.button_on_pressed()
_attributes["button_off_pressed"] = self.wink.button_off_pressed()
_attributes["button_up_pressed"] = self.wink.button_up_pressed()
@ -178,9 +178,9 @@ class WinkButton(WinkBinarySensorEntity):
"""Representation of a Wink Relay button."""
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the device state attributes."""
_attributes = super().device_state_attributes
_attributes = super().extra_state_attributes
_attributes["pressed"] = self.wink.pressed()
_attributes["long_pressed"] = self.wink.long_pressed()
return _attributes

View file

@ -99,7 +99,7 @@ class WinkThermostat(WinkDevice, ClimateEntity):
return TEMP_CELSIUS
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the optional device state attributes."""
data = {}
if self.external_temperature is not None:
@ -396,7 +396,7 @@ class WinkAC(WinkDevice, ClimateEntity):
return TEMP_CELSIUS
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the optional device state attributes."""
data = {}
data[ATTR_TOTAL_CONSUMPTION] = self.wink.total_consumption()

View file

@ -187,9 +187,9 @@ class WinkLockDevice(WinkDevice, LockEntity):
self.wink.set_alarm_mode(mode)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
super_attrs = super().device_state_attributes
super_attrs = super().extra_state_attributes
sensitivity = dict_value_to_key(
ALARM_SENSITIVITY_MAP, self.wink.alarm_sensitivity()
)

View file

@ -83,9 +83,9 @@ class WinkSensorDevice(WinkDevice):
return self._unit_of_measurement
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
super_attrs = super().device_state_attributes
super_attrs = super().extra_state_attributes
try:
super_attrs["egg_times"] = self.wink.eggs()
except AttributeError:

View file

@ -48,9 +48,9 @@ class WinkToggleDevice(WinkDevice, ToggleEntity):
self.wink.set_state(False)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attributes = super().device_state_attributes
attributes = super().extra_state_attributes
try:
event = self.wink.last_event()
if event is not None:

View file

@ -66,7 +66,7 @@ class WinkWaterHeater(WinkDevice, WaterHeaterEntity):
return TEMP_CELSIUS
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the optional device state attributes."""
data = {}
data[ATTR_VACATION_MODE] = self.wink.vacation_mode_enabled()

View file

@ -272,7 +272,7 @@ class WirelessTagBaseSensor(Entity):
self._state = self.updated_state_value()
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return {
ATTR_BATTERY_LEVEL: int(self._tag.battery_remaining * 100),

View file

@ -188,7 +188,7 @@ class WLEDSegmentLight(LightEntity, WLEDDeviceEntity):
return super().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 entity."""
playlist = self.coordinator.data.state.playlist
if playlist == -1:

View file

@ -92,7 +92,7 @@ class WLEDEstimatedCurrentSensor(WLEDSensor):
)
@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 {
ATTR_LED_COUNT: self.coordinator.data.info.leds.count,

View file

@ -72,7 +72,7 @@ class WLEDNightlightSwitch(WLEDSwitch):
)
@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 {
ATTR_DURATION: self.coordinator.data.state.nightlight.duration,
@ -110,7 +110,7 @@ class WLEDSyncSendSwitch(WLEDSwitch):
)
@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 {ATTR_UDP_PORT: self.coordinator.data.info.udp_port}
@ -144,7 +144,7 @@ class WLEDSyncReceiveSwitch(WLEDSwitch):
)
@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 {ATTR_UDP_PORT: self.coordinator.data.info.udp_port}

View file

@ -69,7 +69,7 @@ class WolfLinkSensor(CoordinatorEntity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return {
"parameter_id": self.wolf_object.parameter_id,

View file

@ -72,7 +72,7 @@ class WorldTidesInfoSensor(Entity):
return self._name
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of this device."""
attr = {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -120,7 +120,7 @@ class WashingtonStateTravelTimeSensor(WashingtonStateTransportSensor):
self._state = self._data.get(ATTR_CURRENT_TIME)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return other details about the sensor state."""
if self._data is not None:
attrs = {ATTR_ATTRIBUTION: ATTRIBUTION}

View file

@ -70,7 +70,7 @@ class WUSensorConfig:
unit_of_measurement: Optional[str] = None,
entity_picture=None,
icon: str = "mdi:gauge",
device_state_attributes=None,
extra_state_attributes=None,
device_class=None,
):
"""Initialize sensor configuration.
@ -82,7 +82,7 @@ class WUSensorConfig:
:param unit_of_measurement: unit of measurement
:param entity_picture: value or callback returning URL of entity picture
:param icon: icon name or URL
:param device_state_attributes: dictionary of attributes, or callable that returns it
:param extra_state_attributes: dictionary of attributes, or callable that returns it
"""
self.friendly_name = friendly_name
self.unit_of_measurement = unit_of_measurement
@ -90,7 +90,7 @@ class WUSensorConfig:
self.value = value
self.entity_picture = entity_picture
self.icon = icon
self.device_state_attributes = device_state_attributes or {}
self.extra_state_attributes = extra_state_attributes or {}
self.device_class = device_class
@ -121,7 +121,7 @@ class WUCurrentConditionsSensorConfig(WUSensorConfig):
entity_picture=lambda wu: wu.data["current_observation"]["icon_url"]
if icon is None
else None,
device_state_attributes={
extra_state_attributes={
"date": lambda wu: wu.data["current_observation"]["observation_time"]
},
device_class=device_class,
@ -152,7 +152,7 @@ class WUDailyTextForecastSensorConfig(WUSensorConfig):
"forecastday"
][period]["icon_url"],
unit_of_measurement=unit_of_measurement,
device_state_attributes={
extra_state_attributes={
"date": lambda wu: wu.data["forecast"]["txt_forecast"]["date"]
},
)
@ -201,7 +201,7 @@ class WUDailySimpleForecastSensorConfig(WUSensorConfig):
if not icon
else None,
icon=icon,
device_state_attributes={
extra_state_attributes={
"date": lambda wu: wu.data["forecast"]["simpleforecast"]["forecastday"][
period
]["date"]["pretty"]
@ -227,7 +227,7 @@ class WUHourlyForecastSensorConfig(WUSensorConfig):
feature="hourly",
value=lambda wu: wu.data["hourly_forecast"][period][field],
entity_picture=lambda wu: wu.data["hourly_forecast"][period]["icon_url"],
device_state_attributes={
extra_state_attributes={
"temp_c": lambda wu: wu.data["hourly_forecast"][period]["temp"][
"metric"
],
@ -315,7 +315,7 @@ class WUAlertsSensorConfig(WUSensorConfig):
icon=lambda wu: "mdi:alert-circle-outline"
if wu.data["alerts"]
else "mdi:check-circle-outline",
device_state_attributes=self._get_attributes,
extra_state_attributes=self._get_attributes,
)
@staticmethod
@ -1157,7 +1157,7 @@ class WUndergroundSensor(Entity):
def _update_attrs(self):
"""Parse and update device state attributes."""
attrs = self._cfg_expand("device_state_attributes", {})
attrs = self._cfg_expand("extra_state_attributes", {})
for (attr, callback) in attrs.items():
if callable(callback):
@ -1185,7 +1185,7 @@ class WUndergroundSensor(Entity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._attributes

View file

@ -104,7 +104,7 @@ class XboxSensor(Entity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attributes = {"gamerscore": self._gamerscore, "tier": self._tier}

View file

@ -241,7 +241,7 @@ class XiaomiDevice(Entity):
self._type = device_type
self._write_to_hub = xiaomi_hub.write_to_hub
self._get_from_hub = xiaomi_hub.get_from_hub
self._device_state_attributes = {}
self._extra_state_attributes = {}
self._remove_unavailability_tracker = None
self._xiaomi_hub = xiaomi_hub
self.parse_data(device["data"], device["raw_data"])
@ -319,9 +319,9 @@ class XiaomiDevice(Entity):
return False
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
return self._device_state_attributes
return self._extra_state_attributes
@callback
def _async_set_unavailable(self, now):
@ -364,11 +364,11 @@ class XiaomiDevice(Entity):
max_volt = 3300
min_volt = 2800
voltage = data[voltage_key]
self._device_state_attributes[ATTR_VOLTAGE] = round(voltage / 1000.0, 2)
self._extra_state_attributes[ATTR_VOLTAGE] = round(voltage / 1000.0, 2)
voltage = min(voltage, max_volt)
voltage = max(voltage, min_volt)
percent = ((voltage - min_volt) / (max_volt - min_volt)) * 100
self._device_state_attributes[ATTR_BATTERY_LEVEL] = round(percent, 1)
self._extra_state_attributes[ATTR_BATTERY_LEVEL] = round(percent, 1)
return True
def parse_data(self, data, raw_data):

View file

@ -170,10 +170,10 @@ class XiaomiNatgasSensor(XiaomiBinarySensor):
)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {ATTR_DENSITY: self._density}
attrs.update(super().device_state_attributes)
attrs.update(super().extra_state_attributes)
return attrs
def parse_data(self, data, raw_data):
@ -214,10 +214,10 @@ class XiaomiMotionSensor(XiaomiBinarySensor):
)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {ATTR_NO_MOTION_SINCE: self._no_motion_since}
attrs.update(super().device_state_attributes)
attrs.update(super().extra_state_attributes)
return attrs
@callback
@ -308,10 +308,10 @@ class XiaomiDoorSensor(XiaomiBinarySensor):
)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {ATTR_OPEN_SINCE: self._open_since}
attrs.update(super().device_state_attributes)
attrs.update(super().extra_state_attributes)
return attrs
def parse_data(self, data, raw_data):
@ -389,10 +389,10 @@ class XiaomiSmokeSensor(XiaomiBinarySensor):
)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {ATTR_DENSITY: self._density}
attrs.update(super().device_state_attributes)
attrs.update(super().extra_state_attributes)
return attrs
def parse_data(self, data, raw_data):
@ -424,10 +424,10 @@ class XiaomiVibration(XiaomiBinarySensor):
super().__init__(device, name, xiaomi_hub, data_key, None, config_entry)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {ATTR_LAST_ACTION: self._last_action}
attrs.update(super().device_state_attributes)
attrs.update(super().extra_state_attributes)
return attrs
def parse_data(self, data, raw_data):
@ -459,10 +459,10 @@ class XiaomiButton(XiaomiBinarySensor):
super().__init__(device, name, xiaomi_hub, data_key, None, config_entry)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {ATTR_LAST_ACTION: self._last_action}
attrs.update(super().device_state_attributes)
attrs.update(super().extra_state_attributes)
return attrs
def parse_data(self, data, raw_data):
@ -519,10 +519,10 @@ class XiaomiCube(XiaomiBinarySensor):
super().__init__(device, "Cube", xiaomi_hub, data_key, None, config_entry)
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
attrs = {ATTR_LAST_ACTION: self._last_action}
attrs.update(super().device_state_attributes)
attrs.update(super().extra_state_attributes)
return attrs
def parse_data(self, data, raw_data):

View file

@ -50,7 +50,7 @@ class XiaomiAqaraLock(LockEntity, XiaomiDevice):
return self._changed_by
@property
def device_state_attributes(self) -> dict:
def extra_state_attributes(self) -> dict:
"""Return the state attributes."""
attributes = {ATTR_VERIFIED_WRONG_TIMES: self._verified_wrong_times}
return attributes

View file

@ -194,7 +194,7 @@ class XiaomiBatterySensor(XiaomiDevice):
succeed = super().parse_voltage(data)
if not succeed:
return False
battery_level = int(self._device_state_attributes.pop(ATTR_BATTERY_LEVEL))
battery_level = int(self._extra_state_attributes.pop(ATTR_BATTERY_LEVEL))
if battery_level <= 0 or battery_level > 100:
return False
self._state = battery_level

View file

@ -157,7 +157,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchEntity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
if self._supports_power_consumption:
attrs = {
@ -167,7 +167,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchEntity):
}
else:
attrs = {}
attrs.update(super().device_state_attributes)
attrs.update(super().extra_state_attributes)
return attrs
@property

View file

@ -165,7 +165,7 @@ class AirMonitorB1(XiaomiMiioEntity, AirQualityEntity):
return self._humidity
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes."""
data = {}

View file

@ -651,7 +651,7 @@ class XiaomiGenericDevice(XiaomiMiioEntity, FanEntity):
return self._available
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
return self._state_attrs

View file

@ -260,7 +260,7 @@ class XiaomiPhilipsAbstractLight(XiaomiMiioEntity, LightEntity):
return self._available
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
return self._state_attrs

View file

@ -185,7 +185,7 @@ class XiaomiAirQualityMonitor(XiaomiMiioEntity):
return self._state
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
return self._state_attrs

View file

@ -252,7 +252,7 @@ class XiaomiPlugGenericSwitch(XiaomiMiioEntity, SwitchEntity):
return self._available
@property
def device_state_attributes(self):
def extra_state_attributes(self):
"""Return the state attributes of the device."""
return self._state_attrs

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