Migrate integrations a-c to extend SensorEntity (#48210)
parent
1bb29bffbb
commit
e0cd7072d6
|
@ -1,6 +1,7 @@
|
|||
"""Support for Abode Security System sensors."""
|
||||
import abodepy.helpers.constants as CONST
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_ILLUMINANCE,
|
||||
|
@ -33,7 +34,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class AbodeSensor(AbodeDevice):
|
||||
class AbodeSensor(SensorEntity, AbodeDevice):
|
||||
"""A sensor implementation for Abode devices."""
|
||||
|
||||
def __init__(self, data, device, sensor_type):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for the AccuWeather service."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_DEVICE_CLASS,
|
||||
|
@ -48,7 +49,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(sensors, False)
|
||||
|
||||
|
||||
class AccuWeatherSensor(CoordinatorEntity):
|
||||
class AccuWeatherSensor(SensorEntity, CoordinatorEntity):
|
||||
"""Define an AccuWeather entity."""
|
||||
|
||||
def __init__(self, name, kind, coordinator, forecast_day=None):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for Acmeda Roller Blind Batteries."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
@ -29,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
)
|
||||
|
||||
|
||||
class AcmedaBattery(AcmedaBase):
|
||||
class AcmedaBattery(SensorEntity, AcmedaBase):
|
||||
"""Representation of a Acmeda cover device."""
|
||||
|
||||
device_class = DEVICE_CLASS_BATTERY
|
||||
|
|
|
@ -6,6 +6,7 @@ from typing import Callable
|
|||
|
||||
from adguardhome import AdGuardHome, AdGuardHomeConnectionError
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import PERCENTAGE, TIME_MILLISECONDS
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -48,7 +49,7 @@ async def async_setup_entry(
|
|||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class AdGuardHomeSensor(AdGuardHomeDeviceEntity):
|
||||
class AdGuardHomeSensor(SensorEntity, AdGuardHomeDeviceEntity):
|
||||
"""Defines a AdGuard Home sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import ads
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([entity])
|
||||
|
||||
|
||||
class AdsSensor(AdsEntity):
|
||||
class AdsSensor(SensorEntity, AdsEntity):
|
||||
"""Representation of an ADS sensor entity."""
|
||||
|
||||
def __init__(self, ads_hub, ads_var, ads_type, name, unit_of_measurement, factor):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Sensor platform for Advantage Air integration."""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import PERCENTAGE
|
||||
from homeassistant.helpers import config_validation as cv, entity_platform
|
||||
|
||||
|
@ -40,7 +41,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
)
|
||||
|
||||
|
||||
class AdvantageAirTimeTo(AdvantageAirEntity):
|
||||
class AdvantageAirTimeTo(SensorEntity, AdvantageAirEntity):
|
||||
"""Representation of Advantage Air timer control."""
|
||||
|
||||
def __init__(self, instance, ac_key, action):
|
||||
|
@ -82,7 +83,7 @@ class AdvantageAirTimeTo(AdvantageAirEntity):
|
|||
await self.async_change({self.ac_key: {"info": {self._time_key: value}}})
|
||||
|
||||
|
||||
class AdvantageAirZoneVent(AdvantageAirEntity):
|
||||
class AdvantageAirZoneVent(SensorEntity, AdvantageAirEntity):
|
||||
"""Representation of Advantage Air Zone Vent Sensor."""
|
||||
|
||||
@property
|
||||
|
@ -115,7 +116,7 @@ class AdvantageAirZoneVent(AdvantageAirEntity):
|
|||
return "mdi:fan-off"
|
||||
|
||||
|
||||
class AdvantageAirZoneSignal(AdvantageAirEntity):
|
||||
class AdvantageAirZoneSignal(SensorEntity, AdvantageAirEntity):
|
||||
"""Representation of Advantage Air Zone wireless signal sensor."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for the AEMET OpenData service."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
|
||||
from .abstract_aemet_sensor import AbstractAemetSensor
|
||||
from .const import (
|
||||
DOMAIN,
|
||||
|
@ -56,7 +58,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class AemetSensor(AbstractAemetSensor):
|
||||
class AemetSensor(SensorEntity, AbstractAemetSensor):
|
||||
"""Implementation of an AEMET OpenData sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -79,7 +81,7 @@ class AemetSensor(AbstractAemetSensor):
|
|||
return self._weather_coordinator.data.get(self._sensor_type)
|
||||
|
||||
|
||||
class AemetForecastSensor(AbstractAemetSensor):
|
||||
class AemetForecastSensor(SensorEntity, AbstractAemetSensor):
|
||||
"""Implementation of an AEMET OpenData forecast sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -5,12 +5,11 @@ import logging
|
|||
from pyaftership.tracker import Tracking
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME, HTTP_OK
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -108,7 +107,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
)
|
||||
|
||||
|
||||
class AfterShipSensor(Entity):
|
||||
class AfterShipSensor(SensorEntity):
|
||||
"""Representation of a AfterShip sensor."""
|
||||
|
||||
def __init__(self, aftership, name):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for the Airly sensor service."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_DEVICE_CLASS,
|
||||
|
@ -72,7 +73,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(sensors, False)
|
||||
|
||||
|
||||
class AirlySensor(CoordinatorEntity):
|
||||
class AirlySensor(SensorEntity, CoordinatorEntity):
|
||||
"""Define an Airly sensor."""
|
||||
|
||||
def __init__(self, coordinator, name, kind):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for the AirNow sensor service."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_DEVICE_CLASS,
|
||||
|
@ -59,7 +60,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(sensors, False)
|
||||
|
||||
|
||||
class AirNowSensor(CoordinatorEntity):
|
||||
class AirNowSensor(SensorEntity, CoordinatorEntity):
|
||||
"""Define an AirNow sensor."""
|
||||
|
||||
def __init__(self, coordinator, kind):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for AirVisual air quality sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_LATITUDE,
|
||||
ATTR_LONGITUDE,
|
||||
|
@ -138,7 +139,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class AirVisualGeographySensor(AirVisualEntity):
|
||||
class AirVisualGeographySensor(SensorEntity, AirVisualEntity):
|
||||
"""Define an AirVisual sensor related to geography data via the Cloud API."""
|
||||
|
||||
def __init__(self, coordinator, config_entry, kind, name, icon, unit, locale):
|
||||
|
@ -236,7 +237,7 @@ class AirVisualGeographySensor(AirVisualEntity):
|
|||
self._attrs.pop(ATTR_LONGITUDE, None)
|
||||
|
||||
|
||||
class AirVisualNodeProSensor(AirVisualEntity):
|
||||
class AirVisualNodeProSensor(SensorEntity, AirVisualEntity):
|
||||
"""Define an AirVisual sensor related to a Node/Pro unit."""
|
||||
|
||||
def __init__(self, coordinator, kind, name, device_class, unit):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Support for AlarmDecoder sensors (Shows Panel Display)."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from .const import SIGNAL_PANEL_MESSAGE
|
||||
|
@ -16,7 +16,7 @@ async def async_setup_entry(
|
|||
return True
|
||||
|
||||
|
||||
class AlarmDecoderSensor(Entity):
|
||||
class AlarmDecoderSensor(SensorEntity):
|
||||
"""Representation of an AlarmDecoder keypad."""
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
@ -6,10 +6,9 @@ from alpha_vantage.foreignexchange import ForeignExchange
|
|||
from alpha_vantage.timeseries import TimeSeries
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_CURRENCY, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -105,7 +104,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
_LOGGER.debug("Setup completed")
|
||||
|
||||
|
||||
class AlphaVantageSensor(Entity):
|
||||
class AlphaVantageSensor(SensorEntity):
|
||||
"""Representation of a Alpha Vantage sensor."""
|
||||
|
||||
def __init__(self, timeseries, symbol):
|
||||
|
@ -156,7 +155,7 @@ class AlphaVantageSensor(Entity):
|
|||
_LOGGER.debug("Received new values for symbol %s", self._symbol)
|
||||
|
||||
|
||||
class AlphaVantageForeignExchange(Entity):
|
||||
class AlphaVantageForeignExchange(SensorEntity):
|
||||
"""Sensor for foreign exchange rates."""
|
||||
|
||||
def __init__(self, foreign_exchange, config):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Support for Ambient Weather Station sensors."""
|
||||
from homeassistant.components.binary_sensor import DOMAIN as SENSOR
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import ATTR_NAME
|
||||
from homeassistant.core import callback
|
||||
|
||||
|
@ -36,7 +37,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
async_add_entities(sensor_list, True)
|
||||
|
||||
|
||||
class AmbientWeatherSensor(AmbientWeatherEntity):
|
||||
class AmbientWeatherSensor(SensorEntity, AmbientWeatherEntity):
|
||||
"""Define an Ambient sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -4,9 +4,9 @@ import logging
|
|||
|
||||
from amcrest import AmcrestError
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_SENSORS, PERCENTAGE
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DATA_AMCREST, DEVICES, SENSOR_SCAN_INTERVAL_SECS, SERVICE_UPDATE
|
||||
from .helpers import log_update_error, service_signal
|
||||
|
@ -40,7 +40,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
)
|
||||
|
||||
|
||||
class AmcrestSensor(Entity):
|
||||
class AmcrestSensor(SensorEntity):
|
||||
"""A sensor implementation for Amcrest IP camera."""
|
||||
|
||||
def __init__(self, name, device, sensor_type):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for Android IP Webcam sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
|
||||
from . import (
|
||||
|
@ -30,7 +31,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(all_sensors, True)
|
||||
|
||||
|
||||
class IPWebcamSensor(AndroidIPCamEntity):
|
||||
class IPWebcamSensor(SensorEntity, AndroidIPCamEntity):
|
||||
"""Representation of a IP Webcam sensor."""
|
||||
|
||||
def __init__(self, name, host, ipcam, sensor):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from apcaccess.status import ALL_UNITS
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_RESOURCES,
|
||||
ELECTRICAL_CURRENT_AMPERE,
|
||||
|
@ -18,7 +18,6 @@ from homeassistant.const import (
|
|||
VOLT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
|
@ -156,7 +155,7 @@ def infer_unit(value):
|
|||
return value, None
|
||||
|
||||
|
||||
class APCUPSdSensor(Entity):
|
||||
class APCUPSdSensor(SensorEntity):
|
||||
"""Representation of a sensor entity for APCUPSd status values."""
|
||||
|
||||
def __init__(self, data, sensor_type):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
PERCENTAGE,
|
||||
|
@ -12,7 +12,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import DOMAIN, UPDATE_TOPIC
|
||||
|
||||
|
@ -56,7 +55,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class AquaLogicSensor(Entity):
|
||||
class AquaLogicSensor(SensorEntity):
|
||||
"""Sensor implementation for the AquaLogic component."""
|
||||
|
||||
def __init__(self, processor, sensor_type):
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
"""Support for getting information from Arduino pins."""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
|
@ -30,7 +29,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors)
|
||||
|
||||
|
||||
class ArduinoSensor(Entity):
|
||||
class ArduinoSensor(SensorEntity):
|
||||
"""Representation of an Arduino Sensor."""
|
||||
|
||||
def __init__(self, name, pin, pin_type, board):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MONITORED_VARIABLES,
|
||||
CONF_NAME,
|
||||
|
@ -16,7 +16,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.exceptions import TemplateError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -124,7 +123,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev, True)
|
||||
|
||||
|
||||
class ArestSensor(Entity):
|
||||
class ArestSensor(SensorEntity):
|
||||
"""Implementation of an aREST sensor for exposed variables."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
|
@ -16,7 +16,6 @@ from homeassistant.const import (
|
|||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
|
||||
from . import ATTRIBUTION, DATA_ARLO, DEFAULT_BRAND, SIGNAL_UPDATE_ARLO
|
||||
|
@ -73,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class ArloSensor(Entity):
|
||||
class ArloSensor(SensorEntity):
|
||||
"""An implementation of a Netgear Arlo IP sensor."""
|
||||
|
||||
def __init__(self, name, device, sensor_type):
|
||||
|
|
|
@ -3,9 +3,9 @@ import json
|
|||
import logging
|
||||
|
||||
from homeassistant.components import mqtt
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEGREE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import slugify
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -114,7 +114,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
return True
|
||||
|
||||
|
||||
class ArwnSensor(Entity):
|
||||
class ArwnSensor(SensorEntity):
|
||||
"""Representation of an ARWN sensor."""
|
||||
|
||||
def __init__(self, topic, name, state_key, units, icon=None):
|
||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||
import logging
|
||||
from numbers import Number
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import DATA_GIGABYTES, DATA_RATE_MEGABITS_PER_SECOND
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
@ -97,7 +98,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class AsusWrtSensor(CoordinatorEntity):
|
||||
class AsusWrtSensor(SensorEntity, CoordinatorEntity):
|
||||
"""Representation of a AsusWrt sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Initialization of ATAG One sensor platform."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_PRESSURE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
|
@ -29,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities([AtagSensor(coordinator, sensor) for sensor in SENSORS])
|
||||
|
||||
|
||||
class AtagSensor(AtagEntity):
|
||||
class AtagSensor(SensorEntity, AtagEntity):
|
||||
"""Representation of a AtagOne Sensor."""
|
||||
|
||||
def __init__(self, coordinator, sensor):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
from pyatome.client import AtomeClient, PyAtomeError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
CONF_PASSWORD,
|
||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
|||
POWER_WATT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -215,7 +214,7 @@ class AtomeData:
|
|||
_LOGGER.error("Missing last value in values: %s: %s", values, error)
|
||||
|
||||
|
||||
class AtomeSensor(Entity):
|
||||
class AtomeSensor(SensorEntity):
|
||||
"""Representation of a sensor entity for Atome."""
|
||||
|
||||
def __init__(self, data, name, sensor_type):
|
||||
|
|
|
@ -3,10 +3,9 @@ import logging
|
|||
|
||||
from yalexs.activity import ActivityType
|
||||
|
||||
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY
|
||||
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, SensorEntity
|
||||
from homeassistant.const import ATTR_ENTITY_PICTURE, PERCENTAGE, STATE_UNAVAILABLE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_registry import async_get_registry
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
||||
|
@ -118,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)
|
||||
|
||||
|
||||
class AugustOperatorSensor(AugustEntityMixin, RestoreEntity, Entity):
|
||||
class AugustOperatorSensor(SensorEntity, AugustEntityMixin, RestoreEntity):
|
||||
"""Representation of an August lock operation sensor."""
|
||||
|
||||
def __init__(self, data, device):
|
||||
|
@ -217,7 +216,7 @@ class AugustOperatorSensor(AugustEntityMixin, RestoreEntity, Entity):
|
|||
return f"{self._device_id}_lock_operator"
|
||||
|
||||
|
||||
class AugustBatterySensor(AugustEntityMixin, Entity):
|
||||
class AugustBatterySensor(SensorEntity, AugustEntityMixin):
|
||||
"""Representation of an August sensor."""
|
||||
|
||||
def __init__(self, data, sensor_type, device, old_device):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for Aurora Forecast sensor."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import PERCENTAGE
|
||||
|
||||
from . import AuroraEntity
|
||||
|
@ -18,7 +19,7 @@ async def async_setup_entry(hass, entry, async_add_entries):
|
|||
async_add_entries([entity])
|
||||
|
||||
|
||||
class AuroraSensor(AuroraEntity):
|
||||
class AuroraSensor(SensorEntity, AuroraEntity):
|
||||
"""Implementation of an aurora sensor."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
from aurorapy.client import AuroraError, AuroraSerialClient
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_ADDRESS,
|
||||
CONF_DEVICE,
|
||||
|
@ -14,7 +14,6 @@ from homeassistant.const import (
|
|||
POWER_WATT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -44,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices, True)
|
||||
|
||||
|
||||
class AuroraABBSolarPVMonitorSensor(Entity):
|
||||
class AuroraABBSolarPVMonitorSensor(SensorEntity):
|
||||
"""Representation of a Sensor."""
|
||||
|
||||
def __init__(self, client, name, typename):
|
||||
|
|
|
@ -7,7 +7,7 @@ from python_awair.devices import AwairDevice
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.awair import AwairDataUpdateCoordinator, AwairResult
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_DEVICE_CLASS, CONF_ACCESS_TOKEN
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
@ -84,7 +84,7 @@ async def async_setup_entry(
|
|||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class AwairSensor(CoordinatorEntity):
|
||||
class AwairSensor(SensorEntity, CoordinatorEntity):
|
||||
"""Defines an Awair sensor entity."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -17,6 +17,7 @@ from homeassistant.components.azure_devops.const import (
|
|||
DATA_PROJECT,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
@ -55,7 +56,7 @@ async def async_setup_entry(
|
|||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class AzureDevOpsSensor(AzureDevOpsDeviceEntity):
|
||||
class AzureDevOpsSensor(SensorEntity, AzureDevOpsDeviceEntity):
|
||||
"""Defines a Azure DevOps sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -6,7 +6,7 @@ import pybbox
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
CONF_MONITORED_VARIABLES,
|
||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
|||
DEVICE_CLASS_TIMESTAMP,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
|
@ -86,7 +85,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class BboxUptimeSensor(Entity):
|
||||
class BboxUptimeSensor(SensorEntity):
|
||||
"""Bbox uptime sensor."""
|
||||
|
||||
def __init__(self, bbox_data, sensor_type, name):
|
||||
|
@ -133,7 +132,7 @@ class BboxUptimeSensor(Entity):
|
|||
self._state = uptime.replace(microsecond=0).isoformat()
|
||||
|
||||
|
||||
class BboxSensor(Entity):
|
||||
class BboxSensor(SensorEntity):
|
||||
"""Implementation of a Bbox sensor."""
|
||||
|
||||
def __init__(self, bbox_data, sensor_type, name):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from beewi_smartclim import BeewiSmartClimPoller # pylint: disable=import-error
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MAC,
|
||||
CONF_NAME,
|
||||
|
@ -13,7 +13,6 @@ from homeassistant.const import (
|
|||
TEMP_CELSIUS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
# Default values
|
||||
DEFAULT_NAME = "BeeWi SmartClim"
|
||||
|
@ -56,7 +55,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors)
|
||||
|
||||
|
||||
class BeewiSmartclimSensor(Entity):
|
||||
class BeewiSmartclimSensor(SensorEntity):
|
||||
"""Representation of a Sensor."""
|
||||
|
||||
def __init__(self, poller, name, mac, device, unit):
|
||||
|
|
|
@ -6,10 +6,9 @@ from i2csense.bh1750 import BH1750 # pylint: disable=import-error
|
|||
import smbus
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME, DEVICE_CLASS_ILLUMINANCE, LIGHT_LUX
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -94,7 +93,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(dev, True)
|
||||
|
||||
|
||||
class BH1750Sensor(Entity):
|
||||
class BH1750Sensor(SensorEntity):
|
||||
"""Implementation of the BH1750 sensor."""
|
||||
|
||||
def __init__(self, bh1750_sensor, name, unit, multiplier=1.0):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
from blockchain import exchangerates, statistics
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
CONF_CURRENCY,
|
||||
|
@ -14,7 +14,6 @@ from homeassistant.const import (
|
|||
TIME_SECONDS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -77,7 +76,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev, True)
|
||||
|
||||
|
||||
class BitcoinSensor(Entity):
|
||||
class BitcoinSensor(SensorEntity):
|
||||
"""Representation of a Bitcoin sensor."""
|
||||
|
||||
def __init__(self, data, option_type, currency):
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
from bizkaibus.bizkaibus import BizkaibusData
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME, TIME_MINUTES
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
ATTR_DUE_IN = "Due in"
|
||||
|
||||
|
@ -33,7 +32,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([BizkaibusSensor(data, stop, route, name)], True)
|
||||
|
||||
|
||||
class BizkaibusSensor(Entity):
|
||||
class BizkaibusSensor(SensorEntity):
|
||||
"""The class for handling the data."""
|
||||
|
||||
def __init__(self, data, stop, route, name):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""BleBox sensor entities."""
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
|
||||
from . import BleBoxEntity, create_blebox_entities
|
||||
from .const import BLEBOX_TO_HASS_DEVICE_CLASSES, BLEBOX_TO_UNIT_MAP
|
||||
|
@ -14,7 +14,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
)
|
||||
|
||||
|
||||
class BleBoxSensorEntity(BleBoxEntity, Entity):
|
||||
class BleBoxSensorEntity(SensorEntity, BleBoxEntity):
|
||||
"""Representation of a BleBox sensor feature."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""Support for Blink system camera sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN, TYPE_TEMPERATURE, TYPE_WIFI_STRENGTH
|
||||
|
||||
|
@ -34,7 +34,7 @@ async def async_setup_entry(hass, config, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class BlinkSensor(Entity):
|
||||
class BlinkSensor(SensorEntity):
|
||||
"""A Blink camera sensor."""
|
||||
|
||||
def __init__(self, data, camera, sensor_type):
|
||||
|
|
|
@ -5,10 +5,9 @@ import logging
|
|||
from pyblockchain import get_balance, validate_address
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -44,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([BlockchainSensor(name, addresses)], True)
|
||||
|
||||
|
||||
class BlockchainSensor(Entity):
|
||||
class BlockchainSensor(SensorEntity):
|
||||
"""Representation of a Blockchain.com sensor."""
|
||||
|
||||
def __init__(self, name, addresses):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support the sensor of a BloomSky weather station."""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
AREA_SQUARE_METERS,
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
|
@ -12,7 +12,6 @@ from homeassistant.const import (
|
|||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
|
@ -70,7 +69,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([BloomSkySensor(bloomsky, device, variable)], True)
|
||||
|
||||
|
||||
class BloomSkySensor(Entity):
|
||||
class BloomSkySensor(SensorEntity):
|
||||
"""Representation of a single sensor in a BloomSky device."""
|
||||
|
||||
def __init__(self, bs, device, sensor_name):
|
||||
|
|
|
@ -7,7 +7,7 @@ from i2csense.bme280 import BME280 # pylint: disable=import-error
|
|||
import smbus
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
CONF_NAME,
|
||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
|||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
from homeassistant.util.temperature import celsius_to_fahrenheit
|
||||
|
||||
|
@ -136,7 +135,7 @@ class BME280Handler:
|
|||
self.sensor.update(first_reading)
|
||||
|
||||
|
||||
class BME280Sensor(Entity):
|
||||
class BME280Sensor(SensorEntity):
|
||||
"""Implementation of the BME280 sensor."""
|
||||
|
||||
def __init__(self, bme280_client, sensor_type, temp_unit, name):
|
||||
|
|
|
@ -7,7 +7,7 @@ import bme680 # pylint: disable=import-error
|
|||
from smbus import SMBus
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
CONF_NAME,
|
||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
|||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util.temperature import celsius_to_fahrenheit
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -316,7 +315,7 @@ class BME680Handler:
|
|||
return hum_score + gas_score
|
||||
|
||||
|
||||
class BME680Sensor(Entity):
|
||||
class BME680Sensor(SensorEntity):
|
||||
"""Implementation of the BME680 sensor."""
|
||||
|
||||
def __init__(self, bme680_client, sensor_type, temp_unit, name):
|
||||
|
|
|
@ -11,11 +11,11 @@ from homeassistant.components.sensor import (
|
|||
DEVICE_CLASS_PRESSURE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
PLATFORM_SCHEMA,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_NAME, PRESSURE_HPA, TEMP_CELSIUS
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -65,7 +65,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
)
|
||||
|
||||
|
||||
class Bmp280Sensor(Entity):
|
||||
class Bmp280Sensor(SensorEntity):
|
||||
"""Base class for BMP280 entities."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -3,6 +3,7 @@ import logging
|
|||
|
||||
from bimmer_connected.state import ChargingState
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_UNIT_SYSTEM_IMPERIAL,
|
||||
LENGTH_KILOMETERS,
|
||||
|
@ -12,7 +13,6 @@ from homeassistant.const import (
|
|||
VOLUME_GALLONS,
|
||||
VOLUME_LITERS,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
|
||||
from . import DOMAIN as BMW_DOMAIN, BMWConnectedDriveBaseEntity
|
||||
|
@ -67,7 +67,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class BMWConnectedDriveSensor(BMWConnectedDriveBaseEntity, Entity):
|
||||
class BMWConnectedDriveSensor(SensorEntity, BMWConnectedDriveBaseEntity):
|
||||
"""Representation of a BMW vehicle sensor."""
|
||||
|
||||
def __init__(self, account, vehicle, attribute: str, attribute_info):
|
||||
|
|
|
@ -8,11 +8,11 @@ from homeassistant.components.sensor import (
|
|||
DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
PLATFORM_SCHEMA,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, PERCENTAGE, TEMP_CELSIUS
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN
|
||||
from .helpers import import_device
|
||||
|
@ -56,7 +56,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class BroadlinkSensor(Entity):
|
||||
class BroadlinkSensor(SensorEntity):
|
||||
"""Representation of a Broadlink sensor."""
|
||||
|
||||
def __init__(self, device, monitored_condition):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for the Brother service."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
|
@ -56,7 +57,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(sensors, False)
|
||||
|
||||
|
||||
class BrotherPrinterSensor(CoordinatorEntity):
|
||||
class BrotherPrinterSensor(SensorEntity, CoordinatorEntity):
|
||||
"""Define an Brother Printer sensor."""
|
||||
|
||||
def __init__(self, coordinator, kind, device_info):
|
||||
|
|
|
@ -7,7 +7,7 @@ import uuid
|
|||
import brottsplatskartan
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
CONF_LATITUDE,
|
||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
|||
CONF_NAME,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -78,7 +77,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([BrottsplatskartanSensor(bpk, name)], True)
|
||||
|
||||
|
||||
class BrottsplatskartanSensor(Entity):
|
||||
class BrottsplatskartanSensor(SensorEntity):
|
||||
"""Representation of a Brottsplatskartan Sensor."""
|
||||
|
||||
def __init__(self, bpk, name):
|
||||
|
|
|
@ -20,7 +20,7 @@ from buienradar.constants import (
|
|||
)
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
CONF_LATITUDE,
|
||||
|
@ -39,7 +39,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from .const import DEFAULT_TIMEFRAME
|
||||
|
@ -236,7 +235,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
await data.schedule_update(1)
|
||||
|
||||
|
||||
class BrSensor(Entity):
|
||||
class BrSensor(SensorEntity):
|
||||
"""Representation of an Buienradar sensor."""
|
||||
|
||||
def __init__(self, sensor_type, client_name, coordinates):
|
||||
|
|
|
@ -5,6 +5,7 @@ from typing import Callable
|
|||
|
||||
from canary.api import SensorType
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_BATTERY,
|
||||
|
@ -77,7 +78,7 @@ async def async_setup_entry(
|
|||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class CanarySensor(CoordinatorEntity, Entity):
|
||||
class CanarySensor(SensorEntity, CoordinatorEntity):
|
||||
"""Representation of a Canary sensor."""
|
||||
|
||||
def __init__(self, coordinator, sensor_type, location, device):
|
||||
|
|
|
@ -3,7 +3,7 @@ from datetime import timedelta
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
|
@ -76,7 +76,7 @@ class CertExpiryEntity(CoordinatorEntity):
|
|||
}
|
||||
|
||||
|
||||
class SSLCertificateTimestamp(CertExpiryEntity):
|
||||
class SSLCertificateTimestamp(SensorEntity, CertExpiryEntity):
|
||||
"""Implementation of the Cert Expiry timestamp sensor."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -7,7 +7,11 @@ import aiohttp
|
|||
import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import ENTITY_ID_FORMAT, PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import (
|
||||
ENTITY_ID_FORMAT,
|
||||
PLATFORM_SCHEMA,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_ID,
|
||||
|
@ -25,7 +29,7 @@ from homeassistant.const import (
|
|||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
||||
from homeassistant.helpers.entity import async_generate_entity_id
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.util import distance, location
|
||||
|
||||
|
@ -258,7 +262,7 @@ class CityBikesNetwork:
|
|||
raise PlatformNotReady from err
|
||||
|
||||
|
||||
class CityBikesStation(Entity):
|
||||
class CityBikesStation(SensorEntity):
|
||||
"""CityBikes API Sensor."""
|
||||
|
||||
def __init__(self, network, station_id, entity_id):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import CO2Signal
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
CONF_LATITUDE,
|
||||
|
@ -13,7 +13,6 @@ from homeassistant.const import (
|
|||
ENERGY_KILO_WATT_HOUR,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
CONF_COUNTRY_CODE = "country_code"
|
||||
|
||||
|
@ -52,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devs, True)
|
||||
|
||||
|
||||
class CO2Sensor(Entity):
|
||||
class CO2Sensor(SensorEntity):
|
||||
"""Implementation of the CO2Signal sensor."""
|
||||
|
||||
def __init__(self, token, country_code, lat, lon):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Support for Coinbase sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
ATTR_NATIVE_BALANCE = "Balance in native currency"
|
||||
|
||||
|
@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([sensor], True)
|
||||
|
||||
|
||||
class AccountSensor(Entity):
|
||||
class AccountSensor(SensorEntity):
|
||||
"""Representation of a Coinbase.com sensor."""
|
||||
|
||||
def __init__(self, coinbase_data, name, currency):
|
||||
|
@ -88,7 +88,7 @@ class AccountSensor(Entity):
|
|||
self._native_currency = account["native_balance"]["currency"]
|
||||
|
||||
|
||||
class ExchangeRateSensor(Entity):
|
||||
class ExchangeRateSensor(SensorEntity):
|
||||
"""Representation of a Coinbase.com sensor."""
|
||||
|
||||
def __init__(self, coinbase_data, exchange_currency, native_currency):
|
||||
|
|
|
@ -8,11 +8,10 @@ import aiohttp
|
|||
import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME, CONF_OFFSET
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_RESOURCE = "https://hourlypricing.comed.com/api"
|
||||
|
@ -65,7 +64,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(dev, True)
|
||||
|
||||
|
||||
class ComedHourlyPricingSensor(Entity):
|
||||
class ComedHourlyPricingSensor(SensorEntity):
|
||||
"""Implementation of a ComEd Hourly Pricing sensor."""
|
||||
|
||||
def __init__(self, loop, websession, sensor_type, offset, name):
|
||||
|
|
|
@ -26,7 +26,7 @@ from pycomfoconnect import (
|
|||
)
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
ATTR_ICON,
|
||||
|
@ -45,7 +45,6 @@ from homeassistant.const import (
|
|||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import DOMAIN, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, ComfoConnectBridge
|
||||
|
||||
|
@ -258,7 +257,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class ComfoConnectSensor(Entity):
|
||||
class ComfoConnectSensor(SensorEntity):
|
||||
"""Representation of a ComfoConnect sensor."""
|
||||
|
||||
def __init__(self, name, ccb: ComfoConnectBridge, sensor_type) -> None:
|
||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_COMMAND,
|
||||
CONF_NAME,
|
||||
|
@ -17,7 +17,6 @@ from homeassistant.const import (
|
|||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.helpers import template
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.reload import setup_reload_service
|
||||
|
||||
from . import check_output_or_log
|
||||
|
@ -63,7 +62,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
)
|
||||
|
||||
|
||||
class CommandSensor(Entity):
|
||||
class CommandSensor(SensorEntity):
|
||||
"""Representation of a sensor that is using shell commands."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Sensor platform for the Corona virus."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
|
@ -23,7 +24,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
)
|
||||
|
||||
|
||||
class CoronavirusSensor(CoordinatorEntity):
|
||||
class CoronavirusSensor(SensorEntity, CoordinatorEntity):
|
||||
"""Sensor representing corona virus data."""
|
||||
|
||||
name = None
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
from cpuinfo import cpuinfo
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME, FREQUENCY_GIGAHERTZ
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
ATTR_BRAND = "brand"
|
||||
ATTR_HZ = "ghz_advertised"
|
||||
|
@ -29,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([CpuSpeedSensor(name)], True)
|
||||
|
||||
|
||||
class CpuSpeedSensor(Entity):
|
||||
class CpuSpeedSensor(SensorEntity):
|
||||
"""Representation of a CPU sensor."""
|
||||
|
||||
def __init__(self, name):
|
||||
|
|
|
@ -5,11 +5,10 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT, PERCENTAGE
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -96,7 +95,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev, True)
|
||||
|
||||
|
||||
class CupsSensor(Entity):
|
||||
class CupsSensor(SensorEntity):
|
||||
"""Representation of a CUPS sensor."""
|
||||
|
||||
def __init__(self, data, printer):
|
||||
|
@ -155,7 +154,7 @@ class CupsSensor(Entity):
|
|||
self._available = self.data.available
|
||||
|
||||
|
||||
class IPPSensor(Entity):
|
||||
class IPPSensor(SensorEntity):
|
||||
"""Implementation of the IPPSensor.
|
||||
|
||||
This sensor represents the status of the printer.
|
||||
|
@ -232,7 +231,7 @@ class IPPSensor(Entity):
|
|||
self._available = self.data.available
|
||||
|
||||
|
||||
class MarkerSensor(Entity):
|
||||
class MarkerSensor(SensorEntity):
|
||||
"""Implementation of the MarkerSensor.
|
||||
|
||||
This sensor represents the percentage of ink or toner.
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
CONF_API_KEY,
|
||||
|
@ -14,7 +14,6 @@ from homeassistant.const import (
|
|||
CONF_QUOTE,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_RESOURCE = "http://apilayer.net/api/live"
|
||||
|
@ -55,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class CurrencylayerSensor(Entity):
|
||||
class CurrencylayerSensor(SensorEntity):
|
||||
"""Implementing the Currencylayer sensor."""
|
||||
|
||||
def __init__(self, rest, base, quote):
|
||||
|
|
|
@ -25,6 +25,7 @@ from homeassistant.helpers.config_validation import ( # noqa: F401
|
|||
PLATFORM_SCHEMA,
|
||||
PLATFORM_SCHEMA_BASE,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
@ -74,3 +75,7 @@ async def async_setup_entry(hass, entry):
|
|||
async def async_unload_entry(hass, entry):
|
||||
"""Unload a config entry."""
|
||||
return await hass.data[DOMAIN].async_unload_entry(entry)
|
||||
|
||||
|
||||
class SensorEntity(Entity):
|
||||
"""Base class for sensor entities."""
|
||||
|
|
Loading…
Reference in New Issue