Migrate integrations t-v to extend SensorEntity (#48216)
This commit is contained in:
parent
c900e3030b
commit
783b453bbe
49 changed files with 112 additions and 120 deletions
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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 = ()
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue