Migrate integrations i-m to extend SensorEntity (#48213)
This commit is contained in:
parent
64bc9a8196
commit
fdf97eaca3
62 changed files with 152 additions and 157 deletions
|
@ -8,7 +8,7 @@ from iammeter import real_time_api
|
|||
from iammeter.power_meter import IamMeterError
|
||||
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, CONF_PORT
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers import debounce
|
||||
|
@ -74,7 +74,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class IamMeter(CoordinatorEntity):
|
||||
class IamMeter(CoordinatorEntity, SensorEntity):
|
||||
"""Class for a sensor."""
|
||||
|
||||
def __init__(self, coordinator, uid, sensor_name, unit, dev_name):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Aqualink temperature sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN, SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
@ -22,7 +22,7 @@ async def async_setup_entry(
|
|||
async_add_entities(devs, True)
|
||||
|
||||
|
||||
class HassAqualinkSensor(AqualinkEntity):
|
||||
class HassAqualinkSensor(AqualinkEntity, SensorEntity):
|
||||
"""Representation of a sensor."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"""Support for iCloud sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
|
@ -48,7 +48,7 @@ def add_entities(account, async_add_entities, tracked):
|
|||
async_add_entities(new_tracked, True)
|
||||
|
||||
|
||||
class IcloudDeviceBatterySensor(Entity):
|
||||
class IcloudDeviceBatterySensor(SensorEntity):
|
||||
"""Representation of a iCloud device battery sensor."""
|
||||
|
||||
def __init__(self, account: IcloudAccount, device: IcloudDevice):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Support for IHC sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_UNIT_OF_MEASUREMENT
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import IHC_CONTROLLER, IHC_INFO
|
||||
from .ihcdevice import IHCDevice
|
||||
|
@ -26,7 +26,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devices)
|
||||
|
||||
|
||||
class IHCSensor(IHCDevice, Entity):
|
||||
class IHCSensor(IHCDevice, SensorEntity):
|
||||
"""Implementation of the IHC sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -6,7 +6,7 @@ from aioimaplib import IMAP4_SSL, AioImapException
|
|||
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 (
|
||||
CONF_NAME,
|
||||
CONF_PASSWORD,
|
||||
|
@ -16,7 +16,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -62,7 +61,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities([sensor], True)
|
||||
|
||||
|
||||
class ImapSensor(Entity):
|
||||
class ImapSensor(SensorEntity):
|
||||
"""Representation of an IMAP sensor."""
|
||||
|
||||
def __init__(self, name, user, password, server, port, charset, folder, search):
|
||||
|
|
|
@ -7,7 +7,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_DATE,
|
||||
CONF_NAME,
|
||||
|
@ -18,7 +18,6 @@ from homeassistant.const import (
|
|||
CONTENT_TYPE_TEXT_PLAIN,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -145,7 +144,7 @@ class EmailReader:
|
|||
return None
|
||||
|
||||
|
||||
class EmailContentSensor(Entity):
|
||||
class EmailContentSensor(SensorEntity):
|
||||
"""Representation of an EMail sensor."""
|
||||
|
||||
def __init__(self, hass, email_reader, name, allowed_senders, value_template):
|
||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_PRESSURE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
|
@ -40,7 +40,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
)
|
||||
|
||||
|
||||
class IncomfortSensor(IncomfortChild):
|
||||
class IncomfortSensor(IncomfortChild, SensorEntity):
|
||||
"""Representation of an InComfort/InTouch sensor device."""
|
||||
|
||||
def __init__(self, client, heater, name) -> None:
|
||||
|
|
|
@ -5,7 +5,10 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA as SENSOR_PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import (
|
||||
PLATFORM_SCHEMA as SENSOR_PLATFORM_SCHEMA,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_API_VERSION,
|
||||
CONF_NAME,
|
||||
|
@ -16,7 +19,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.exceptions import PlatformNotReady, TemplateError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from . import create_influx_url, get_influx_connection, validate_version_specific_config
|
||||
|
@ -169,7 +171,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, lambda _: influx.close())
|
||||
|
||||
|
||||
class InfluxSensor(Entity):
|
||||
class InfluxSensor(SensorEntity):
|
||||
"""Implementation of a Influxdb sensor."""
|
||||
|
||||
def __init__(self, hass, influx, query):
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CONF_METHOD,
|
||||
|
@ -83,7 +83,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities([integral])
|
||||
|
||||
|
||||
class IntegrationSensor(RestoreEntity):
|
||||
class IntegrationSensor(RestoreEntity, SensorEntity):
|
||||
"""Representation of an integration sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Support for Home Assistant iOS app sensors."""
|
||||
from homeassistant.components import ios
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import PERCENTAGE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -32,7 +32,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(dev, True)
|
||||
|
||||
|
||||
class IOSSensor(Entity):
|
||||
class IOSSensor(SensorEntity):
|
||||
"""Representation of an iOS sensor."""
|
||||
|
||||
def __init__(self, sensor_type, device_name, device):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Support for IOTA wallet sensors."""
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
|
||||
from . import CONF_WALLETS, IotaDevice
|
||||
|
@ -27,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors)
|
||||
|
||||
|
||||
class IotaBalanceSensor(IotaDevice):
|
||||
class IotaBalanceSensor(IotaDevice, SensorEntity):
|
||||
"""Implement an IOTA sensor for displaying wallets balance."""
|
||||
|
||||
def __init__(self, wallet_config, iota_config):
|
||||
|
@ -60,7 +61,7 @@ class IotaBalanceSensor(IotaDevice):
|
|||
self._state = self.api.get_inputs()["totalBalance"]
|
||||
|
||||
|
||||
class IotaNodeSensor(IotaDevice):
|
||||
class IotaNodeSensor(IotaDevice, SensorEntity):
|
||||
"""Implement an IOTA sensor for displaying attributes of node."""
|
||||
|
||||
def __init__(self, iota_config):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for Iperf3 sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
@ -23,7 +24,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info)
|
|||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class Iperf3Sensor(RestoreEntity):
|
||||
class Iperf3Sensor(RestoreEntity, SensorEntity):
|
||||
"""A Iperf3 sensor implementation."""
|
||||
|
||||
def __init__(self, iperf3_data, sensor_type):
|
||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||
from datetime import timedelta
|
||||
from typing import Any, Callable
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_LOCATION, DEVICE_CLASS_TIMESTAMP, PERCENTAGE
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
@ -52,7 +53,7 @@ async def async_setup_entry(
|
|||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class IPPSensor(IPPEntity):
|
||||
class IPPSensor(IPPEntity, SensorEntity):
|
||||
"""Defines an IPP sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -3,6 +3,7 @@ from statistics import mean
|
|||
|
||||
import numpy as np
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import ATTR_STATE
|
||||
from homeassistant.core import callback
|
||||
|
||||
|
@ -98,7 +99,7 @@ def calculate_trend(indices):
|
|||
return TREND_FLAT
|
||||
|
||||
|
||||
class ForecastSensor(IQVIAEntity):
|
||||
class ForecastSensor(IQVIAEntity, SensorEntity):
|
||||
"""Define sensor related to forecast data."""
|
||||
|
||||
@callback
|
||||
|
@ -137,7 +138,7 @@ class ForecastSensor(IQVIAEntity):
|
|||
self._state = average
|
||||
|
||||
|
||||
class IndexSensor(IQVIAEntity):
|
||||
class IndexSensor(IQVIAEntity, SensorEntity):
|
||||
"""Define sensor related to indices."""
|
||||
|
||||
@callback
|
||||
|
|
|
@ -4,10 +4,9 @@ from datetime import timedelta
|
|||
from pyirishrail.pyirishrail import IrishRailRTPI
|
||||
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
|
||||
|
||||
ATTR_STATION = "Station"
|
||||
ATTR_ORIGIN = "Origin"
|
||||
|
@ -64,7 +63,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
)
|
||||
|
||||
|
||||
class IrishRailTransportSensor(Entity):
|
||||
class IrishRailTransportSensor(SensorEntity):
|
||||
"""Implementation of an irish rail public transport sensor."""
|
||||
|
||||
def __init__(self, data, station, direction, destination, stops_at, name):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Platform to retrieve Islamic prayer times information for Home Assistant."""
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import DATA_UPDATED, DOMAIN, PRAYER_TIMES_ICON, SENSOR_TYPES
|
||||
|
@ -20,7 +20,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class IslamicPrayerTimeSensor(Entity):
|
||||
class IslamicPrayerTimeSensor(SensorEntity):
|
||||
"""Representation of an Islamic prayer time sensor."""
|
||||
|
||||
def __init__(self, sensor_type, client):
|
||||
|
|
|
@ -5,7 +5,7 @@ from typing import Callable
|
|||
|
||||
from pyisy.constants import ISY_VALUE_UNKNOWN
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR, SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
@ -45,7 +45,7 @@ async def async_setup_entry(
|
|||
async_add_entities(devices)
|
||||
|
||||
|
||||
class ISYSensorEntity(ISYNodeEntity):
|
||||
class ISYSensorEntity(ISYNodeEntity, SensorEntity):
|
||||
"""Representation of an ISY994 sensor device."""
|
||||
|
||||
@property
|
||||
|
@ -105,7 +105,7 @@ class ISYSensorEntity(ISYNodeEntity):
|
|||
return raw_units
|
||||
|
||||
|
||||
class ISYSensorVariableEntity(ISYEntity):
|
||||
class ISYSensorVariableEntity(ISYEntity, SensorEntity):
|
||||
"""Representation of an ISY994 variable as a sensor device."""
|
||||
|
||||
def __init__(self, vname: str, vobj: object) -> None:
|
||||
|
|
|
@ -3,8 +3,8 @@ import logging
|
|||
|
||||
import hdate
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, SUN_EVENT_SUNSET
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.sun import get_astral_event_date
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
|
@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class JewishCalendarSensor(Entity):
|
||||
class JewishCalendarSensor(SensorEntity):
|
||||
"""Representation of an Jewish calendar sensor."""
|
||||
|
||||
def __init__(self, data, sensor, sensor_info):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for monitoring juicenet/juicepoint/juicebox based EVSE sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ELECTRICAL_CURRENT_AMPERE,
|
||||
ENERGY_WATT_HOUR,
|
||||
|
@ -7,7 +8,6 @@ from homeassistant.const import (
|
|||
TIME_SECONDS,
|
||||
VOLT,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN, JUICENET_API, JUICENET_COORDINATOR
|
||||
from .entity import JuiceNetDevice
|
||||
|
@ -36,7 +36,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class JuiceNetSensorDevice(JuiceNetDevice, Entity):
|
||||
class JuiceNetSensorDevice(JuiceNetDevice, SensorEntity):
|
||||
"""Implementation of a JuiceNet sensor."""
|
||||
|
||||
def __init__(self, device, sensor_type, coordinator):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Kaiterra Temperature ahn Humidity Sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_DEVICE_ID, CONF_NAME, TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DISPATCHER_KAITERRA, DOMAIN
|
||||
|
||||
|
@ -25,7 +25,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
)
|
||||
|
||||
|
||||
class KaiterraSensor(Entity):
|
||||
class KaiterraSensor(SensorEntity):
|
||||
"""Implementation of a Kaittera sensor."""
|
||||
|
||||
def __init__(self, api, name, device_id, sensor):
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Support for KEBA charging station sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_POWER,
|
||||
ELECTRICAL_CURRENT_AMPERE,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
|
@ -62,7 +62,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class KebaSensor(Entity):
|
||||
class KebaSensor(SensorEntity):
|
||||
"""The entity class for KEBA charging stations sensors."""
|
||||
|
||||
def __init__(self, keba, key, name, entity_type, icon, unit, device_class=None):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""KIRA interface to receive UDP packets from an IR-IP bridge."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_DEVICE, CONF_NAME, STATE_UNKNOWN
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import CONF_SENSOR, DOMAIN
|
||||
|
||||
|
@ -21,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([KiraReceiver(device, kira)])
|
||||
|
||||
|
||||
class KiraReceiver(Entity):
|
||||
class KiraReceiver(SensorEntity):
|
||||
"""Implementation of a Kira Receiver."""
|
||||
|
||||
def __init__(self, name, kira):
|
||||
|
|
|
@ -5,7 +5,7 @@ from typing import Callable, Iterable
|
|||
|
||||
from xknx.devices import Sensor as XknxSensor
|
||||
|
||||
from homeassistant.components.sensor import DEVICE_CLASSES
|
||||
from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import (
|
||||
ConfigType,
|
||||
|
@ -32,7 +32,7 @@ async def async_setup_platform(
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class KNXSensor(KnxEntity, Entity):
|
||||
class KNXSensor(KnxEntity, SensorEntity):
|
||||
"""Representation of a KNX sensor."""
|
||||
|
||||
def __init__(self, device: XknxSensor) -> None:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for DHT and DS18B20 sensors attached to a Konnected device."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICES,
|
||||
CONF_NAME,
|
||||
|
@ -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 .const import DOMAIN as KONNECTED_DOMAIN, SIGNAL_DS18B20_NEW
|
||||
|
||||
|
@ -70,7 +70,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_dispatcher_connect(hass, SIGNAL_DS18B20_NEW, async_add_ds18b20)
|
||||
|
||||
|
||||
class KonnectedSensor(Entity):
|
||||
class KonnectedSensor(SensorEntity):
|
||||
"""Represents a Konnected DHT Sensor."""
|
||||
|
||||
def __init__(self, device_id, data, sensor_type, addr=None, initial_state=None):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from pykwb import kwb
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
CONF_HOST,
|
||||
|
@ -11,7 +11,6 @@ from homeassistant.const import (
|
|||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
DEFAULT_RAW = False
|
||||
DEFAULT_NAME = "KWB"
|
||||
|
@ -74,7 +73,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors)
|
||||
|
||||
|
||||
class KWBSensor(Entity):
|
||||
class KWBSensor(SensorEntity):
|
||||
"""Representation of a KWB Easyfire sensor."""
|
||||
|
||||
def __init__(self, easyfire, sensor, client_name):
|
||||
|
|
|
@ -6,7 +6,11 @@ import pylacrosse
|
|||
from serial import SerialException
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import ENTITY_ID_FORMAT, PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import (
|
||||
ENTITY_ID_FORMAT,
|
||||
PLATFORM_SCHEMA,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
CONF_ID,
|
||||
|
@ -19,7 +23,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
||||
from homeassistant.helpers.entity import async_generate_entity_id
|
||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
|
@ -108,7 +112,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors)
|
||||
|
||||
|
||||
class LaCrosseSensor(Entity):
|
||||
class LaCrosseSensor(SensorEntity):
|
||||
"""Implementation of a Lacrosse sensor."""
|
||||
|
||||
_temperature = None
|
||||
|
|
|
@ -7,10 +7,9 @@ import pylast as lastfm
|
|||
from pylast import WSError
|
||||
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
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -52,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(entities, True)
|
||||
|
||||
|
||||
class LastfmSensor(Entity):
|
||||
class LastfmSensor(SensorEntity):
|
||||
"""A class for the Last.fm account."""
|
||||
|
||||
def __init__(self, user, lastfm_api):
|
||||
|
|
|
@ -7,11 +7,10 @@ import logging
|
|||
from pylaunches import PyLaunches, PyLaunchesException
|
||||
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
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import (
|
||||
ATTR_AGENCY,
|
||||
|
@ -40,7 +39,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities([LaunchLibrarySensor(launches, name)], True)
|
||||
|
||||
|
||||
class LaunchLibrarySensor(Entity):
|
||||
class LaunchLibrarySensor(SensorEntity):
|
||||
"""Representation of a launch_library Sensor."""
|
||||
|
||||
def __init__(self, launches: PyLaunches, name: str) -> None:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import pypck
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN as DOMAIN_SENSOR
|
||||
from homeassistant.components.sensor import DOMAIN as DOMAIN_SENSOR, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_ADDRESS,
|
||||
CONF_DOMAIN,
|
||||
|
@ -51,7 +51,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class LcnVariableSensor(LcnEntity):
|
||||
class LcnVariableSensor(LcnEntity, SensorEntity):
|
||||
"""Representation of a LCN sensor for variables."""
|
||||
|
||||
def __init__(self, config, entry_id, device_connection):
|
||||
|
@ -99,7 +99,7 @@ class LcnVariableSensor(LcnEntity):
|
|||
self.async_write_ha_state()
|
||||
|
||||
|
||||
class LcnLedLogicSensor(LcnEntity):
|
||||
class LcnLedLogicSensor(LcnEntity, SensorEntity):
|
||||
"""Representation of a LCN sensor for leds and logicops."""
|
||||
|
||||
def __init__(self, config, entry_id, device_connection):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Support for LightwaveRF TRV - Associated Battery."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_NAME, DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import CONF_SERIAL, LIGHTWAVE_LINK
|
||||
|
||||
|
@ -22,7 +22,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(batteries)
|
||||
|
||||
|
||||
class LightwaveBattery(Entity):
|
||||
class LightwaveBattery(SensorEntity):
|
||||
"""Lightwave TRV Battery."""
|
||||
|
||||
def __init__(self, name, lwlink, serial):
|
||||
|
|
|
@ -5,10 +5,9 @@ import os
|
|||
from batinfo import Batteries
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_NAME, CONF_NAME, DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -68,7 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([LinuxBatterySensor(name, battery_id, system)], True)
|
||||
|
||||
|
||||
class LinuxBatterySensor(Entity):
|
||||
class LinuxBatterySensor(SensorEntity):
|
||||
"""Representation of a Linux Battery sensor."""
|
||||
|
||||
def __init__(self, name, battery_id, system):
|
||||
|
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
|
||||
from pylitterbot.robot import Robot
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, PERCENTAGE
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN
|
||||
from .hub import LitterRobotEntity, LitterRobotHub
|
||||
|
@ -21,7 +21,7 @@ def icon_for_gauge_level(gauge_level: int | None = None, offset: int = 0) -> str
|
|||
return "mdi:gauge-low"
|
||||
|
||||
|
||||
class LitterRobotPropertySensor(LitterRobotEntity, Entity):
|
||||
class LitterRobotPropertySensor(LitterRobotEntity, SensorEntity):
|
||||
"""Litter-Robot property sensors."""
|
||||
|
||||
def __init__(
|
||||
|
@ -37,7 +37,7 @@ class LitterRobotPropertySensor(LitterRobotEntity, Entity):
|
|||
return getattr(self.robot, self.sensor_attribute)
|
||||
|
||||
|
||||
class LitterRobotWasteSensor(LitterRobotPropertySensor, Entity):
|
||||
class LitterRobotWasteSensor(LitterRobotPropertySensor):
|
||||
"""Litter-Robot sensors."""
|
||||
|
||||
@property
|
||||
|
@ -51,7 +51,7 @@ class LitterRobotWasteSensor(LitterRobotPropertySensor, Entity):
|
|||
return icon_for_gauge_level(self.state, 10)
|
||||
|
||||
|
||||
class LitterRobotSleepTimeSensor(LitterRobotPropertySensor, Entity):
|
||||
class LitterRobotSleepTimeSensor(LitterRobotPropertySensor):
|
||||
"""Litter-Robot sleep time sensors."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Sensor platform for local_ip."""
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import get_local_ip
|
||||
|
||||
from .const import DOMAIN, SENSOR
|
||||
|
@ -13,7 +13,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities([IPSensor(name)], True)
|
||||
|
||||
|
||||
class IPSensor(Entity):
|
||||
class IPSensor(SensorEntity):
|
||||
"""A simple sensor."""
|
||||
|
||||
def __init__(self, name):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Support for Logi Circle sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_BATTERY_CHARGING,
|
||||
|
@ -9,7 +10,6 @@ from homeassistant.const import (
|
|||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
from homeassistant.util.dt import as_local
|
||||
|
||||
|
@ -42,7 +42,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class LogiSensor(Entity):
|
||||
class LogiSensor(SensorEntity):
|
||||
"""A sensor implementation for a Logi Circle camera."""
|
||||
|
||||
def __init__(self, camera, time_zone, sensor_type):
|
||||
|
|
|
@ -5,10 +5,9 @@ import logging
|
|||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import HTTP_OK
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -90,7 +89,7 @@ class APIData:
|
|||
self.data = parse_api_response(response.json())
|
||||
|
||||
|
||||
class AirSensor(Entity):
|
||||
class AirSensor(SensorEntity):
|
||||
"""Single authority air sensor."""
|
||||
|
||||
ICON = "mdi:cloud-outline"
|
||||
|
|
|
@ -4,10 +4,9 @@ from datetime import timedelta
|
|||
from london_tube_status import TubeData
|
||||
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
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
ATTRIBUTION = "Powered by TfL Open Data"
|
||||
|
||||
|
@ -51,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class LondonTubeSensor(Entity):
|
||||
class LondonTubeSensor(SensorEntity):
|
||||
"""Sensor that reads the status of a line from Tube Data."""
|
||||
|
||||
def __init__(self, name, data):
|
||||
|
|
|
@ -4,14 +4,13 @@ import logging
|
|||
import pyloopenergy
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_UNIT_SYSTEM_IMPERIAL,
|
||||
CONF_UNIT_SYSTEM_METRIC,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -82,7 +81,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors)
|
||||
|
||||
|
||||
class LoopEnergyDevice(Entity):
|
||||
class LoopEnergySensor(SensorEntity):
|
||||
"""Implementation of an Loop Energy base sensor."""
|
||||
|
||||
def __init__(self, controller):
|
||||
|
@ -116,7 +115,7 @@ class LoopEnergyDevice(Entity):
|
|||
self.schedule_update_ha_state(True)
|
||||
|
||||
|
||||
class LoopEnergyElec(LoopEnergyDevice):
|
||||
class LoopEnergyElec(LoopEnergySensor):
|
||||
"""Implementation of an Loop Energy Electricity sensor."""
|
||||
|
||||
def __init__(self, controller):
|
||||
|
@ -133,7 +132,7 @@ class LoopEnergyElec(LoopEnergyDevice):
|
|||
self._state = round(self._controller.electricity_useage, 2)
|
||||
|
||||
|
||||
class LoopEnergyGas(LoopEnergyDevice):
|
||||
class LoopEnergyGas(LoopEnergySensor):
|
||||
"""Implementation of an Loop Energy Gas sensor."""
|
||||
|
||||
def __init__(self, controller):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Support for Luftdaten sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_LATITUDE,
|
||||
|
@ -9,7 +10,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 (
|
||||
DATA_LUFTDATEN,
|
||||
|
@ -45,7 +45,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class LuftdatenSensor(Entity):
|
||||
class LuftdatenSensor(SensorEntity):
|
||||
"""Implementation of a Luftdaten sensor."""
|
||||
|
||||
def __init__(self, luftdaten, sensor_type, name, icon, unit, show):
|
||||
|
|
|
@ -7,10 +7,9 @@ from lyft_rides.client import LyftRidesClient
|
|||
from lyft_rides.errors import APIError
|
||||
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_CLIENT_SECRET, TIME_MINUTES
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -74,7 +73,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(dev, True)
|
||||
|
||||
|
||||
class LyftSensor(Entity):
|
||||
class LyftSensor(SensorEntity):
|
||||
"""Implementation of an Lyft sensor."""
|
||||
|
||||
def __init__(self, sensorType, products, product_id, product):
|
||||
|
|
|
@ -4,6 +4,7 @@ from datetime import datetime, timedelta
|
|||
from aiolyric.objects.device import LyricDevice
|
||||
from aiolyric.objects.location import LyricLocation
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
|
@ -67,7 +68,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class LyricSensor(LyricDeviceEntity):
|
||||
class LyricSensor(LyricDeviceEntity, SensorEntity):
|
||||
"""Defines a Honeywell Lyric sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import magicseaweed
|
||||
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,
|
||||
|
@ -13,7 +13,6 @@ from homeassistant.const import (
|
|||
CONF_NAME,
|
||||
)
|
||||
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
|
||||
|
||||
|
@ -90,7 +89,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class MagicSeaweedSensor(Entity):
|
||||
class MagicSeaweedSensor(SensorEntity):
|
||||
"""Implementation of a MagicSeaweed sensor."""
|
||||
|
||||
def __init__(self, forecast_data, sensor_type, name, unit_system, hour=None):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Platform for Mazda sensor integration."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_UNIT_SYSTEM_IMPERIAL,
|
||||
LENGTH_KILOMETERS,
|
||||
|
@ -29,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class MazdaFuelRemainingSensor(MazdaEntity):
|
||||
class MazdaFuelRemainingSensor(MazdaEntity, SensorEntity):
|
||||
"""Class for the fuel remaining sensor."""
|
||||
|
||||
@property
|
||||
|
@ -59,7 +60,7 @@ class MazdaFuelRemainingSensor(MazdaEntity):
|
|||
return self.coordinator.data[self.index]["status"]["fuelRemainingPercent"]
|
||||
|
||||
|
||||
class MazdaFuelDistanceSensor(MazdaEntity):
|
||||
class MazdaFuelDistanceSensor(MazdaEntity, SensorEntity):
|
||||
"""Class for the fuel distance sensor."""
|
||||
|
||||
@property
|
||||
|
@ -100,7 +101,7 @@ class MazdaFuelDistanceSensor(MazdaEntity):
|
|||
)
|
||||
|
||||
|
||||
class MazdaOdometerSensor(MazdaEntity):
|
||||
class MazdaOdometerSensor(MazdaEntity, SensorEntity):
|
||||
"""Class for the odometer sensor."""
|
||||
|
||||
@property
|
||||
|
@ -137,7 +138,7 @@ class MazdaOdometerSensor(MazdaEntity):
|
|||
)
|
||||
|
||||
|
||||
class MazdaFrontLeftTirePressureSensor(MazdaEntity):
|
||||
class MazdaFrontLeftTirePressureSensor(MazdaEntity, SensorEntity):
|
||||
"""Class for the front left tire pressure sensor."""
|
||||
|
||||
@property
|
||||
|
@ -170,7 +171,7 @@ class MazdaFrontLeftTirePressureSensor(MazdaEntity):
|
|||
return None if tire_pressure is None else round(tire_pressure)
|
||||
|
||||
|
||||
class MazdaFrontRightTirePressureSensor(MazdaEntity):
|
||||
class MazdaFrontRightTirePressureSensor(MazdaEntity, SensorEntity):
|
||||
"""Class for the front right tire pressure sensor."""
|
||||
|
||||
@property
|
||||
|
@ -203,7 +204,7 @@ class MazdaFrontRightTirePressureSensor(MazdaEntity):
|
|||
return None if tire_pressure is None else round(tire_pressure)
|
||||
|
||||
|
||||
class MazdaRearLeftTirePressureSensor(MazdaEntity):
|
||||
class MazdaRearLeftTirePressureSensor(MazdaEntity, SensorEntity):
|
||||
"""Class for the rear left tire pressure sensor."""
|
||||
|
||||
@property
|
||||
|
@ -236,7 +237,7 @@ class MazdaRearLeftTirePressureSensor(MazdaEntity):
|
|||
return None if tire_pressure is None else round(tire_pressure)
|
||||
|
||||
|
||||
class MazdaRearRightTirePressureSensor(MazdaEntity):
|
||||
class MazdaRearRightTirePressureSensor(MazdaEntity, SensorEntity):
|
||||
"""Class for the rear right tire pressure sensor."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from pymelcloud import DEVICE_TYPE_ATA, DEVICE_TYPE_ATW
|
||||
from pymelcloud.atw_device import Zone
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
ATTR_ICON,
|
||||
|
@ -9,7 +10,6 @@ from homeassistant.const import (
|
|||
ENERGY_KILO_WATT_HOUR,
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import MelCloudDevice
|
||||
from .const import DOMAIN
|
||||
|
@ -110,7 +110,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
)
|
||||
|
||||
|
||||
class MelDeviceSensor(Entity):
|
||||
class MelDeviceSensor(SensorEntity):
|
||||
"""Representation of a Sensor."""
|
||||
|
||||
def __init__(self, api: MelCloudDevice, measurement, definition):
|
||||
|
|
|
@ -6,6 +6,7 @@ from meteofrance_api.helpers import (
|
|||
readeable_phenomenoms_dict,
|
||||
)
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
@ -74,7 +75,7 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class MeteoFranceSensor(CoordinatorEntity):
|
||||
class MeteoFranceSensor(CoordinatorEntity, SensorEntity):
|
||||
"""Representation of a Meteo-France sensor."""
|
||||
|
||||
def __init__(self, sensor_type: str, coordinator: DataUpdateCoordinator):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
"""Support for UK Met Office weather service."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
|
@ -10,7 +11,6 @@ from homeassistant.const import (
|
|||
UV_INDEX,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
|
||||
from .const import (
|
||||
|
@ -92,7 +92,7 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class MetOfficeCurrentSensor(Entity):
|
||||
class MetOfficeCurrentSensor(SensorEntity):
|
||||
"""Implementation of a Met Office current weather condition sensor."""
|
||||
|
||||
def __init__(self, entry_data, hass_data, sensor_type):
|
||||
|
|
|
@ -5,7 +5,7 @@ from mficlient.client import FailedToLogin, MFiClient
|
|||
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_HOST,
|
||||
CONF_PASSWORD,
|
||||
|
@ -18,7 +18,6 @@ from homeassistant.const import (
|
|||
TEMP_CELSIUS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -74,7 +73,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
)
|
||||
|
||||
|
||||
class MfiSensor(Entity):
|
||||
class MfiSensor(SensorEntity):
|
||||
"""Representation of a mFi sensor."""
|
||||
|
||||
def __init__(self, port, hass):
|
||||
|
|
|
@ -5,7 +5,7 @@ import logging
|
|||
from pmsensor import co2sensor
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_TEMPERATURE,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
|
@ -14,7 +14,6 @@ from homeassistant.const import (
|
|||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
from homeassistant.util.temperature import celsius_to_fahrenheit
|
||||
|
||||
|
@ -69,7 +68,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
return True
|
||||
|
||||
|
||||
class MHZ19Sensor(Entity):
|
||||
class MHZ19Sensor(SensorEntity):
|
||||
"""Representation of an CO2 sensor."""
|
||||
|
||||
def __init__(self, mhz_client, sensor_type, temp_unit, name):
|
||||
|
|
|
@ -8,7 +8,7 @@ from btlewrap import BluetoothBackendException
|
|||
from miflora import miflora_poller
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONDUCTIVITY,
|
||||
CONF_FORCE_UPDATE,
|
||||
|
@ -27,7 +27,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util.temperature import celsius_to_fahrenheit
|
||||
|
||||
|
@ -130,7 +129,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(devs)
|
||||
|
||||
|
||||
class MiFloraSensor(Entity):
|
||||
class MiFloraSensor(SensorEntity):
|
||||
"""Implementing the MiFlora sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CONF_NAME,
|
||||
|
@ -13,7 +13,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_state_change_event
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
|
||||
|
@ -131,7 +130,7 @@ def calc_median(sensor_values, round_digits):
|
|||
return round(median, round_digits)
|
||||
|
||||
|
||||
class MinMaxSensor(Entity):
|
||||
class MinMaxSensor(SensorEntity):
|
||||
"""Representation of a min/max sensor."""
|
||||
|
||||
def __init__(self, entity_ids, name, sensor_type, round_digits):
|
||||
|
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TIME_MILLISECONDS
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
@ -47,7 +48,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class MinecraftServerSensorEntity(MinecraftServerEntity):
|
||||
class MinecraftServerSensorEntity(MinecraftServerEntity, SensorEntity):
|
||||
"""Representation of a Minecraft Server sensor base entity."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -6,7 +6,7 @@ from btlewrap.base import BluetoothBackendException
|
|||
from mitemp_bt import mitemp_bt_poller
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_FORCE_UPDATE,
|
||||
CONF_MAC,
|
||||
|
@ -20,7 +20,6 @@ from homeassistant.const import (
|
|||
TEMP_CELSIUS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
try:
|
||||
import bluepy.btle # noqa: F401 pylint: disable=unused-import
|
||||
|
@ -104,7 +103,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(devs)
|
||||
|
||||
|
||||
class MiTempBtSensor(Entity):
|
||||
class MiTempBtSensor(SensorEntity):
|
||||
"""Implementing the MiTempBt sensor."""
|
||||
|
||||
def __init__(self, poller, parameter, device, name, unit, force_update, median):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Sensor platform for mobile_app."""
|
||||
from functools import partial
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_UNIQUE_ID, CONF_WEBHOOK_ID
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
@ -71,7 +72,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
)
|
||||
|
||||
|
||||
class MobileAppSensor(MobileAppEntity):
|
||||
class MobileAppSensor(MobileAppEntity, SensorEntity):
|
||||
"""Representation of an mobile app sensor."""
|
||||
|
||||
@property
|
||||
|
|
|
@ -9,7 +9,11 @@ from pymodbus.exceptions import ConnectionException, ModbusException
|
|||
from pymodbus.pdu import ExceptionResponse
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import (
|
||||
DEVICE_CLASSES_SCHEMA,
|
||||
PLATFORM_SCHEMA,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_NAME,
|
||||
|
@ -158,7 +162,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors)
|
||||
|
||||
|
||||
class ModbusRegisterSensor(RestoreEntity):
|
||||
class ModbusRegisterSensor(RestoreEntity, SensorEntity):
|
||||
"""Modbus register sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
from basicmodem.basicmodem import BasicModem as bm
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
CONF_NAME,
|
||||
|
@ -12,7 +12,6 @@ from homeassistant.const import (
|
|||
STATE_IDLE,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
DEFAULT_NAME = "Modem CallerID"
|
||||
|
@ -44,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities([ModemCalleridSensor(hass, name, port, modem)])
|
||||
|
||||
|
||||
class ModemCalleridSensor(Entity):
|
||||
class ModemCalleridSensor(SensorEntity):
|
||||
"""Implementation of USB modem caller ID sensor."""
|
||||
|
||||
def __init__(self, hass, name, port, modem):
|
||||
|
|
|
@ -5,7 +5,7 @@ import math
|
|||
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 (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CONF_NAME,
|
||||
|
@ -17,7 +17,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_state_change_event
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -69,7 +68,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
)
|
||||
|
||||
|
||||
class MoldIndicator(Entity):
|
||||
class MoldIndicator(SensorEntity):
|
||||
"""Represents a MoldIndication sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
from astral import Astral
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
DEFAULT_NAME = "Moon"
|
||||
|
@ -42,7 +41,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities([MoonSensor(name)], True)
|
||||
|
||||
|
||||
class MoonSensor(Entity):
|
||||
class MoonSensor(SensorEntity):
|
||||
"""Representation of a Moon sensor."""
|
||||
|
||||
def __init__(self, name):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
"""Support for Motion Blinds sensors."""
|
||||
from motionblinds import BlindType
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_BATTERY,
|
||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN, KEY_COORDINATOR, KEY_GATEWAY
|
||||
|
@ -39,7 +39,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class MotionBatterySensor(CoordinatorEntity, Entity):
|
||||
class MotionBatterySensor(CoordinatorEntity, SensorEntity):
|
||||
"""
|
||||
Representation of a Motion Battery Sensor.
|
||||
|
||||
|
@ -144,7 +144,7 @@ class MotionTDBUBatterySensor(MotionBatterySensor):
|
|||
return attributes
|
||||
|
||||
|
||||
class MotionSignalStrengthSensor(CoordinatorEntity, Entity):
|
||||
class MotionSignalStrengthSensor(CoordinatorEntity, SensorEntity):
|
||||
"""Representation of a Motion Signal Strength Sensor."""
|
||||
|
||||
def __init__(self, coordinator, device, device_type):
|
||||
|
|
|
@ -7,7 +7,7 @@ import functools
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import sensor
|
||||
from homeassistant.components.sensor import DEVICE_CLASSES_SCHEMA
|
||||
from homeassistant.components.sensor import DEVICE_CLASSES_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_FORCE_UPDATE,
|
||||
|
@ -17,7 +17,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||
from homeassistant.helpers.reload import async_setup_reload_service
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
|
@ -71,7 +70,7 @@ async def _async_setup_entity(
|
|||
async_add_entities([MqttSensor(hass, config, config_entry, discovery_data)])
|
||||
|
||||
|
||||
class MqttSensor(MqttEntity, Entity):
|
||||
class MqttSensor(MqttEntity, SensorEntity):
|
||||
"""Representation of a sensor that can be updated using MQTT."""
|
||||
|
||||
def __init__(self, hass, config, config_entry, discovery_data):
|
||||
|
|
|
@ -7,7 +7,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components import mqtt
|
||||
from homeassistant.components.mqtt import CONF_STATE_TOPIC
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_ID,
|
||||
ATTR_ID,
|
||||
|
@ -18,7 +18,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import dt, slugify
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -71,7 +70,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
)
|
||||
|
||||
|
||||
class MQTTRoomSensor(Entity):
|
||||
class MQTTRoomSensor(SensorEntity):
|
||||
"""Representation of a room sensor that is updated via MQTT."""
|
||||
|
||||
def __init__(self, name, state_topic, device_id, timeout, consider_home):
|
||||
|
|
|
@ -6,10 +6,9 @@ import logging
|
|||
import MVGLive
|
||||
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
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -78,7 +77,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class MVGLiveSensor(Entity):
|
||||
class MVGLiveSensor(SensorEntity):
|
||||
"""Implementation of an MVG Live sensor."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
"""Support for MyChevy sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorEntity
|
||||
from homeassistant.const import PERCENTAGE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
from homeassistant.util import slugify
|
||||
|
||||
|
@ -46,7 +45,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities(sensors)
|
||||
|
||||
|
||||
class MyChevyStatus(Entity):
|
||||
class MyChevyStatus(SensorEntity):
|
||||
"""A string representing the charge mode."""
|
||||
|
||||
_name = "MyChevy Status"
|
||||
|
@ -109,7 +108,7 @@ class MyChevyStatus(Entity):
|
|||
return False
|
||||
|
||||
|
||||
class EVSensor(Entity):
|
||||
class EVSensor(SensorEntity):
|
||||
"""Base EVSensor class.
|
||||
|
||||
The only real difference between sensors is which units and what
|
||||
|
|
|
@ -4,7 +4,7 @@ from typing import Callable
|
|||
from homeassistant.components import mysensors
|
||||
from homeassistant.components.mysensors import on_unload
|
||||
from homeassistant.components.mysensors.const import MYSENSORS_DISCOVERY
|
||||
from homeassistant.components.sensor import DOMAIN
|
||||
from homeassistant.components.sensor import DOMAIN, SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONDUCTIVITY,
|
||||
|
@ -87,7 +87,7 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class MySensorsSensor(mysensors.device.MySensorsEntity):
|
||||
class MySensorsSensor(mysensors.device.MySensorsEntity, SensorEntity):
|
||||
"""Representation of a MySensors Sensor child node."""
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Reference in a new issue