diff --git a/homeassistant/components/tado/sensor.py b/homeassistant/components/tado/sensor.py index cfafeb14ddf..87d2170eb75 100644 --- a/homeassistant/components/tado/sensor.py +++ b/homeassistant/components/tado/sensor.py @@ -1,6 +1,7 @@ """Support for Tado sensors for each zone.""" import logging +from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( DEVICE_CLASS_HUMIDITY, @@ -10,7 +11,6 @@ from homeassistant.const import ( ) from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.entity import Entity from .const import ( CONDITIONS_MAP, @@ -86,7 +86,7 @@ async def async_setup_entry( async_add_entities(entities, True) -class TadoHomeSensor(TadoHomeEntity, Entity): +class TadoHomeSensor(TadoHomeEntity, SensorEntity): """Representation of a Tado Sensor.""" def __init__(self, tado, home_variable): @@ -191,7 +191,7 @@ class TadoHomeSensor(TadoHomeEntity, Entity): } -class TadoZoneSensor(TadoZoneEntity, Entity): +class TadoZoneSensor(TadoZoneEntity, SensorEntity): """Representation of a tado Sensor.""" def __init__(self, tado, zone_name, zone_id, zone_variable): diff --git a/homeassistant/components/tahoma/sensor.py b/homeassistant/components/tahoma/sensor.py index 91629137318..47e6d300414 100644 --- a/homeassistant/components/tahoma/sensor.py +++ b/homeassistant/components/tahoma/sensor.py @@ -2,8 +2,8 @@ from datetime import timedelta import logging +from homeassistant.components.sensor import SensorEntity from homeassistant.const import ATTR_BATTERY_LEVEL, LIGHT_LUX, PERCENTAGE, TEMP_CELSIUS -from homeassistant.helpers.entity import Entity from . import DOMAIN as TAHOMA_DOMAIN, TahomaDevice @@ -25,7 +25,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class TahomaSensor(TahomaDevice, Entity): +class TahomaSensor(TahomaDevice, SensorEntity): """Representation of a Tahoma Sensor.""" def __init__(self, tahoma_device, controller): diff --git a/homeassistant/components/tank_utility/sensor.py b/homeassistant/components/tank_utility/sensor.py index d0566ec7c9e..379819cf65e 100644 --- a/homeassistant/components/tank_utility/sensor.py +++ b/homeassistant/components/tank_utility/sensor.py @@ -7,10 +7,9 @@ import requests from tank_utility import auth, device as tank_monitor import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_DEVICES, CONF_EMAIL, CONF_PASSWORD, PERCENTAGE import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -62,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(all_sensors, True) -class TankUtilitySensor(Entity): +class TankUtilitySensor(SensorEntity): """Representation of a Tank Utility sensor.""" def __init__(self, email, password, token, device): diff --git a/homeassistant/components/tankerkoenig/sensor.py b/homeassistant/components/tankerkoenig/sensor.py index a1cbed2ba11..5c1898e02a9 100644 --- a/homeassistant/components/tankerkoenig/sensor.py +++ b/homeassistant/components/tankerkoenig/sensor.py @@ -2,6 +2,7 @@ import logging +from homeassistant.components.sensor import SensorEntity from homeassistant.const import ( ATTR_ATTRIBUTION, ATTR_LATITUDE, @@ -79,7 +80,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(entities) -class FuelPriceSensor(CoordinatorEntity): +class FuelPriceSensor(CoordinatorEntity, SensorEntity): """Contains prices for fuel in a given station.""" def __init__(self, fuel_type, station, coordinator, name, show_on_map): diff --git a/homeassistant/components/tasmota/sensor.py b/homeassistant/components/tasmota/sensor.py index 9d7195a98e5..432fc2266f3 100644 --- a/homeassistant/components/tasmota/sensor.py +++ b/homeassistant/components/tasmota/sensor.py @@ -4,6 +4,7 @@ from __future__ import annotations from hatasmota import const as hc, status_sensor from homeassistant.components import sensor +from homeassistant.components.sensor import SensorEntity from homeassistant.const import ( CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_BILLION, @@ -38,7 +39,6 @@ from homeassistant.const import ( ) from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.entity import Entity from .const import DATA_REMOVE_DISCOVER_COMPONENT from .discovery import TASMOTA_DISCOVERY_ENTITY_NEW @@ -145,7 +145,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) -class TasmotaSensor(TasmotaAvailability, TasmotaDiscoveryUpdate, Entity): +class TasmotaSensor(TasmotaAvailability, TasmotaDiscoveryUpdate, SensorEntity): """Representation of a Tasmota sensor.""" def __init__(self, **kwds): diff --git a/homeassistant/components/tautulli/sensor.py b/homeassistant/components/tautulli/sensor.py index 2d2d005e95d..c50efb00ed7 100644 --- a/homeassistant/components/tautulli/sensor.py +++ b/homeassistant/components/tautulli/sensor.py @@ -4,7 +4,7 @@ from datetime import timedelta from pytautulli import Tautulli import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import ( CONF_API_KEY, CONF_HOST, @@ -18,7 +18,6 @@ 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 from homeassistant.util import Throttle CONF_MONITORED_USERS = "monitored_users" @@ -72,7 +71,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(sensor, True) -class TautulliSensor(Entity): +class TautulliSensor(SensorEntity): """Representation of a Tautulli sensor.""" def __init__(self, tautulli, name, monitored_conditions, users): diff --git a/homeassistant/components/tcp/sensor.py b/homeassistant/components/tcp/sensor.py index 9b7e1539fb4..54cf4d120f1 100644 --- a/homeassistant/components/tcp/sensor.py +++ b/homeassistant/components/tcp/sensor.py @@ -5,7 +5,7 @@ import socket 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_NAME, @@ -17,7 +17,6 @@ from homeassistant.const import ( ) from homeassistant.exceptions import TemplateError import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -48,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities([TcpSensor(hass, config)]) -class TcpSensor(Entity): +class TcpSensor(SensorEntity): """Implementation of a TCP socket based sensor.""" required = () diff --git a/homeassistant/components/ted5000/sensor.py b/homeassistant/components/ted5000/sensor.py index 3ea26286b18..86c9b9ace95 100644 --- a/homeassistant/components/ted5000/sensor.py +++ b/homeassistant/components/ted5000/sensor.py @@ -6,10 +6,9 @@ import requests import voluptuous as vol import xmltodict -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, POWER_WATT, VOLT from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -49,7 +48,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): return True -class Ted5000Sensor(Entity): +class Ted5000Sensor(SensorEntity): """Implementation of a Ted5000 sensor.""" def __init__(self, gateway, name, mtu, unit): diff --git a/homeassistant/components/tellduslive/sensor.py b/homeassistant/components/tellduslive/sensor.py index 1b06fd6ed97..a86b487afd2 100644 --- a/homeassistant/components/tellduslive/sensor.py +++ b/homeassistant/components/tellduslive/sensor.py @@ -1,5 +1,6 @@ """Support for Tellstick Net/Telstick Live sensors.""" from homeassistant.components import sensor, tellduslive +from homeassistant.components.sensor import SensorEntity from homeassistant.const import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, @@ -71,7 +72,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) -class TelldusLiveSensor(TelldusLiveEntity): +class TelldusLiveSensor(TelldusLiveEntity, SensorEntity): """Representation of a Telldus Live sensor.""" @property diff --git a/homeassistant/components/tellstick/sensor.py b/homeassistant/components/tellstick/sensor.py index 444cabd0180..f58c5916bfb 100644 --- a/homeassistant/components/tellstick/sensor.py +++ b/homeassistant/components/tellstick/sensor.py @@ -6,7 +6,7 @@ from tellcore import telldus import tellcore.constants as tellcore_constants import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import ( CONF_ID, CONF_NAME, @@ -15,7 +15,6 @@ from homeassistant.const import ( TEMP_CELSIUS, ) import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -126,7 +125,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(sensors) -class TellstickSensor(Entity): +class TellstickSensor(SensorEntity): """Representation of a Tellstick sensor.""" def __init__(self, name, tellcore_sensor, datatype, sensor_info): diff --git a/homeassistant/components/temper/sensor.py b/homeassistant/components/temper/sensor.py index c47aa1878fc..7edbd3ba812 100644 --- a/homeassistant/components/temper/sensor.py +++ b/homeassistant/components/temper/sensor.py @@ -4,14 +4,13 @@ import logging from temperusb.temper import TemperHandler 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_OFFSET, DEVICE_DEFAULT_NAME, TEMP_FAHRENHEIT, ) -from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -58,7 +57,7 @@ def reset_devices(): sensor.set_temper_device(device) -class TemperSensor(Entity): +class TemperSensor(SensorEntity): """Representation of a Temper temperature sensor.""" def __init__(self, temper_device, temp_unit, name, scaling): diff --git a/homeassistant/components/template/sensor.py b/homeassistant/components/template/sensor.py index 073924c51b6..b587fe3bd82 100644 --- a/homeassistant/components/template/sensor.py +++ b/homeassistant/components/template/sensor.py @@ -7,6 +7,7 @@ from homeassistant.components.sensor import ( DEVICE_CLASSES_SCHEMA, ENTITY_ID_FORMAT, PLATFORM_SCHEMA, + SensorEntity, ) from homeassistant.const import ( ATTR_ENTITY_ID, @@ -23,7 +24,7 @@ from homeassistant.const import ( from homeassistant.core import callback from homeassistant.exceptions import TemplateError 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.reload import async_setup_reload_service from .const import CONF_AVAILABILITY_TEMPLATE, DOMAIN, PLATFORMS @@ -99,7 +100,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(await _async_create_entities(hass, config)) -class SensorTemplate(TemplateEntity, Entity): +class SensorTemplate(TemplateEntity, SensorEntity): """Representation of a Template Sensor.""" def __init__( diff --git a/homeassistant/components/tesla/sensor.py b/homeassistant/components/tesla/sensor.py index 40bf68bfa15..40c7aa8548d 100644 --- a/homeassistant/components/tesla/sensor.py +++ b/homeassistant/components/tesla/sensor.py @@ -1,14 +1,13 @@ """Support for the Tesla sensors.""" from __future__ import annotations -from homeassistant.components.sensor import DEVICE_CLASSES +from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity from homeassistant.const import ( LENGTH_KILOMETERS, LENGTH_MILES, TEMP_CELSIUS, TEMP_FAHRENHEIT, ) -from homeassistant.helpers.entity import Entity from homeassistant.util.distance import convert from . import DOMAIN as TESLA_DOMAIN, TeslaDevice @@ -27,7 +26,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(entities, True) -class TeslaSensor(TeslaDevice, Entity): +class TeslaSensor(TeslaDevice, SensorEntity): """Representation of Tesla sensors.""" def __init__(self, tesla_device, coordinator, sensor_type=None): diff --git a/homeassistant/components/thermoworks_smoke/sensor.py b/homeassistant/components/thermoworks_smoke/sensor.py index d768f009364..86427349f31 100644 --- a/homeassistant/components/thermoworks_smoke/sensor.py +++ b/homeassistant/components/thermoworks_smoke/sensor.py @@ -11,7 +11,7 @@ from stringcase import camelcase, snakecase import thermoworks_smoke import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import ( ATTR_BATTERY_LEVEL, CONF_EMAIL, @@ -21,7 +21,6 @@ from homeassistant.const import ( TEMP_FAHRENHEIT, ) import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -91,7 +90,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): _LOGGER.error(msg) -class ThermoworksSmokeSensor(Entity): +class ThermoworksSmokeSensor(SensorEntity): """Implementation of a thermoworks smoke sensor.""" def __init__(self, sensor_type, serial, mgr): diff --git a/homeassistant/components/thethingsnetwork/sensor.py b/homeassistant/components/thethingsnetwork/sensor.py index d758a20f384..2e139eae63d 100644 --- a/homeassistant/components/thethingsnetwork/sensor.py +++ b/homeassistant/components/thethingsnetwork/sensor.py @@ -7,7 +7,7 @@ from aiohttp.hdrs import ACCEPT, AUTHORIZATION 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_DEVICE_ID, ATTR_TIME, @@ -18,7 +18,6 @@ from homeassistant.const import ( ) from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from . import DATA_TTN, TTN_ACCESS_KEY, TTN_APP_ID, TTN_DATA_STORAGE_URL @@ -59,7 +58,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(devices, True) -class TtnDataSensor(Entity): +class TtnDataSensor(SensorEntity): """Representation of a The Things Network Data Storage sensor.""" def __init__(self, ttn_data_storage, device_id, value, unit_of_measurement): diff --git a/homeassistant/components/thinkingcleaner/sensor.py b/homeassistant/components/thinkingcleaner/sensor.py index 966930f1eb1..56cf272f7d1 100644 --- a/homeassistant/components/thinkingcleaner/sensor.py +++ b/homeassistant/components/thinkingcleaner/sensor.py @@ -5,10 +5,9 @@ from pythinkingcleaner import Discovery, ThinkingCleaner import voluptuous as vol from homeassistant import util -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_HOST, PERCENTAGE import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10) MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(milliseconds=100) @@ -73,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(dev) -class ThinkingCleanerSensor(Entity): +class ThinkingCleanerSensor(SensorEntity): """Representation of a ThinkingCleaner Sensor.""" def __init__(self, tc_object, sensor_type, update_devices): diff --git a/homeassistant/components/tibber/sensor.py b/homeassistant/components/tibber/sensor.py index 01e050fdd24..5ab85013a25 100644 --- a/homeassistant/components/tibber/sensor.py +++ b/homeassistant/components/tibber/sensor.py @@ -6,10 +6,9 @@ from random import randrange import aiohttp -from homeassistant.components.sensor import DEVICE_CLASS_POWER +from homeassistant.components.sensor import DEVICE_CLASS_POWER, SensorEntity from homeassistant.const import POWER_WATT from homeassistant.exceptions import PlatformNotReady -from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle, dt as dt_util from .const import DOMAIN as TIBBER_DOMAIN, MANUFACTURER @@ -45,7 +44,7 @@ async def async_setup_entry(hass, entry, async_add_entities): async_add_entities(dev, True) -class TibberSensor(Entity): +class TibberSensor(SensorEntity): """Representation of a generic Tibber sensor.""" def __init__(self, tibber_home): diff --git a/homeassistant/components/time_date/sensor.py b/homeassistant/components/time_date/sensor.py index 4615e9e046c..08195e6dd3d 100644 --- a/homeassistant/components/time_date/sensor.py +++ b/homeassistant/components/time_date/sensor.py @@ -4,11 +4,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_DISPLAY_OPTIONS from homeassistant.core import callback import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.helpers.event import async_track_point_in_utc_time import homeassistant.util.dt as dt_util @@ -47,7 +46,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= ) -class TimeDateSensor(Entity): +class TimeDateSensor(SensorEntity): """Implementation of a Time and Date sensor.""" def __init__(self, hass, option_type): diff --git a/homeassistant/components/tmb/sensor.py b/homeassistant/components/tmb/sensor.py index c3f813d796a..88471a86c27 100644 --- a/homeassistant/components/tmb/sensor.py +++ b/homeassistant/components/tmb/sensor.py @@ -6,10 +6,9 @@ from requests import HTTPError from tmb import IBus 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, TIME_MINUTES import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -63,7 +62,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(sensors, True) -class TMBSensor(Entity): +class TMBSensor(SensorEntity): """Implementation of a TMB line/stop Sensor.""" def __init__(self, ibus_client, stop, line, name): diff --git a/homeassistant/components/tof/sensor.py b/homeassistant/components/tof/sensor.py index 17b2d1010bf..45713dd8f77 100644 --- a/homeassistant/components/tof/sensor.py +++ b/homeassistant/components/tof/sensor.py @@ -7,10 +7,9 @@ from VL53L1X2 import VL53L1X # pylint: disable=import-error import voluptuous as vol from homeassistant.components import rpi_gpio -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_NAME, LENGTH_MILLIMETERS import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity CONF_I2C_ADDRESS = "i2c_address" CONF_I2C_BUS = "i2c_bus" @@ -65,7 +64,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(dev, True) -class VL53L1XSensor(Entity): +class VL53L1XSensor(SensorEntity): """Implementation of VL53L1X sensor.""" def __init__(self, vl53l1x_sensor, name, unit, i2c_address): diff --git a/homeassistant/components/toon/sensor.py b/homeassistant/components/toon/sensor.py index 583683e53ae..36f5dedde3d 100644 --- a/homeassistant/components/toon/sensor.py +++ b/homeassistant/components/toon/sensor.py @@ -1,6 +1,7 @@ """Support for Toon sensors.""" from __future__ import annotations +from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant @@ -109,7 +110,7 @@ async def async_setup_entry( async_add_entities(sensors, True) -class ToonSensor(ToonEntity): +class ToonSensor(ToonEntity, SensorEntity): """Defines a Toon sensor.""" def __init__(self, coordinator: ToonDataUpdateCoordinator, *, key: str) -> None: diff --git a/homeassistant/components/torque/sensor.py b/homeassistant/components/torque/sensor.py index 4b52a565d87..156259adccb 100644 --- a/homeassistant/components/torque/sensor.py +++ b/homeassistant/components/torque/sensor.py @@ -4,11 +4,10 @@ import re import voluptuous as vol from homeassistant.components.http import HomeAssistantView -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_EMAIL, CONF_NAME, DEGREE from homeassistant.core import callback import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity API_PATH = "/api/torque" @@ -106,7 +105,7 @@ class TorqueReceiveDataView(HomeAssistantView): return "OK!" -class TorqueSensor(Entity): +class TorqueSensor(SensorEntity): """Representation of a Torque sensor.""" def __init__(self, name, unit): diff --git a/homeassistant/components/tradfri/sensor.py b/homeassistant/components/tradfri/sensor.py index c2bf640e2aa..455ca69147d 100644 --- a/homeassistant/components/tradfri/sensor.py +++ b/homeassistant/components/tradfri/sensor.py @@ -1,5 +1,6 @@ """Support for IKEA Tradfri sensors.""" +from homeassistant.components.sensor import SensorEntity from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE from .base_class import TradfriBaseDevice @@ -25,7 +26,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(TradfriSensor(sensor, api, gateway_id) for sensor in sensors) -class TradfriSensor(TradfriBaseDevice): +class TradfriSensor(TradfriBaseDevice, SensorEntity): """The platform class required by Home Assistant.""" def __init__(self, device, api, gateway_id): diff --git a/homeassistant/components/trafikverket_train/sensor.py b/homeassistant/components/trafikverket_train/sensor.py index 45899422564..37e3bd52cdc 100644 --- a/homeassistant/components/trafikverket_train/sensor.py +++ b/homeassistant/components/trafikverket_train/sensor.py @@ -6,7 +6,7 @@ import logging from pytrafikverket import TrafikverketTrain import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import ( CONF_API_KEY, CONF_NAME, @@ -16,7 +16,6 @@ from homeassistant.const import ( ) 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__) @@ -116,7 +115,7 @@ def next_departuredate(departure): return next_weekday(today_date, WEEKDAYS.index(departure[0])) -class TrainSensor(Entity): +class TrainSensor(SensorEntity): """Contains data about a train depature.""" def __init__(self, train_api, name, from_station, to_station, weekday, time): diff --git a/homeassistant/components/trafikverket_weatherstation/sensor.py b/homeassistant/components/trafikverket_weatherstation/sensor.py index f2e2521a90b..1ae090ea231 100644 --- a/homeassistant/components/trafikverket_weatherstation/sensor.py +++ b/homeassistant/components/trafikverket_weatherstation/sensor.py @@ -8,7 +8,7 @@ import aiohttp from pytrafikverket.trafikverket_weather import TrafikverketWeather 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, @@ -24,7 +24,6 @@ from homeassistant.const import ( ) from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -145,7 +144,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(dev, True) -class TrafikverketWeatherStation(Entity): +class TrafikverketWeatherStation(SensorEntity): """Representation of a Trafikverket sensor.""" def __init__(self, weather_api, name, sensor_type, sensor_station): diff --git a/homeassistant/components/transmission/sensor.py b/homeassistant/components/transmission/sensor.py index cd9e57c50d7..a82adac6160 100644 --- a/homeassistant/components/transmission/sensor.py +++ b/homeassistant/components/transmission/sensor.py @@ -3,10 +3,10 @@ from __future__ import annotations from transmissionrpc.torrent import Torrent +from homeassistant.components.sensor import SensorEntity from homeassistant.const import CONF_NAME, DATA_RATE_MEGABYTES_PER_SECOND, STATE_IDLE from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.entity import Entity from . import TransmissionClient from .const import ( @@ -38,7 +38,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(dev, True) -class TransmissionSensor(Entity): +class TransmissionSensor(SensorEntity): """A base class for all Transmission sensors.""" def __init__(self, tm_client, client_name, sensor_name, sub_type=None): diff --git a/homeassistant/components/transport_nsw/sensor.py b/homeassistant/components/transport_nsw/sensor.py index f6d4e40e4e8..be76999ec3f 100644 --- a/homeassistant/components/transport_nsw/sensor.py +++ b/homeassistant/components/transport_nsw/sensor.py @@ -4,7 +4,7 @@ from datetime import timedelta from TransportNSW import TransportNSW 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, ATTR_MODE, @@ -13,7 +13,6 @@ from homeassistant.const import ( TIME_MINUTES, ) import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity ATTR_STOP_ID = "stop_id" ATTR_ROUTE = "route" @@ -65,7 +64,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities([TransportNSWSensor(data, stop_id, name)], True) -class TransportNSWSensor(Entity): +class TransportNSWSensor(SensorEntity): """Implementation of an Transport NSW sensor.""" def __init__(self, data, stop_id, name): diff --git a/homeassistant/components/travisci/sensor.py b/homeassistant/components/travisci/sensor.py index 6464667bffe..94a6ba3a48f 100644 --- a/homeassistant/components/travisci/sensor.py +++ b/homeassistant/components/travisci/sensor.py @@ -6,7 +6,7 @@ from travispy import TravisPy from travispy.errors import TravisError 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, @@ -15,7 +15,6 @@ from homeassistant.const import ( TIME_SECONDS, ) import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -94,7 +93,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): return True -class TravisCISensor(Entity): +class TravisCISensor(SensorEntity): """Representation of a Travis CI sensor.""" def __init__(self, data, repo_name, user, branch, sensor_type): diff --git a/homeassistant/components/twentemilieu/sensor.py b/homeassistant/components/twentemilieu/sensor.py index 34da746cf06..ad552a4b341 100644 --- a/homeassistant/components/twentemilieu/sensor.py +++ b/homeassistant/components/twentemilieu/sensor.py @@ -12,6 +12,7 @@ from twentemilieu import ( TwenteMilieuConnectionError, ) +from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_ID from homeassistant.core import HomeAssistant, callback @@ -71,7 +72,7 @@ async def async_setup_entry( async_add_entities(sensors, True) -class TwenteMilieuSensor(Entity): +class TwenteMilieuSensor(SensorEntity): """Defines a Twente Milieu sensor.""" def __init__( diff --git a/homeassistant/components/twitch/sensor.py b/homeassistant/components/twitch/sensor.py index 0e5abb58747..cfabcf1045f 100644 --- a/homeassistant/components/twitch/sensor.py +++ b/homeassistant/components/twitch/sensor.py @@ -5,10 +5,9 @@ from requests.exceptions import HTTPError from twitch import TwitchClient import voluptuous as vol -from homeassistant.components.sensor import PLATFORM_SCHEMA +from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity from homeassistant.const import CONF_CLIENT_ID, CONF_TOKEN import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -56,7 +55,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities([TwitchSensor(channel_id, client) for channel_id in channel_ids], True) -class TwitchSensor(Entity): +class TwitchSensor(SensorEntity): """Representation of an Twitch channel.""" def __init__(self, channel, client): diff --git a/homeassistant/components/uk_transport/sensor.py b/homeassistant/components/uk_transport/sensor.py index f5e4b4373c0..f5cb21edcf7 100644 --- a/homeassistant/components/uk_transport/sensor.py +++ b/homeassistant/components/uk_transport/sensor.py @@ -6,10 +6,9 @@ import re 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_MODE, HTTP_OK, TIME_MINUTES import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle import homeassistant.util.dt as dt_util @@ -83,7 +82,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(sensors, True) -class UkTransportSensor(Entity): +class UkTransportSensor(SensorEntity): """ Sensor that reads the UK transport web API. diff --git a/homeassistant/components/unifi/sensor.py b/homeassistant/components/unifi/sensor.py index 77e8f5afbe4..755d95a061b 100644 --- a/homeassistant/components/unifi/sensor.py +++ b/homeassistant/components/unifi/sensor.py @@ -6,7 +6,7 @@ Support for uptime sensors of network clients. from datetime import datetime, timedelta -from homeassistant.components.sensor import DEVICE_CLASS_TIMESTAMP, DOMAIN +from homeassistant.components.sensor import DEVICE_CLASS_TIMESTAMP, DOMAIN, SensorEntity from homeassistant.const import DATA_MEGABYTES from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -79,7 +79,7 @@ def add_uptime_entities(controller, async_add_entities, clients): async_add_entities(sensors) -class UniFiBandwidthSensor(UniFiClient): +class UniFiBandwidthSensor(UniFiClient, SensorEntity): """UniFi bandwidth sensor base class.""" DOMAIN = DOMAIN @@ -126,7 +126,7 @@ class UniFiTxBandwidthSensor(UniFiBandwidthSensor): return self.client.tx_bytes / 1000000 -class UniFiUpTimeSensor(UniFiClient): +class UniFiUpTimeSensor(UniFiClient, SensorEntity): """UniFi uptime sensor.""" DOMAIN = DOMAIN diff --git a/homeassistant/components/upnp/sensor.py b/homeassistant/components/upnp/sensor.py index 76bb1d023b7..0e95b6106a3 100644 --- a/homeassistant/components/upnp/sensor.py +++ b/homeassistant/components/upnp/sensor.py @@ -4,6 +4,7 @@ from __future__ import annotations from datetime import timedelta from typing import Any, Mapping +from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import DATA_BYTES, DATA_RATE_KIBIBYTES_PER_SECOND from homeassistant.helpers import device_registry as dr @@ -117,7 +118,7 @@ async def async_setup_entry( async_add_entities(sensors, True) -class UpnpSensor(CoordinatorEntity): +class UpnpSensor(CoordinatorEntity, SensorEntity): """Base class for UPnP/IGD sensors.""" def __init__( diff --git a/homeassistant/components/uptime/sensor.py b/homeassistant/components/uptime/sensor.py index 8363d2da2cb..7e79c2fbb5e 100644 --- a/homeassistant/components/uptime/sensor.py +++ b/homeassistant/components/uptime/sensor.py @@ -2,10 +2,13 @@ import voluptuous as vol -from homeassistant.components.sensor import DEVICE_CLASS_TIMESTAMP, PLATFORM_SCHEMA +from homeassistant.components.sensor import ( + DEVICE_CLASS_TIMESTAMP, + PLATFORM_SCHEMA, + SensorEntity, +) from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity import homeassistant.util.dt as dt_util DEFAULT_NAME = "Uptime" @@ -30,7 +33,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities([UptimeSensor(name)], True) -class UptimeSensor(Entity): +class UptimeSensor(SensorEntity): """Representation of an uptime sensor.""" def __init__(self, name): diff --git a/homeassistant/components/uscis/sensor.py b/homeassistant/components/uscis/sensor.py index 5f26a0ff82e..bd261aba4fb 100644 --- a/homeassistant/components/uscis/sensor.py +++ b/homeassistant/components/uscis/sensor.py @@ -5,10 +5,9 @@ import logging import uscisstatus 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 from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -33,7 +32,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): _LOGGER.error("Setup USCIS Sensor Fail check if your Case ID is Valid") -class UscisSensor(Entity): +class UscisSensor(SensorEntity): """USCIS Sensor will check case status on daily basis.""" MIN_TIME_BETWEEN_UPDATES = timedelta(hours=24) diff --git a/homeassistant/components/utility_meter/sensor.py b/homeassistant/components/utility_meter/sensor.py index 09f788806f6..d28819a38cb 100644 --- a/homeassistant/components/utility_meter/sensor.py +++ b/homeassistant/components/utility_meter/sensor.py @@ -5,6 +5,7 @@ import logging import voluptuous as vol +from homeassistant.components.sensor import SensorEntity from homeassistant.const import ( ATTR_UNIT_OF_MEASUREMENT, CONF_NAME, @@ -102,7 +103,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= ) -class UtilityMeterSensor(RestoreEntity): +class UtilityMeterSensor(RestoreEntity, SensorEntity): """Representation of an utility meter sensor.""" def __init__( diff --git a/homeassistant/components/vallox/sensor.py b/homeassistant/components/vallox/sensor.py index 6f6755a05e7..b4269ac4451 100644 --- a/homeassistant/components/vallox/sensor.py +++ b/homeassistant/components/vallox/sensor.py @@ -3,6 +3,7 @@ from datetime import datetime, timedelta import logging +from homeassistant.components.sensor import SensorEntity from homeassistant.const import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, @@ -12,7 +13,6 @@ from homeassistant.const import ( ) from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.entity import Entity from . import DOMAIN, METRIC_KEY_MODE, SIGNAL_VALLOX_STATE_UPDATE @@ -96,7 +96,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(sensors, update_before_add=False) -class ValloxSensor(Entity): +class ValloxSensor(SensorEntity): """Representation of a Vallox sensor.""" def __init__( diff --git a/homeassistant/components/vasttrafik/sensor.py b/homeassistant/components/vasttrafik/sensor.py index d1a461d94fa..31c5da097ff 100644 --- a/homeassistant/components/vasttrafik/sensor.py +++ b/homeassistant/components/vasttrafik/sensor.py @@ -5,10 +5,9 @@ import logging import vasttrafik 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_DELAY, CONF_NAME import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle from homeassistant.util.dt import now @@ -71,7 +70,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(sensors, True) -class VasttrafikDepartureSensor(Entity): +class VasttrafikDepartureSensor(SensorEntity): """Implementation of a Vasttrafik Departure Sensor.""" def __init__(self, planner, name, departure, heading, lines, delay): diff --git a/homeassistant/components/velbus/sensor.py b/homeassistant/components/velbus/sensor.py index 095108b4401..9d9b68dd4eb 100644 --- a/homeassistant/components/velbus/sensor.py +++ b/homeassistant/components/velbus/sensor.py @@ -1,4 +1,5 @@ """Support for Velbus sensors.""" +from homeassistant.components.sensor import SensorEntity from homeassistant.const import DEVICE_CLASS_POWER, ENERGY_KILO_WATT_HOUR from . import VelbusEntity @@ -18,7 +19,7 @@ async def async_setup_entry(hass, entry, async_add_entities): async_add_entities(entities) -class VelbusSensor(VelbusEntity): +class VelbusSensor(VelbusEntity, SensorEntity): """Representation of a sensor.""" def __init__(self, module, channel, counter=False): diff --git a/homeassistant/components/vera/sensor.py b/homeassistant/components/vera/sensor.py index d52d49c2546..516801b57c6 100644 --- a/homeassistant/components/vera/sensor.py +++ b/homeassistant/components/vera/sensor.py @@ -6,7 +6,11 @@ from typing import Callable, cast import pyvera as veraApi -from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN, ENTITY_ID_FORMAT +from homeassistant.components.sensor import ( + DOMAIN as PLATFORM_DOMAIN, + ENTITY_ID_FORMAT, + SensorEntity, +) from homeassistant.config_entries import ConfigEntry from homeassistant.const import LIGHT_LUX, PERCENTAGE, TEMP_CELSIUS, TEMP_FAHRENHEIT from homeassistant.core import HomeAssistant @@ -35,7 +39,7 @@ async def async_setup_entry( ) -class VeraSensor(VeraDevice[veraApi.VeraSensor], Entity): +class VeraSensor(VeraDevice[veraApi.VeraSensor], SensorEntity): """Representation of a Vera Sensor.""" def __init__( diff --git a/homeassistant/components/verisure/sensor.py b/homeassistant/components/verisure/sensor.py index f7f2212149b..93e1793da8d 100644 --- a/homeassistant/components/verisure/sensor.py +++ b/homeassistant/components/verisure/sensor.py @@ -6,6 +6,7 @@ from typing import Any, Callable, Iterable from homeassistant.components.sensor import ( DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, + SensorEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import PERCENTAGE, TEMP_CELSIUS @@ -45,7 +46,7 @@ async def async_setup_entry( async_add_entities(sensors) -class VerisureThermometer(CoordinatorEntity, Entity): +class VerisureThermometer(CoordinatorEntity, SensorEntity): """Representation of a Verisure thermometer.""" coordinator: VerisureDataUpdateCoordinator @@ -109,7 +110,7 @@ class VerisureThermometer(CoordinatorEntity, Entity): return TEMP_CELSIUS -class VerisureHygrometer(CoordinatorEntity, Entity): +class VerisureHygrometer(CoordinatorEntity, SensorEntity): """Representation of a Verisure hygrometer.""" coordinator: VerisureDataUpdateCoordinator @@ -173,7 +174,7 @@ class VerisureHygrometer(CoordinatorEntity, Entity): return PERCENTAGE -class VerisureMouseDetection(CoordinatorEntity, Entity): +class VerisureMouseDetection(CoordinatorEntity, SensorEntity): """Representation of a Verisure mouse detector.""" coordinator: VerisureDataUpdateCoordinator diff --git a/homeassistant/components/versasense/sensor.py b/homeassistant/components/versasense/sensor.py index e598093cd37..d29032af399 100644 --- a/homeassistant/components/versasense/sensor.py +++ b/homeassistant/components/versasense/sensor.py @@ -1,7 +1,7 @@ """Support for VersaSense sensor peripheral.""" import logging -from homeassistant.helpers.entity import Entity +from homeassistant.components.sensor import SensorEntity from . import DOMAIN from .const import ( @@ -40,7 +40,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(sensor_list) -class VSensor(Entity): +class VSensor(SensorEntity): """Representation of a Sensor.""" def __init__(self, peripheral, parent_name, unit, measurement, consumer): diff --git a/homeassistant/components/version/sensor.py b/homeassistant/components/version/sensor.py index 645cde63459..3e5d235b5d7 100644 --- a/homeassistant/components/version/sensor.py +++ b/homeassistant/components/version/sensor.py @@ -10,11 +10,10 @@ from pyhaversion import ( ) 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_SOURCE from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from homeassistant.util import Throttle ALL_IMAGES = [ @@ -94,7 +93,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities([VersionSensor(haversion, name)], True) -class VersionSensor(Entity): +class VersionSensor(SensorEntity): """Representation of a Home Assistant version sensor.""" def __init__(self, haversion, name): diff --git a/homeassistant/components/viaggiatreno/sensor.py b/homeassistant/components/viaggiatreno/sensor.py index e886b9d9728..10821859f9a 100644 --- a/homeassistant/components/viaggiatreno/sensor.py +++ b/homeassistant/components/viaggiatreno/sensor.py @@ -6,10 +6,9 @@ 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, HTTP_OK, TIME_MINUTES import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity _LOGGER = logging.getLogger(__name__) @@ -82,7 +81,7 @@ async def async_http_request(hass, uri): _LOGGER.error("Received non-JSON data from ViaggiaTreno API endpoint") -class ViaggiaTrenoSensor(Entity): +class ViaggiaTrenoSensor(SensorEntity): """Implementation of a ViaggiaTreno sensor.""" def __init__(self, train_id, station_id, name): diff --git a/homeassistant/components/vicare/sensor.py b/homeassistant/components/vicare/sensor.py index a14e00923c2..79e7391ca70 100644 --- a/homeassistant/components/vicare/sensor.py +++ b/homeassistant/components/vicare/sensor.py @@ -3,6 +3,7 @@ import logging import requests +from homeassistant.components.sensor import SensorEntity from homeassistant.const import ( CONF_DEVICE_CLASS, CONF_ICON, @@ -14,7 +15,6 @@ from homeassistant.const import ( TEMP_CELSIUS, TIME_HOURS, ) -from homeassistant.helpers.entity import Entity from . import ( DOMAIN as VICARE_DOMAIN, @@ -269,7 +269,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): ) -class ViCareSensor(Entity): +class ViCareSensor(SensorEntity): """Representation of a ViCare sensor.""" def __init__(self, name, api, sensor_type): diff --git a/homeassistant/components/vilfo/sensor.py b/homeassistant/components/vilfo/sensor.py index 80a14354913..90527c60458 100644 --- a/homeassistant/components/vilfo/sensor.py +++ b/homeassistant/components/vilfo/sensor.py @@ -1,6 +1,6 @@ """Support for Vilfo Router sensors.""" +from homeassistant.components.sensor import SensorEntity from homeassistant.const import ATTR_ICON -from homeassistant.helpers.entity import Entity from .const import ( ATTR_API_DATA_FIELD, @@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(sensors, True) -class VilfoRouterSensor(Entity): +class VilfoRouterSensor(SensorEntity): """Define a Vilfo Router Sensor.""" def __init__(self, sensor_type, api): diff --git a/homeassistant/components/volkszaehler/sensor.py b/homeassistant/components/volkszaehler/sensor.py index a418780c165..61fcf1d2969 100644 --- a/homeassistant/components/volkszaehler/sensor.py +++ b/homeassistant/components/volkszaehler/sensor.py @@ -6,7 +6,7 @@ from volkszaehler import Volkszaehler from volkszaehler.exceptions import VolkszaehlerApiConnectionError 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_MONITORED_CONDITIONS, @@ -18,7 +18,6 @@ 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 from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -77,7 +76,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(dev, True) -class VolkszaehlerSensor(Entity): +class VolkszaehlerSensor(SensorEntity): """Implementation of a Volkszaehler sensor.""" def __init__(self, vz_api, name, sensor_type): diff --git a/homeassistant/components/volvooncall/sensor.py b/homeassistant/components/volvooncall/sensor.py index 0915408860d..ad6571576b4 100644 --- a/homeassistant/components/volvooncall/sensor.py +++ b/homeassistant/components/volvooncall/sensor.py @@ -1,4 +1,6 @@ """Support for Volvo On Call sensors.""" +from homeassistant.components.sensor import SensorEntity + from . import DATA_KEY, VolvoEntity @@ -9,7 +11,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities([VolvoSensor(hass.data[DATA_KEY], *discovery_info)]) -class VolvoSensor(VolvoEntity): +class VolvoSensor(VolvoEntity, SensorEntity): """Representation of a Volvo sensor.""" @property diff --git a/homeassistant/components/vultr/sensor.py b/homeassistant/components/vultr/sensor.py index 0bcdcf9d4c1..5e6815944d7 100644 --- a/homeassistant/components/vultr/sensor.py +++ b/homeassistant/components/vultr/sensor.py @@ -3,10 +3,9 @@ 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_MONITORED_CONDITIONS, CONF_NAME, DATA_GIGABYTES import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity import Entity from . import ( ATTR_CURRENT_BANDWIDTH_USED, @@ -58,7 +57,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(sensors, True) -class VultrSensor(Entity): +class VultrSensor(SensorEntity): """Representation of a Vultr subscription sensor.""" def __init__(self, vultr, subscription, condition, name):