Move SensorEntity last in the inheritance tree (#48230)

This commit is contained in:
Erik Montnemery 2021-03-22 20:05:13 +01:00 committed by GitHub
parent 18e6816373
commit 9e9ba53f0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 47 additions and 47 deletions

View file

@ -34,7 +34,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities) async_add_entities(entities)
class AbodeSensor(SensorEntity, AbodeDevice): class AbodeSensor(AbodeDevice, SensorEntity):
"""A sensor implementation for Abode devices.""" """A sensor implementation for Abode devices."""
def __init__(self, data, device, sensor_type): def __init__(self, data, device, sensor_type):

View file

@ -49,7 +49,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors, False) async_add_entities(sensors, False)
class AccuWeatherSensor(SensorEntity, CoordinatorEntity): class AccuWeatherSensor(CoordinatorEntity, SensorEntity):
"""Define an AccuWeather entity.""" """Define an AccuWeather entity."""
def __init__(self, name, kind, coordinator, forecast_day=None): def __init__(self, name, kind, coordinator, forecast_day=None):

View file

@ -30,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class AcmedaBattery(SensorEntity, AcmedaBase): class AcmedaBattery(AcmedaBase, SensorEntity):
"""Representation of a Acmeda cover device.""" """Representation of a Acmeda cover device."""
device_class = DEVICE_CLASS_BATTERY device_class = DEVICE_CLASS_BATTERY

View file

