Migrate integrations d-e to extend SensorEntity (#48211)
This commit is contained in:
parent
e0cd7072d6
commit
23b562386f
45 changed files with 100 additions and 115 deletions
|
@ -1,4 +1,5 @@
|
||||||
"""Support for Daikin AC sensors."""
|
"""Support for Daikin AC sensors."""
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
|
@ -6,7 +7,6 @@ from homeassistant.const import (
|
||||||
CONF_TYPE,
|
CONF_TYPE,
|
||||||
CONF_UNIT_OF_MEASUREMENT,
|
CONF_UNIT_OF_MEASUREMENT,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
from . import DOMAIN as DAIKIN_DOMAIN, DaikinApi
|
from . import DOMAIN as DAIKIN_DOMAIN, DaikinApi
|
||||||
from .const import (
|
from .const import (
|
||||||
|
@ -49,7 +49,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
async_add_entities([DaikinSensor.factory(daikin_api, sensor) for sensor in sensors])
|
async_add_entities([DaikinSensor.factory(daikin_api, sensor) for sensor in sensors])
|
||||||
|
|
||||||
|
|
||||||
class DaikinSensor(Entity):
|
class DaikinSensor(SensorEntity):
|
||||||
"""Representation of a Sensor."""
|
"""Representation of a Sensor."""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -3,6 +3,7 @@ import logging
|
||||||
|
|
||||||
from pydanfossair.commands import ReadCommand
|
from pydanfossair.commands import ReadCommand
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
DEVICE_CLASS_BATTERY,
|
DEVICE_CLASS_BATTERY,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
|
@ -10,7 +11,6 @@ from homeassistant.const import (
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
from . import DOMAIN as DANFOSS_AIR_DOMAIN
|
from . import DOMAIN as DANFOSS_AIR_DOMAIN
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(dev, True)
|
add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class DanfossAir(Entity):
|
class DanfossAir(SensorEntity):
|
||||||
"""Representation of a Sensor."""
|
"""Representation of a Sensor."""
|
||||||
|
|
||||||
def __init__(self, data, name, sensor_unit, sensor_type, device_class):
|
def __init__(self, data, name, sensor_unit, sensor_type, device_class):
|
||||||
|
|
|
@ -6,7 +6,11 @@ import forecastio
|
||||||
from requests.exceptions import ConnectionError as ConnectError, HTTPError, Timeout
|
from requests.exceptions import ConnectionError as ConnectError, HTTPError, Timeout
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE, PLATFORM_SCHEMA
|
from homeassistant.components.sensor import (
|
||||||
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
|
PLATFORM_SCHEMA,
|
||||||
|
SensorEntity,
|
||||||
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
|
@ -29,7 +33,6 @@ from homeassistant.const import (
|
||||||
UV_INDEX,
|
UV_INDEX,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -544,7 +547,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(sensors, True)
|
add_entities(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class DarkSkySensor(Entity):
|
class DarkSkySensor(SensorEntity):
|
||||||
"""Implementation of a Dark Sky sensor."""
|
"""Implementation of a Dark Sky sensor."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -708,7 +711,7 @@ class DarkSkySensor(Entity):
|
||||||
return state
|
return state
|
||||||
|
|
||||||
|
|
||||||
class DarkSkyAlertSensor(Entity):
|
class DarkSkyAlertSensor(SensorEntity):
|
||||||
"""Implementation of a Dark Sky sensor."""
|
"""Implementation of a Dark Sky sensor."""
|
||||||
|
|
||||||
def __init__(self, forecast_data, sensor_type, name):
|
def __init__(self, forecast_data, sensor_type, name):
|
||||||
|
|
|
@ -12,7 +12,7 @@ from pydeconz.sensor import (
|
||||||
Thermostat,
|
Thermostat,
|
||||||
)
|
)
|
||||||
|
|
||||||
from homeassistant.components.sensor import DOMAIN
|
from homeassistant.components.sensor import DOMAIN, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
ATTR_VOLTAGE,
|
ATTR_VOLTAGE,
|
||||||
|
@ -122,7 +122,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DeconzSensor(DeconzDevice):
|
class DeconzSensor(SensorEntity, DeconzDevice):
|
||||||
"""Representation of a deCONZ sensor."""
|
"""Representation of a deCONZ sensor."""
|
||||||
|
|
||||||
TYPE = DOMAIN
|
TYPE = DOMAIN
|
||||||
|
@ -186,7 +186,7 @@ class DeconzSensor(DeconzDevice):
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
|
|
||||||
class DeconzBattery(DeconzDevice):
|
class DeconzBattery(SensorEntity, DeconzDevice):
|
||||||
"""Battery class for when a device is only represented as an event."""
|
"""Battery class for when a device is only represented as an event."""
|
||||||
|
|
||||||
TYPE = DOMAIN
|
TYPE = DOMAIN
|
||||||
|
|
|
@ -5,11 +5,10 @@ from pydelijn.api import Passages
|
||||||
from pydelijn.common import HttpException
|
from pydelijn.common import HttpException
|
||||||
import voluptuous as vol
|
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, DEVICE_CLASS_TIMESTAMP
|
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, DEVICE_CLASS_TIMESTAMP
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -58,7 +57,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities(sensors, True)
|
async_add_entities(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class DeLijnPublicTransportSensor(Entity):
|
class DeLijnPublicTransportSensor(SensorEntity):
|
||||||
"""Representation of a Ruter sensor."""
|
"""Representation of a Ruter sensor."""
|
||||||
|
|
||||||
def __init__(self, line):
|
def __init__(self, line):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
from deluge_client import DelugeRPCClient, FailedToReconnectException
|
from deluge_client import DelugeRPCClient, FailedToReconnectException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_MONITORED_VARIABLES,
|
CONF_MONITORED_VARIABLES,
|
||||||
|
@ -17,7 +17,6 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
_THROTTLED_REFRESH = None
|
_THROTTLED_REFRESH = None
|
||||||
|
@ -68,7 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(dev)
|
add_entities(dev)
|
||||||
|
|
||||||
|
|
||||||
class DelugeSensor(Entity):
|
class DelugeSensor(SensorEntity):
|
||||||
"""Representation of a Deluge sensor."""
|
"""Representation of a Deluge sensor."""
|
||||||
|
|
||||||
def __init__(self, sensor_type, deluge_client, client_name):
|
def __init__(self, sensor_type, deluge_client, client_name):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
"""Demo platform that has a couple of fake sensors."""
|
"""Demo platform that has a couple of fake sensors."""
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_BATTERY_LEVEL,
|
ATTR_BATTERY_LEVEL,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
|
@ -9,7 +10,6 @@ from homeassistant.const import (
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
from . import DOMAIN
|
from . import DOMAIN
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
await async_setup_platform(hass, {}, async_add_entities)
|
await async_setup_platform(hass, {}, async_add_entities)
|
||||||
|
|
||||||
|
|
||||||
class DemoSensor(Entity):
|
class DemoSensor(SensorEntity):
|
||||||
"""Representation of a Demo sensor."""
|
"""Representation of a Demo sensor."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -86,7 +86,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities([derivative])
|
async_add_entities([derivative])
|
||||||
|
|
||||||
|
|
||||||
class DerivativeSensor(RestoreEntity):
|
class DerivativeSensor(SensorEntity, RestoreEntity):
|
||||||
"""Representation of an derivative sensor."""
|
"""Representation of an derivative sensor."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -4,10 +4,9 @@ from datetime import timedelta
|
||||||
import schiene
|
import schiene
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import CONF_OFFSET
|
from homeassistant.const import CONF_OFFSET
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
CONF_DESTINATION = "to"
|
CONF_DESTINATION = "to"
|
||||||
|
@ -40,7 +39,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([DeutscheBahnSensor(start, destination, offset, only_direct)], True)
|
add_entities([DeutscheBahnSensor(start, destination, offset, only_direct)], True)
|
||||||
|
|
||||||
|
|
||||||
class DeutscheBahnSensor(Entity):
|
class DeutscheBahnSensor(SensorEntity):
|
||||||
"""Implementation of a Deutsche Bahn sensor."""
|
"""Implementation of a Deutsche Bahn sensor."""
|
||||||
|
|
||||||
def __init__(self, start, goal, offset, only_direct):
|
def __init__(self, start, goal, offset, only_direct):
|
||||||
|
|
|
@ -6,6 +6,7 @@ from homeassistant.components.sensor import (
|
||||||
DEVICE_CLASS_POWER,
|
DEVICE_CLASS_POWER,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
DEVICE_CLASS_VOLTAGE,
|
DEVICE_CLASS_VOLTAGE,
|
||||||
|
SensorEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import PERCENTAGE
|
from homeassistant.const import PERCENTAGE
|
||||||
|
@ -65,7 +66,7 @@ async def async_setup_entry(
|
||||||
async_add_entities(entities, False)
|
async_add_entities(entities, False)
|
||||||
|
|
||||||
|
|
||||||
class DevoloMultiLevelDeviceEntity(DevoloDeviceEntity):
|
class DevoloMultiLevelDeviceEntity(SensorEntity, DevoloDeviceEntity):
|
||||||
"""Abstract representation of a multi level sensor within devolo Home Control."""
|
"""Abstract representation of a multi level sensor within devolo Home Control."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
"""Support for Dexcom sensors."""
|
"""Support for Dexcom sensors."""
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME
|
from homeassistant.const import CONF_UNIT_OF_MEASUREMENT, CONF_USERNAME
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
async_add_entities(sensors, False)
|
async_add_entities(sensors, False)
|
||||||
|
|
||||||
|
|
||||||
class DexcomGlucoseValueSensor(CoordinatorEntity):
|
class DexcomGlucoseValueSensor(SensorEntity, CoordinatorEntity):
|
||||||
"""Representation of a Dexcom glucose value sensor."""
|
"""Representation of a Dexcom glucose value sensor."""
|
||||||
|
|
||||||
def __init__(self, coordinator, username, unit_of_measurement):
|
def __init__(self, coordinator, username, unit_of_measurement):
|
||||||
|
@ -58,7 +59,7 @@ class DexcomGlucoseValueSensor(CoordinatorEntity):
|
||||||
return self._unique_id
|
return self._unique_id
|
||||||
|
|
||||||
|
|
||||||
class DexcomGlucoseTrendSensor(CoordinatorEntity):
|
class DexcomGlucoseTrendSensor(SensorEntity, CoordinatorEntity):
|
||||||
"""Representation of a Dexcom glucose trend sensor."""
|
"""Representation of a Dexcom glucose trend sensor."""
|
||||||
|
|
||||||
def __init__(self, coordinator, username):
|
def __init__(self, coordinator, username):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
import Adafruit_DHT # pylint: disable=import-error
|
import Adafruit_DHT # pylint: disable=import-error
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -14,7 +14,6 @@ from homeassistant.const import (
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
from homeassistant.util.temperature import celsius_to_fahrenheit
|
from homeassistant.util.temperature import celsius_to_fahrenheit
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(dev, True)
|
add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class DHTSensor(Entity):
|
class DHTSensor(SensorEntity):
|
||||||
"""Implementation of the DHT sensor."""
|
"""Implementation of the DHT sensor."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -6,7 +6,7 @@ import random
|
||||||
import discogs_client
|
import discogs_client
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.aiohttp_client import SERVER_SOFTWARE
|
from homeassistant.helpers.aiohttp_client import SERVER_SOFTWARE
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -89,7 +88,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(sensors, True)
|
add_entities(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class DiscogsSensor(Entity):
|
class DiscogsSensor(SensorEntity):
|
||||||
"""Create a new Discogs sensor for a specific type."""
|
"""Create a new Discogs sensor for a specific type."""
|
||||||
|
|
||||||
def __init__(self, discogs_data, name, sensor_type):
|
def __init__(self, discogs_data, name, sensor_type):
|
||||||
|
|
|
@ -6,10 +6,9 @@ import aiodns
|
||||||
from aiodns.error import DNSError
|
from aiodns.error import DNSError
|
||||||
import voluptuous as vol
|
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.const import CONF_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -55,7 +54,7 @@ async def async_setup_platform(hass, config, async_add_devices, discovery_info=N
|
||||||
async_add_devices([WanIpSensor(hass, name, hostname, resolver, ipv6)], True)
|
async_add_devices([WanIpSensor(hass, name, hostname, resolver, ipv6)], True)
|
||||||
|
|
||||||
|
|
||||||
class WanIpSensor(Entity):
|
class WanIpSensor(SensorEntity):
|
||||||
"""Implementation of a DNS IP sensor."""
|
"""Implementation of a DNS IP sensor."""
|
||||||
|
|
||||||
def __init__(self, hass, name, hostname, resolver, ipv6):
|
def __init__(self, hass, name, hostname, resolver, ipv6):
|
||||||
|
|
|
@ -4,10 +4,9 @@ import re
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import CONF_SENSORS, DATA_GIGABYTES, PERCENTAGE
|
from homeassistant.const import CONF_SENSORS, DATA_GIGABYTES, PERCENTAGE
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
from . import DOMAIN as DOVADO_DOMAIN
|
from . import DOMAIN as DOVADO_DOMAIN
|
||||||
|
|
||||||
|
@ -53,7 +52,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(entities)
|
add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class DovadoSensor(Entity):
|
class DovadoSensor(SensorEntity):
|
||||||
"""Representation of a Dovado sensor."""
|
"""Representation of a Dovado sensor."""
|
||||||
|
|
||||||
def __init__(self, data, sensor):
|
def __init__(self, data, sensor):
|
||||||
|
|
|
@ -12,7 +12,7 @@ from dsmr_parser.clients.protocol import create_dsmr_reader, create_tcp_dsmr_rea
|
||||||
import serial
|
import serial
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
|
@ -22,7 +22,6 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.core import CoreState, callback
|
from homeassistant.core import CoreState, callback
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
|
@ -286,7 +285,7 @@ async def async_setup_entry(
|
||||||
hass.data[DOMAIN][entry.entry_id][DATA_TASK] = task
|
hass.data[DOMAIN][entry.entry_id][DATA_TASK] = task
|
||||||
|
|
||||||
|
|
||||||
class DSMREntity(Entity):
|
class DSMREntity(SensorEntity):
|
||||||
"""Entity reading values from DSMR telegram."""
|
"""Entity reading values from DSMR telegram."""
|
||||||
|
|
||||||
def __init__(self, name, device_name, device_serial, obis, config, force_update):
|
def __init__(self, name, device_name, device_serial, obis, config, force_update):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Support for DSMR Reader through MQTT."""
|
"""Support for DSMR Reader through MQTT."""
|
||||||
from homeassistant.components import mqtt
|
from homeassistant.components import mqtt
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
|
|
||||||
from .definitions import DEFINITIONS
|
from .definitions import DEFINITIONS
|
||||||
|
@ -19,7 +19,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities(sensors)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class DSMRSensor(Entity):
|
class DSMRSensor(SensorEntity):
|
||||||
"""Representation of a DSMR sensor that is updated via MQTT."""
|
"""Representation of a DSMR sensor that is updated via MQTT."""
|
||||||
|
|
||||||
def __init__(self, topic):
|
def __init__(self, topic):
|
||||||
|
|
|
@ -4,10 +4,9 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
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, HTTP_OK
|
from homeassistant.const import CONF_NAME, HTTP_OK
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -39,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([DteEnergyBridgeSensor(ip_address, name, version)], True)
|
add_entities([DteEnergyBridgeSensor(ip_address, name, version)], True)
|
||||||
|
|
||||||
|
|
||||||
class DteEnergyBridgeSensor(Entity):
|
class DteEnergyBridgeSensor(SensorEntity):
|
||||||
"""Implementation of the DTE Energy Bridge sensors."""
|
"""Implementation of the DTE Energy Bridge sensors."""
|
||||||
|
|
||||||
def __init__(self, ip_address, name, version):
|
def __init__(self, ip_address, name, version):
|
||||||
|
|
|
@ -9,10 +9,9 @@ from datetime import datetime, timedelta
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
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, HTTP_OK, TIME_MINUTES
|
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME, HTTP_OK, TIME_MINUTES
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
_RESOURCE = "https://data.dublinked.ie/cgi-bin/rtpi/realtimebusinformation"
|
_RESOURCE = "https://data.dublinked.ie/cgi-bin/rtpi/realtimebusinformation"
|
||||||
|
@ -65,7 +64,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([DublinPublicTransportSensor(data, stop, route, name)], True)
|
add_entities([DublinPublicTransportSensor(data, stop, route, name)], True)
|
||||||
|
|
||||||
|
|
||||||
class DublinPublicTransportSensor(Entity):
|
class DublinPublicTransportSensor(SensorEntity):
|
||||||
"""Implementation of an Dublin public transport sensor."""
|
"""Implementation of an Dublin public transport sensor."""
|
||||||
|
|
||||||
def __init__(self, data, stop, route, name):
|
def __init__(self, data, stop, route, name):
|
||||||
|
|
|
@ -15,10 +15,9 @@ import logging
|
||||||
from dwdwfsapi import DwdWeatherWarningsAPI
|
from dwdwfsapi import DwdWeatherWarningsAPI
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_MONITORED_CONDITIONS, CONF_NAME
|
from homeassistant.const import ATTR_ATTRIBUTION, CONF_MONITORED_CONDITIONS, CONF_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -87,7 +86,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(sensors, True)
|
add_entities(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class DwdWeatherWarningsSensor(Entity):
|
class DwdWeatherWarningsSensor(SensorEntity):
|
||||||
"""Representation of a DWD-Weather-Warnings sensor."""
|
"""Representation of a DWD-Weather-Warnings sensor."""
|
||||||
|
|
||||||
def __init__(self, api, name, sensor_type):
|
def __init__(self, api, name, sensor_type):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
||||||
import dweepy
|
import dweepy
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE,
|
CONF_DEVICE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -14,7 +14,6 @@ from homeassistant.const import (
|
||||||
CONF_VALUE_TEMPLATE,
|
CONF_VALUE_TEMPLATE,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -56,7 +55,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([DweetSensor(hass, dweet, name, value_template, unit)], True)
|
add_entities([DweetSensor(hass, dweet, name, value_template, unit)], True)
|
||||||
|
|
||||||
|
|
||||||
class DweetSensor(Entity):
|
class DweetSensor(SensorEntity):
|
||||||
"""Representation of a Dweet sensor."""
|
"""Representation of a Dweet sensor."""
|
||||||
|
|
||||||
def __init__(self, hass, dweet, name, value_template, unit_of_measurement):
|
def __init__(self, hass, dweet, name, value_template, unit_of_measurement):
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
from libpurecool.dyson_pure_cool import DysonPureCool
|
from libpurecool.dyson_pure_cool import DysonPureCool
|
||||||
from libpurecool.dyson_pure_cool_link import DysonPureCoolLink
|
from libpurecool.dyson_pure_cool_link import DysonPureCoolLink
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_ICON,
|
ATTR_ICON,
|
||||||
|
@ -13,7 +14,6 @@ from homeassistant.const import (
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TIME_HOURS,
|
TIME_HOURS,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
from . import DYSON_DEVICES, DysonEntity
|
from . import DYSON_DEVICES, DysonEntity
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(devices)
|
add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class DysonSensor(DysonEntity, Entity):
|
class DysonSensor(SensorEntity, DysonEntity):
|
||||||
"""Representation of a generic Dyson sensor."""
|
"""Representation of a generic Dyson sensor."""
|
||||||
|
|
||||||
def __init__(self, device, sensor_type):
|
def __init__(self, device, sensor_type):
|
||||||
|
|
|
@ -5,6 +5,7 @@ import logging
|
||||||
from aioeafm import get_station
|
from aioeafm import get_station
|
||||||
import async_timeout
|
import async_timeout
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION, LENGTH_METERS
|
from homeassistant.const import ATTR_ATTRIBUTION, LENGTH_METERS
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
from homeassistant.helpers.update_coordinator import (
|
from homeassistant.helpers.update_coordinator import (
|
||||||
|
@ -77,7 +78,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
await coordinator.async_refresh()
|
await coordinator.async_refresh()
|
||||||
|
|
||||||
|
|
||||||
class Measurement(CoordinatorEntity):
|
class Measurement(SensorEntity, CoordinatorEntity):
|
||||||
"""A gauge at a flood monitoring station."""
|
"""A gauge at a flood monitoring station."""
|
||||||
|
|
||||||
attribution = "This uses Environment Agency flood and river level data from the real-time data API"
|
attribution = "This uses Environment Agency flood and river level data from the real-time data API"
|
||||||
|
|
|
@ -10,7 +10,7 @@ from pyebox import EboxClient
|
||||||
from pyebox.client import PyEboxError
|
from pyebox.client import PyEboxError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_MONITORED_VARIABLES,
|
CONF_MONITORED_VARIABLES,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -22,7 +22,6 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -90,7 +89,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities(sensors, True)
|
async_add_entities(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class EBoxSensor(Entity):
|
class EBoxSensor(SensorEntity):
|
||||||
"""Implementation of a EBox sensor."""
|
"""Implementation of a EBox sensor."""
|
||||||
|
|
||||||
def __init__(self, ebox_data, sensor_type, name):
|
def __init__(self, ebox_data, sensor_type, name):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(dev, True)
|
add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class EbusdSensor(Entity):
|
class EbusdSensor(SensorEntity):
|
||||||
"""Ebusd component sensor methods definition."""
|
"""Ebusd component sensor methods definition."""
|
||||||
|
|
||||||
def __init__(self, data, sensor, name):
|
def __init__(self, data, sensor, name):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Allows reading temperatures from ecoal/esterownik.pl controller."""
|
"""Allows reading temperatures from ecoal/esterownik.pl controller."""
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import TEMP_CELSIUS
|
from homeassistant.const import TEMP_CELSIUS
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
from . import AVAILABLE_SENSORS, DATA_ECOAL_BOILER
|
from . import AVAILABLE_SENSORS, DATA_ECOAL_BOILER
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(devices, True)
|
add_entities(devices, True)
|
||||||
|
|
||||||
|
|
||||||
class EcoalTempSensor(Entity):
|
class EcoalTempSensor(SensorEntity):
|
||||||
"""Representation of a temperature sensor using ecoal status data."""
|
"""Representation of a temperature sensor using ecoal status data."""
|
||||||
|
|
||||||
def __init__(self, ecoal_contr, name, status_attr):
|
def __init__(self, ecoal_contr, name, status_attr):
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
"""Support for Ecobee sensors."""
|
"""Support for Ecobee sensors."""
|
||||||
from pyecobee.const import ECOBEE_STATE_CALIBRATING, ECOBEE_STATE_UNKNOWN
|
from pyecobee.const import ECOBEE_STATE_CALIBRATING, ECOBEE_STATE_UNKNOWN
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
DEVICE_CLASS_HUMIDITY,
|
DEVICE_CLASS_HUMIDITY,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
DEVICE_CLASS_TEMPERATURE,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
from .const import _LOGGER, DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
|
from .const import _LOGGER, DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||||
async_add_entities(dev, True)
|
async_add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class EcobeeSensor(Entity):
|
class EcobeeSensor(SensorEntity):
|
||||||
"""Representation of an Ecobee sensor."""
|
"""Representation of an Ecobee sensor."""
|
||||||
|
|
||||||
def __init__(self, data, sensor_name, sensor_type, sensor_index):
|
def __init__(self, data, sensor_name, sensor_type, sensor_index):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Support for Rheem EcoNet water heaters."""
|
"""Support for Rheem EcoNet water heaters."""
|
||||||
from pyeconet.equipment import EquipmentType
|
from pyeconet.equipment import EquipmentType
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
|
@ -47,7 +48,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
async_add_entities(sensors)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class EcoNetSensor(EcoNetEntity):
|
class EcoNetSensor(SensorEntity, EcoNetEntity):
|
||||||
"""Define a Econet sensor."""
|
"""Define a Econet sensor."""
|
||||||
|
|
||||||
def __init__(self, econet_device, device_name):
|
def __init__(self, econet_device, device_name):
|
||||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
||||||
from beacontools import BeaconScanner, EddystoneFilter, EddystoneTLMFrame
|
from beacontools import BeaconScanner, EddystoneFilter, EddystoneTLMFrame
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
|
@ -19,7 +19,6 @@ from homeassistant.const import (
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -97,7 +96,7 @@ def get_from_conf(config, config_key, length):
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|
||||||
class EddystoneTemp(Entity):
|
class EddystoneTemp(SensorEntity):
|
||||||
"""Representation of a temperature sensor."""
|
"""Representation of a temperature sensor."""
|
||||||
|
|
||||||
def __init__(self, name, namespace, instance):
|
def __init__(self, name, namespace, instance):
|
||||||
|
|
|
@ -7,7 +7,7 @@ from sml import SmlGetListResponse
|
||||||
from sml.asyncio import SmlProtocol
|
from sml.asyncio import SmlProtocol
|
||||||
import voluptuous as vol
|
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.const import CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@ -15,7 +15,6 @@ from homeassistant.helpers.dispatcher import (
|
||||||
async_dispatcher_connect,
|
async_dispatcher_connect,
|
||||||
async_dispatcher_send,
|
async_dispatcher_send,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.helpers.entity_registry import async_get_registry
|
from homeassistant.helpers.entity_registry import async_get_registry
|
||||||
from homeassistant.helpers.typing import Optional
|
from homeassistant.helpers.typing import Optional
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
@ -193,7 +192,7 @@ class EDL21:
|
||||||
self._async_add_entities(new_entities, update_before_add=True)
|
self._async_add_entities(new_entities, update_before_add=True)
|
||||||
|
|
||||||
|
|
||||||
class EDL21Entity(Entity):
|
class EDL21Entity(SensorEntity):
|
||||||
"""Entity reading values from EDL21 telegram."""
|
"""Entity reading values from EDL21 telegram."""
|
||||||
|
|
||||||
def __init__(self, electricity_id, obis, name, telegram):
|
def __init__(self, electricity_id, obis, name, telegram):
|
||||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_CURRENCY,
|
CONF_CURRENCY,
|
||||||
CONF_MONITORED_VARIABLES,
|
CONF_MONITORED_VARIABLES,
|
||||||
|
@ -13,7 +13,6 @@ from homeassistant.const import (
|
||||||
POWER_WATT,
|
POWER_WATT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
_RESOURCE = "https://engage.efergy.com/mobile_proxy/"
|
_RESOURCE = "https://engage.efergy.com/mobile_proxy/"
|
||||||
|
@ -94,7 +93,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(dev, True)
|
add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class EfergySensor(Entity):
|
class EfergySensor(SensorEntity):
|
||||||
"""Implementation of an Efergy sensor."""
|
"""Implementation of an Efergy sensor."""
|
||||||
|
|
||||||
def __init__(self, sensor_type, app_token, utc_offset, period, currency, sid=None):
|
def __init__(self, sensor_type, app_token, utc_offset, period, currency, sid=None):
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Support for Eight Sleep sensors."""
|
"""Support for Eight Sleep sensors."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
|
@ -66,7 +67,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities(all_sensors, True)
|
async_add_entities(all_sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class EightHeatSensor(EightSleepHeatEntity):
|
class EightHeatSensor(SensorEntity, EightSleepHeatEntity):
|
||||||
"""Representation of an eight sleep heat-based sensor."""
|
"""Representation of an eight sleep heat-based sensor."""
|
||||||
|
|
||||||
def __init__(self, name, eight, sensor):
|
def __init__(self, name, eight, sensor):
|
||||||
|
@ -119,7 +120,7 @@ class EightHeatSensor(EightSleepHeatEntity):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class EightUserSensor(EightSleepUserEntity):
|
class EightUserSensor(SensorEntity, EightSleepUserEntity):
|
||||||
"""Representation of an eight sleep user-based sensor."""
|
"""Representation of an eight sleep user-based sensor."""
|
||||||
|
|
||||||
def __init__(self, name, eight, sensor, units):
|
def __init__(self, name, eight, sensor, units):
|
||||||
|
@ -289,7 +290,7 @@ class EightUserSensor(EightSleepUserEntity):
|
||||||
return state_attr
|
return state_attr
|
||||||
|
|
||||||
|
|
||||||
class EightRoomSensor(EightSleepUserEntity):
|
class EightRoomSensor(SensorEntity, EightSleepUserEntity):
|
||||||
"""Representation of an eight sleep room sensor."""
|
"""Representation of an eight sleep room sensor."""
|
||||||
|
|
||||||
def __init__(self, name, eight, sensor, units):
|
def __init__(self, name, eight, sensor, units):
|
||||||
|
|
|
@ -6,11 +6,10 @@ import logging
|
||||||
import eliqonline
|
import eliqonline
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_NAME, POWER_WATT
|
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_NAME, POWER_WATT
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities([EliqSensor(api, channel_id, name)], True)
|
async_add_entities([EliqSensor(api, channel_id, name)], True)
|
||||||
|
|
||||||
|
|
||||||
class EliqSensor(Entity):
|
class EliqSensor(SensorEntity):
|
||||||
"""Implementation of an ELIQ Online sensor."""
|
"""Implementation of an ELIQ Online sensor."""
|
||||||
|
|
||||||
def __init__(self, api, channel_id, name):
|
def __init__(self, api, channel_id, name):
|
||||||
|
|
|
@ -8,6 +8,7 @@ from elkm1_lib.const import (
|
||||||
from elkm1_lib.util import pretty_const, username
|
from elkm1_lib.util import pretty_const, username
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.const import VOLT
|
from homeassistant.const import VOLT
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
|
@ -67,7 +68,7 @@ def temperature_to_state(temperature, undefined_temperature):
|
||||||
return temperature if temperature > undefined_temperature else None
|
return temperature if temperature > undefined_temperature else None
|
||||||
|
|
||||||
|
|
||||||
class ElkSensor(ElkAttachedEntity):
|
class ElkSensor(SensorEntity, ElkAttachedEntity):
|
||||||
"""Base representation of Elk-M1 sensor."""
|
"""Base representation of Elk-M1 sensor."""
|
||||||
|
|
||||||
def __init__(self, element, elk, elk_data):
|
def __init__(self, element, elk, elk_data):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_API_KEY,
|
CONF_API_KEY,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
@ -19,7 +19,6 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.helpers import template
|
from homeassistant.helpers import template
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -125,7 +124,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(sensors)
|
add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class EmonCmsSensor(Entity):
|
class EmonCmsSensor(SensorEntity):
|
||||||
"""Implementation of an Emoncms sensor."""
|
"""Implementation of an Emoncms sensor."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Support for EnOcean sensors."""
|
"""Support for EnOcean sensors."""
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
|
@ -101,7 +101,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([EnOceanWindowHandle(dev_id, dev_name)])
|
add_entities([EnOceanWindowHandle(dev_id, dev_name)])
|
||||||
|
|
||||||
|
|
||||||
class EnOceanSensor(EnOceanEntity, RestoreEntity):
|
class EnOceanSensor(SensorEntity, EnOceanEntity, RestoreEntity):
|
||||||
"""Representation of an EnOcean sensor device such as a power meter."""
|
"""Representation of an EnOcean sensor device such as a power meter."""
|
||||||
|
|
||||||
def __init__(self, dev_id, dev_name, sensor_type):
|
def __init__(self, dev_id, dev_name, sensor_type):
|
||||||
|
|
|
@ -8,7 +8,7 @@ from envoy_reader.envoy_reader import EnvoyReader
|
||||||
import httpx
|
import httpx
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
|
@ -156,7 +156,7 @@ async def async_setup_platform(
|
||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class Envoy(CoordinatorEntity):
|
class Envoy(SensorEntity, CoordinatorEntity):
|
||||||
"""Envoy entity."""
|
"""Envoy entity."""
|
||||||
|
|
||||||
def __init__(self, sensor_type, name, serial_number, unit, coordinator):
|
def __init__(self, sensor_type, name, serial_number, unit, coordinator):
|
||||||
|
|
|
@ -4,7 +4,7 @@ from datetime import datetime, timedelta
|
||||||
from enturclient import EnturPublicTransportData
|
from enturclient import EnturPublicTransportData
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
CONF_LATITUDE,
|
CONF_LATITUDE,
|
||||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
|
@ -148,7 +147,7 @@ class EnturProxy:
|
||||||
return self._api.get_stop_info(stop_id)
|
return self._api.get_stop_info(stop_id)
|
||||||
|
|
||||||
|
|
||||||
class EnturPublicTransportSensor(Entity):
|
class EnturPublicTransportSensor(SensorEntity):
|
||||||
"""Implementation of a Entur public transport sensor."""
|
"""Implementation of a Entur public transport sensor."""
|
||||||
|
|
||||||
def __init__(self, api: EnturProxy, name: str, stop: str, show_on_map: bool):
|
def __init__(self, api: EnturProxy, name: str, stop: str, show_on_map: bool):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import re
|
||||||
from env_canada import ECData
|
from env_canada import ECData
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
ATTR_LOCATION,
|
ATTR_LOCATION,
|
||||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([ECSensor(sensor_type, ec_data) for sensor_type in sensor_list], True)
|
add_entities([ECSensor(sensor_type, ec_data) for sensor_type in sensor_list], True)
|
||||||
|
|
||||||
|
|
||||||
class ECSensor(Entity):
|
class ECSensor(SensorEntity):
|
||||||
"""Implementation of an Environment Canada sensor."""
|
"""Implementation of an Environment Canada sensor."""
|
||||||
|
|
||||||
def __init__(self, sensor_type, ec_data):
|
def __init__(self, sensor_type, ec_data):
|
||||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_DISPLAY_OPTIONS,
|
CONF_DISPLAY_OPTIONS,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
@ -14,7 +14,6 @@ from homeassistant.const import (
|
||||||
VOLT,
|
VOLT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -71,7 +70,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities(dev, True)
|
add_entities(dev, True)
|
||||||
|
|
||||||
|
|
||||||
class EnvirophatSensor(Entity):
|
class EnvirophatSensor(SensorEntity):
|
||||||
"""Representation of an Enviro pHAT sensor."""
|
"""Representation of an Enviro pHAT sensor."""
|
||||||
|
|
||||||
def __init__(self, data, sensor_types):
|
def __init__(self, data, sensor_types):
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
"""Support for Envisalink sensors (shows panel info)."""
|
"""Support for Envisalink sensors (shows panel info)."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CONF_PARTITIONNAME,
|
CONF_PARTITIONNAME,
|
||||||
|
@ -37,7 +37,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||||
async_add_entities(devices)
|
async_add_entities(devices)
|
||||||
|
|
||||||
|
|
||||||
class EnvisalinkSensor(EnvisalinkDevice, Entity):
|
class EnvisalinkSensor(SensorEntity, EnvisalinkDevice):
|
||||||
"""Representation of an Envisalink keypad."""
|
"""Representation of an Envisalink keypad."""
|
||||||
|
|
||||||
def __init__(self, hass, partition_name, partition_number, info, controller):
|
def __init__(self, hass, partition_name, partition_number, info, controller):
|
||||||
|
|
|
@ -4,11 +4,10 @@ from datetime import timedelta
|
||||||
from epsonprinter_pkg.epsonprinterapi import EpsonPrinterAPI
|
from epsonprinter_pkg.epsonprinterapi import EpsonPrinterAPI
|
||||||
import voluptuous as vol
|
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, PERCENTAGE
|
from homeassistant.const import CONF_HOST, CONF_MONITORED_CONDITIONS, PERCENTAGE
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
MONITORED_CONDITIONS = {
|
MONITORED_CONDITIONS = {
|
||||||
"black": ["Ink level Black", PERCENTAGE, "mdi:water"],
|
"black": ["Ink level Black", PERCENTAGE, "mdi:water"],
|
||||||
|
@ -45,7 +44,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
add_devices(sensors, True)
|
add_devices(sensors, True)
|
||||||
|
|
||||||
|
|
||||||
class EpsonPrinterCartridge(Entity):
|
class EpsonPrinterCartridge(SensorEntity):
|
||||||
"""Representation of a cartridge sensor."""
|
"""Representation of a cartridge sensor."""
|
||||||
|
|
||||||
def __init__(self, api, cartridgeidx):
|
def __init__(self, api, cartridgeidx):
|
||||||
|
|
|
@ -6,7 +6,7 @@ import math
|
||||||
from aioesphomeapi import SensorInfo, SensorState, TextSensorInfo, TextSensorState
|
from aioesphomeapi import SensorInfo, SensorState, TextSensorInfo, TextSensorState
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import DEVICE_CLASSES
|
from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
@ -42,7 +42,7 @@ async def async_setup_entry(
|
||||||
# pylint: disable=invalid-overridden-method
|
# pylint: disable=invalid-overridden-method
|
||||||
|
|
||||||
|
|
||||||
class EsphomeSensor(EsphomeEntity):
|
class EsphomeSensor(SensorEntity, EsphomeEntity):
|
||||||
"""A sensor implementation for esphome."""
|
"""A sensor implementation for esphome."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -89,7 +89,7 @@ class EsphomeSensor(EsphomeEntity):
|
||||||
return self._static_info.device_class
|
return self._static_info.device_class
|
||||||
|
|
||||||
|
|
||||||
class EsphomeTextSensor(EsphomeEntity):
|
class EsphomeTextSensor(SensorEntity, EsphomeEntity):
|
||||||
"""A text sensor implementation for ESPHome."""
|
"""A text sensor implementation for ESPHome."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -6,10 +6,9 @@ from datetime import timedelta
|
||||||
from pyessent import PyEssent
|
from pyessent import PyEssent
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, ENERGY_KILO_WATT_HOUR
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, ENERGY_KILO_WATT_HOUR
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
SCAN_INTERVAL = timedelta(hours=1)
|
SCAN_INTERVAL = timedelta(hours=1)
|
||||||
|
@ -82,7 +81,7 @@ class EssentBase:
|
||||||
self._meter_data[possible_meter] = meter_data
|
self._meter_data[possible_meter] = meter_data
|
||||||
|
|
||||||
|
|
||||||
class EssentMeter(Entity):
|
class EssentMeter(SensorEntity):
|
||||||
"""Representation of Essent measurements."""
|
"""Representation of Essent measurements."""
|
||||||
|
|
||||||
def __init__(self, essent_base, meter, meter_type, tariff, unit):
|
def __init__(self, essent_base, meter, meter_type, tariff, unit):
|
||||||
|
|
|
@ -4,10 +4,9 @@ from datetime import timedelta
|
||||||
from pyetherscan import get_balance
|
from pyetherscan import get_balance
|
||||||
import voluptuous as vol
|
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_ADDRESS, CONF_NAME, CONF_TOKEN
|
from homeassistant.const import ATTR_ATTRIBUTION, CONF_ADDRESS, CONF_NAME, CONF_TOKEN
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
|
|
||||||
ATTRIBUTION = "Data provided by etherscan.io"
|
ATTRIBUTION = "Data provided by etherscan.io"
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
add_entities([EtherscanSensor(name, address, token, token_address)], True)
|
add_entities([EtherscanSensor(name, address, token, token_address)], True)
|
||||||
|
|
||||||
|
|
||||||
class EtherscanSensor(Entity):
|
class EtherscanSensor(SensorEntity):
|
||||||
"""Representation of an Etherscan.io sensor."""
|
"""Representation of an Etherscan.io sensor."""
|
||||||
|
|
||||||
def __init__(self, name, address, token, token_address):
|
def __init__(self, name, address, token, token_address):
|
||||||
|
|
Loading…
Add table
Reference in a new issue