@ -49,7 +49,7 @@ async def async_setup_entry(
async_add_entities(sensors, True) async_add_entities(sensors, True)
class AdGuardHomeSensor(SensorEntity, AdGuardHomeDeviceEntity): class AdGuardHomeSensor(AdGuardHomeDeviceEntity, SensorEntity):
"""Defines a AdGuard Home sensor.""" """Defines a AdGuard Home sensor."""
def __init__( def __init__(

View file

@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([entity]) add_entities([entity])
class AdsSensor(SensorEntity, AdsEntity): class AdsSensor(AdsEntity, SensorEntity):
"""Representation of an ADS sensor entity.""" """Representation of an ADS sensor entity."""
def __init__(self, ads_hub, ads_var, ads_type, name, unit_of_measurement, factor): def __init__(self, ads_hub, ads_var, ads_type, name, unit_of_measurement, factor):

View file

@ -41,7 +41,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class AdvantageAirTimeTo(SensorEntity, AdvantageAirEntity): class AdvantageAirTimeTo(AdvantageAirEntity, SensorEntity):
"""Representation of Advantage Air timer control.""" """Representation of Advantage Air timer control."""
def __init__(self, instance, ac_key, action): def __init__(self, instance, ac_key, action):
@ -83,7 +83,7 @@ class AdvantageAirTimeTo(SensorEntity, AdvantageAirEntity):
await self.async_change({self.ac_key: {"info": {self._time_key: value}}}) await self.async_change({self.ac_key: {"info": {self._time_key: value}}})
class AdvantageAirZoneVent(SensorEntity, AdvantageAirEntity): class AdvantageAirZoneVent(AdvantageAirEntity, SensorEntity):
"""Representation of Advantage Air Zone Vent Sensor.""" """Representation of Advantage Air Zone Vent Sensor."""
@property @property
@ -116,7 +116,7 @@ class AdvantageAirZoneVent(SensorEntity, AdvantageAirEntity):
return "mdi:fan-off" return "mdi:fan-off"
class AdvantageAirZoneSignal(SensorEntity, AdvantageAirEntity): class AdvantageAirZoneSignal(AdvantageAirEntity, SensorEntity):
"""Representation of Advantage Air Zone wireless signal sensor.""" """Representation of Advantage Air Zone wireless signal sensor."""
@property @property

View file

@ -58,7 +58,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities) async_add_entities(entities)
class AemetSensor(SensorEntity, AbstractAemetSensor): class AemetSensor(AbstractAemetSensor, SensorEntity):
"""Implementation of an AEMET OpenData sensor.""" """Implementation of an AEMET OpenData sensor."""
def __init__( def __init__(
@ -81,7 +81,7 @@ class AemetSensor(SensorEntity, AbstractAemetSensor):
return self._weather_coordinator.data.get(self._sensor_type) return self._weather_coordinator.data.get(self._sensor_type)
class AemetForecastSensor(SensorEntity, AbstractAemetSensor): class AemetForecastSensor(AbstractAemetSensor, SensorEntity):
"""Implementation of an AEMET OpenData forecast sensor.""" """Implementation of an AEMET OpenData forecast sensor."""
def __init__( def __init__(

View file

@ -73,7 +73,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors, False) async_add_entities(sensors, False)
class AirlySensor(SensorEntity, CoordinatorEntity): class AirlySensor(CoordinatorEntity, SensorEntity):
"""Define an Airly sensor.""" """Define an Airly sensor."""
def __init__(self, coordinator, name, kind): def __init__(self, coordinator, name, kind):

View file

@ -60,7 +60,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors, False) async_add_entities(sensors, False)
class AirNowSensor(SensorEntity, CoordinatorEntity): class AirNowSensor(CoordinatorEntity, SensorEntity):
"""Define an AirNow sensor.""" """Define an AirNow sensor."""
def __init__(self, coordinator, kind): def __init__(self, coordinator, kind):

View file

@ -139,7 +139,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors, True) async_add_entities(sensors, True)
class AirVisualGeographySensor(SensorEntity, AirVisualEntity): class AirVisualGeographySensor(AirVisualEntity, SensorEntity):
"""Define an AirVisual sensor related to geography data via the Cloud API.""" """Define an AirVisual sensor related to geography data via the Cloud API."""
def __init__(self, coordinator, config_entry, kind, name, icon, unit, locale): def __init__(self, coordinator, config_entry, kind, name, icon, unit, locale):
@ -237,7 +237,7 @@ class AirVisualGeographySensor(SensorEntity, AirVisualEntity):
self._attrs.pop(ATTR_LONGITUDE, None) self._attrs.pop(ATTR_LONGITUDE, None)
class AirVisualNodeProSensor(SensorEntity, AirVisualEntity): class AirVisualNodeProSensor(AirVisualEntity, SensorEntity):
"""Define an AirVisual sensor related to a Node/Pro unit.""" """Define an AirVisual sensor related to a Node/Pro unit."""
def __init__(self, coordinator, kind, name, device_class, unit): def __init__(self, coordinator, kind, name, device_class, unit):

View file

@ -37,7 +37,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(sensor_list, True) async_add_entities(sensor_list, True)
class AmbientWeatherSensor(SensorEntity, AmbientWeatherEntity): class AmbientWeatherSensor(AmbientWeatherEntity, SensorEntity):
"""Define an Ambient sensor.""" """Define an Ambient sensor."""
def __init__( def __init__(

View file

@ -31,7 +31,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(all_sensors, True) async_add_entities(all_sensors, True)
class IPWebcamSensor(SensorEntity, AndroidIPCamEntity): class IPWebcamSensor(AndroidIPCamEntity, SensorEntity):
"""Representation of a IP Webcam sensor.""" """Representation of a IP Webcam sensor."""
def __init__(self, name, host, ipcam, sensor): def __init__(self, name, host, ipcam, sensor):

View file

@ -98,7 +98,7 @@ async def async_setup_entry(
async_add_entities(entities, True) async_add_entities(entities, True)
class AsusWrtSensor(SensorEntity, CoordinatorEntity): class AsusWrtSensor(CoordinatorEntity, SensorEntity):
"""Representation of a AsusWrt sensor.""" """Representation of a AsusWrt sensor."""
def __init__( def __init__(

View file

@ -30,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities([AtagSensor(coordinator, sensor) for sensor in SENSORS]) async_add_entities([AtagSensor(coordinator, sensor) for sensor in SENSORS])
class AtagSensor(SensorEntity, AtagEntity): class AtagSensor(AtagEntity, SensorEntity):
"""Representation of a AtagOne Sensor.""" """Representation of a AtagOne Sensor."""
def __init__(self, coordinator, sensor): def __init__(self, coordinator, sensor):

View file

@ -117,7 +117,7 @@ async def _async_migrate_old_unique_ids(hass, devices):
registry.async_update_entity(old_entity_id, new_unique_id=device.unique_id) registry.async_update_entity(old_entity_id, new_unique_id=device.unique_id)
class AugustOperatorSensor(SensorEntity, AugustEntityMixin, RestoreEntity): class AugustOperatorSensor(AugustEntityMixin, RestoreEntity, SensorEntity):
"""Representation of an August lock operation sensor.""" """Representation of an August lock operation sensor."""
def __init__(self, data, device): def __init__(self, data, device):
@ -216,7 +216,7 @@ class AugustOperatorSensor(SensorEntity, AugustEntityMixin, RestoreEntity):
return f"{self._device_id}_lock_operator" return f"{self._device_id}_lock_operator"
class AugustBatterySensor(SensorEntity, AugustEntityMixin): class AugustBatterySensor(AugustEntityMixin, SensorEntity):
"""Representation of an August sensor.""" """Representation of an August sensor."""
def __init__(self, data, sensor_type, device, old_device): def __init__(self, data, sensor_type, device, old_device):

View file

@ -19,7 +19,7 @@ async def async_setup_entry(hass, entry, async_add_entries):
async_add_entries([entity]) async_add_entries([entity])
class AuroraSensor(SensorEntity, AuroraEntity): class AuroraSensor(AuroraEntity, SensorEntity):
"""Implementation of an aurora sensor.""" """Implementation of an aurora sensor."""
@property @property

View file

@ -84,7 +84,7 @@ async def async_setup_entry(
async_add_entities(sensors) async_add_entities(sensors)
class AwairSensor(SensorEntity, CoordinatorEntity): class AwairSensor(CoordinatorEntity, SensorEntity):
"""Defines an Awair sensor entity.""" """Defines an Awair sensor entity."""
def __init__( def __init__(

View file

@ -56,7 +56,7 @@ async def async_setup_entry(
async_add_entities(sensors, True) async_add_entities(sensors, True)
class AzureDevOpsSensor(SensorEntity, AzureDevOpsDeviceEntity): class AzureDevOpsSensor(AzureDevOpsDeviceEntity, SensorEntity):
"""Defines a Azure DevOps sensor.""" """Defines a Azure DevOps sensor."""
def __init__( def __init__(

View file

@ -14,7 +14,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class BleBoxSensorEntity(SensorEntity, BleBoxEntity): class BleBoxSensorEntity(BleBoxEntity, SensorEntity):
"""Representation of a BleBox sensor feature.""" """Representation of a BleBox sensor feature."""
@property @property

View file

@ -67,7 +67,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities, True) async_add_entities(entities, True)
class BMWConnectedDriveSensor(SensorEntity, BMWConnectedDriveBaseEntity): class BMWConnectedDriveSensor(BMWConnectedDriveBaseEntity, SensorEntity):
"""Representation of a BMW vehicle sensor.""" """Representation of a BMW vehicle sensor."""
def __init__(self, account, vehicle, attribute: str, attribute_info): def __init__(self, account, vehicle, attribute: str, attribute_info):

View file

@ -57,7 +57,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors, False) async_add_entities(sensors, False)
class BrotherPrinterSensor(SensorEntity, CoordinatorEntity): class BrotherPrinterSensor(CoordinatorEntity, SensorEntity):
"""Define an Brother Printer sensor.""" """Define an Brother Printer sensor."""
def __init__(self, coordinator, kind, device_info): def __init__(self, coordinator, kind, device_info):

View file

@ -78,7 +78,7 @@ async def async_setup_entry(
async_add_entities(sensors, True) async_add_entities(sensors, True)
class CanarySensor(SensorEntity, CoordinatorEntity): class CanarySensor(CoordinatorEntity, SensorEntity):
"""Representation of a Canary sensor.""" """Representation of a Canary sensor."""
def __init__(self, coordinator, sensor_type, location, device): def __init__(self, coordinator, sensor_type, location, device):

View file

@ -76,7 +76,7 @@ class CertExpiryEntity(CoordinatorEntity):
} }
class SSLCertificateTimestamp(SensorEntity, CertExpiryEntity): class SSLCertificateTimestamp(CertExpiryEntity, SensorEntity):
"""Implementation of the Cert Expiry timestamp sensor.""" """Implementation of the Cert Expiry timestamp sensor."""
@property @property

View file

@ -24,7 +24,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class CoronavirusSensor(SensorEntity, CoordinatorEntity): class CoronavirusSensor(CoordinatorEntity, SensorEntity):
"""Sensor representing corona virus data.""" """Sensor representing corona virus data."""
name = None name = None

View file

@ -122,7 +122,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class DeconzSensor(SensorEntity, DeconzDevice): class DeconzSensor(DeconzDevice, SensorEntity):
"""Representation of a deCONZ sensor.""" """Representation of a deCONZ sensor."""
TYPE = DOMAIN TYPE = DOMAIN
@ -186,7 +186,7 @@ class DeconzSensor(SensorEntity, DeconzDevice):
return attr return attr
class DeconzBattery(SensorEntity, DeconzDevice): class DeconzBattery(DeconzDevice, SensorEntity):
"""Battery class for when a device is only represented as an event.""" """Battery class for when a device is only represented as an event."""
TYPE = DOMAIN TYPE = DOMAIN

View file

@ -86,7 +86,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([derivative]) async_add_entities([derivative])
class DerivativeSensor(SensorEntity, RestoreEntity): class DerivativeSensor(RestoreEntity, SensorEntity):
"""Representation of an derivative sensor.""" """Representation of an derivative sensor."""
def __init__( def __init__(

View file

@ -66,7 +66,7 @@ async def async_setup_entry(
async_add_entities(entities, False) async_add_entities(entities, False)
class DevoloMultiLevelDeviceEntity(SensorEntity, DevoloDeviceEntity): class DevoloMultiLevelDeviceEntity(DevoloDeviceEntity, SensorEntity):
"""Abstract representation of a multi level sensor within devolo Home Control.""" """Abstract representation of a multi level sensor within devolo Home Control."""
@property @property

View file

@ -17,7 +17,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors, False) async_add_entities(sensors, False)
class DexcomGlucoseValueSensor(SensorEntity, CoordinatorEntity): class DexcomGlucoseValueSensor(CoordinatorEntity, SensorEntity):
"""Representation of a Dexcom glucose value sensor.""" """Representation of a Dexcom glucose value sensor."""
def __init__(self, coordinator, username, unit_of_measurement): def __init__(self, coordinator, username, unit_of_measurement):
@ -59,7 +59,7 @@ class DexcomGlucoseValueSensor(SensorEntity, CoordinatorEntity):
return self._unique_id return self._unique_id
class DexcomGlucoseTrendSensor(SensorEntity, CoordinatorEntity): class DexcomGlucoseTrendSensor(CoordinatorEntity, SensorEntity):
"""Representation of a Dexcom glucose trend sensor.""" """Representation of a Dexcom glucose trend sensor."""
def __init__(self, coordinator, username): def __init__(self, coordinator, username):

View file

@ -101,7 +101,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices) add_entities(devices)
class DysonSensor(SensorEntity, DysonEntity): class DysonSensor(DysonEntity, SensorEntity):
"""Representation of a generic Dyson sensor.""" """Representation of a generic Dyson sensor."""
def __init__(self, device, sensor_type): def __init__(self, device, sensor_type):

View file

@ -78,7 +78,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
await coordinator.async_refresh() await coordinator.async_refresh()
class Measurement(SensorEntity, CoordinatorEntity): class Measurement(CoordinatorEntity, SensorEntity):
"""A gauge at a flood monitoring station.""" """A gauge at a flood monitoring station."""
attribution = "This uses Environment Agency flood and river level data from the real-time data API" attribution = "This uses Environment Agency flood and river level data from the real-time data API"

View file

@ -48,7 +48,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(sensors) async_add_entities(sensors)
class EcoNetSensor(SensorEntity, EcoNetEntity): class EcoNetSensor(EcoNetEntity, SensorEntity):
"""Define a Econet sensor.""" """Define a Econet sensor."""
def __init__(self, econet_device, device_name): def __init__(self, econet_device, device_name):

View file

@ -67,7 +67,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(all_sensors, True) async_add_entities(all_sensors, True)
class EightHeatSensor(SensorEntity, EightSleepHeatEntity): class EightHeatSensor(EightSleepHeatEntity, SensorEntity):
"""Representation of an eight sleep heat-based sensor.""" """Representation of an eight sleep heat-based sensor."""
def __init__(self, name, eight, sensor): def __init__(self, name, eight, sensor):
@ -120,7 +120,7 @@ class EightHeatSensor(SensorEntity, EightSleepHeatEntity):
} }
class EightUserSensor(SensorEntity, EightSleepUserEntity): class EightUserSensor(EightSleepUserEntity, SensorEntity):
"""Representation of an eight sleep user-based sensor.""" """Representation of an eight sleep user-based sensor."""
def __init__(self, name, eight, sensor, units): def __init__(self, name, eight, sensor, units):
@ -290,7 +290,7 @@ class EightUserSensor(SensorEntity, EightSleepUserEntity):
return state_attr return state_attr
class EightRoomSensor(SensorEntity, EightSleepUserEntity): class EightRoomSensor(EightSleepUserEntity, SensorEntity):
"""Representation of an eight sleep room sensor.""" """Representation of an eight sleep room sensor."""
def __init__(self, name, eight, sensor, units): def __init__(self, name, eight, sensor, units):

View file

@ -68,7 +68,7 @@ def temperature_to_state(temperature, undefined_temperature):
return temperature if temperature > undefined_temperature else None return temperature if temperature > undefined_temperature else None
class ElkSensor(SensorEntity, ElkAttachedEntity): class ElkSensor(ElkAttachedEntity, SensorEntity):
"""Base representation of Elk-M1 sensor.""" """Base representation of Elk-M1 sensor."""
def __init__(self, element, elk, elk_data): def __init__(self, element, elk, elk_data):

View file

@ -101,7 +101,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([EnOceanWindowHandle(dev_id, dev_name)]) add_entities([EnOceanWindowHandle(dev_id, dev_name)])
class EnOceanSensor(SensorEntity, EnOceanEntity, RestoreEntity): class EnOceanSensor(EnOceanEntity, RestoreEntity, SensorEntity):
"""Representation of an EnOcean sensor device such as a power meter.""" """Representation of an EnOcean sensor device such as a power meter."""
def __init__(self, dev_id, dev_name, sensor_type): def __init__(self, dev_id, dev_name, sensor_type):

View file

@ -156,7 +156,7 @@ async def async_setup_platform(
async_add_entities(entities) async_add_entities(entities)
class Envoy(SensorEntity, CoordinatorEntity): class Envoy(CoordinatorEntity, SensorEntity):
"""Envoy entity.""" """Envoy entity."""
def __init__(self, sensor_type, name, serial_number, unit, coordinator): def __init__(self, sensor_type, name, serial_number, unit, coordinator):

View file

@ -37,7 +37,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(devices) async_add_entities(devices)
class EnvisalinkSensor(SensorEntity, EnvisalinkDevice): class EnvisalinkSensor(EnvisalinkDevice, SensorEntity):
"""Representation of an Envisalink keypad.""" """Representation of an Envisalink keypad."""
def __init__(self, hass, partition_name, partition_number, info, controller): def __init__(self, hass, partition_name, partition_number, info, controller):

View file

@ -42,7 +42,7 @@ async def async_setup_entry(
# pylint: disable=invalid-overridden-method # pylint: disable=invalid-overridden-method
class EsphomeSensor(SensorEntity, EsphomeEntity): class EsphomeSensor(EsphomeEntity, SensorEntity):
"""A sensor implementation for esphome.""" """A sensor implementation for esphome."""
@property @property
@ -89,7 +89,7 @@ class EsphomeSensor(SensorEntity, EsphomeEntity):
return self._static_info.device_class return self._static_info.device_class
class EsphomeTextSensor(SensorEntity, EsphomeEntity): class EsphomeTextSensor(EsphomeEntity, SensorEntity):
"""A text sensor implementation for ESPHome.""" """A text sensor implementation for ESPHome."""
@property @property