mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Migrate integrations r-s to extend SensorEntity (#48215)
This commit is contained in:
parent
0c086b5067
commit
64bc9a8196
@ -7,7 +7,7 @@ from pytz import timezone
|
||||
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_API_KEY,
|
||||
CONF_HOST,
|
||||
@ -26,7 +26,6 @@ from homeassistant.const import (
|
||||
HTTP_OK,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -95,7 +94,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities([RadarrSensor(hass, config, sensor) for sensor in conditions], True)
|
||||
|
||||
|
||||
class RadarrSensor(Entity):
|
||||
class RadarrSensor(SensorEntity):
|
||||
"""Implementation of the Radarr sensor."""
|
||||
|
||||
def __init__(self, hass, conf, sensor_type):
|
||||
|
@ -3,7 +3,7 @@ import logging
|
||||
|
||||
from pyrainbird import RainbirdController
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
|
||||
from . import (
|
||||
DATA_RAINBIRD,
|
||||
@ -28,7 +28,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
)
|
||||
|
||||
|
||||
class RainBirdSensor(Entity):
|
||||
class RainBirdSensor(SensorEntity):
|
||||
"""A sensor implementation for Rain Bird device."""
|
||||
|
||||
def __init__(self, controller: RainbirdController, sensor_type):
|
||||
|
@ -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 CONF_MONITORED_CONDITIONS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
return True
|
||||
|
||||
|
||||
class RainCloudSensor(RainCloudEntity):
|
||||
class RainCloudSensor(RainCloudEntity, SensorEntity):
|
||||
"""A sensor implementation for raincloud device."""
|
||||
|
||||
@property
|
||||
|
@ -7,14 +7,13 @@ from requests.exceptions import ConnectionError as ConnectError, HTTPError, Time
|
||||
from uEagle import Eagle as LegacyReader
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_IP_ADDRESS,
|
||||
DEVICE_CLASS_POWER,
|
||||
ENERGY_KILO_WATT_HOUR,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
CONF_CLOUD_ID = "cloud_id"
|
||||
@ -95,7 +94,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(sensors)
|
||||
|
||||
|
||||
class EagleSensor(Entity):
|
||||
class EagleSensor(SensorEntity):
|
||||
"""Implementation of the Rainforest Eagle-200 sensor."""
|
||||
|
||||
def __init__(self, eagle_data, sensor_type, name, unit):
|
||||
@ -160,7 +159,7 @@ class EagleData:
|
||||
return state
|
||||
|
||||
|
||||
class LeagleReader(LegacyReader):
|
||||
class LeagleReader(LegacyReader, SensorEntity):
|
||||
"""Wraps uEagle to make it behave like eagle_reader, offering update()."""
|
||||
|
||||
def update(self):
|
||||
|
@ -4,6 +4,7 @@ from typing import Callable
|
||||
|
||||
from regenmaschine.controller import Controller
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TEMP_CELSIUS, VOLUME_CUBIC_METERS
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@ -108,7 +109,7 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
class RainMachineSensor(RainMachineEntity):
|
||||
class RainMachineSensor(RainMachineEntity, SensorEntity):
|
||||
"""Define a general RainMachine sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -3,7 +3,7 @@ from random import randrange
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MAXIMUM,
|
||||
CONF_MINIMUM,
|
||||
@ -11,7 +11,6 @@ from homeassistant.const import (
|
||||
CONF_UNIT_OF_MEASUREMENT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
ATTR_MAXIMUM = "maximum"
|
||||
ATTR_MINIMUM = "minimum"
|
||||
@ -42,7 +41,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities([RandomSensor(name, minimum, maximum, unit)], True)
|
||||
|
||||
|
||||
class RandomSensor(Entity):
|
||||
class RandomSensor(SensorEntity):
|
||||
"""Representation of a Random number sensor."""
|
||||
|
||||
def __init__(self, name, minimum, maximum, unit_of_measurement):
|
||||
|
@ -6,7 +6,7 @@ from typing import Callable
|
||||
from aiorecollect.client import PickupType
|
||||
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.const import ATTR_ATTRIBUTION, CONF_FRIENDLY_NAME, CONF_NAME
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@ -77,7 +77,7 @@ async def async_setup_entry(
|
||||
async_add_entities([ReCollectWasteSensor(coordinator, entry)])
|
||||
|
||||
|
||||
class ReCollectWasteSensor(CoordinatorEntity):
|
||||
class ReCollectWasteSensor(CoordinatorEntity, SensorEntity):
|
||||
"""ReCollect Waste Sensor."""
|
||||
|
||||
def __init__(self, coordinator: DataUpdateCoordinator, entry: ConfigEntry) -> None:
|
||||
|
@ -5,7 +5,7 @@ import logging
|
||||
import praw
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ID,
|
||||
CONF_CLIENT_ID,
|
||||
@ -15,7 +15,6 @@ from homeassistant.const import (
|
||||
CONF_USERNAME,
|
||||
)
|
||||
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, True)
|
||||
|
||||
|
||||
class RedditSensor(Entity):
|
||||
class RedditSensor(SensorEntity):
|
||||
"""Representation of a Reddit sensor."""
|
||||
|
||||
def __init__(self, reddit, subreddit: str, limit: int, sort_by: str):
|
||||
|
@ -11,10 +11,9 @@ from operator import itemgetter
|
||||
import rjpl
|
||||
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
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -87,7 +86,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
)
|
||||
|
||||
|
||||
class RejseplanenTransportSensor(Entity):
|
||||
class RejseplanenTransportSensor(SensorEntity):
|
||||
"""Implementation of Rejseplanen transport sensor."""
|
||||
|
||||
def __init__(self, data, stop_id, route, direction, name):
|
||||
|
@ -3,10 +3,10 @@ from datetime import datetime
|
||||
import logging
|
||||
import time
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import REPETIER_API, SENSOR_TYPES, UPDATE_SIGNAL
|
||||
|
||||
@ -46,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(entities, True)
|
||||
|
||||
|
||||
class RepetierSensor(Entity):
|
||||
class RepetierSensor(SensorEntity):
|
||||
"""Class to create and populate a Repetier Sensor."""
|
||||
|
||||
def __init__(self, api, temp_id, name, printer_id, sensor_type):
|
||||
|
@ -7,7 +7,11 @@ from jsonpath import jsonpath
|
||||
import voluptuous as vol
|
||||
import xmltodict
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import (
|
||||
DOMAIN as SENSOR_DOMAIN,
|
||||
PLATFORM_SCHEMA,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_FORCE_UPDATE,
|
||||
@ -81,7 +85,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
)
|
||||
|
||||
|
||||
class RestSensor(RestEntity):
|
||||
class RestSensor(RestEntity, SensorEntity):
|
||||
"""Implementation of a REST sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -2,7 +2,7 @@
|
||||
from rflink.parser import PACKET_FIELDS, UNITS
|
||||
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_DEVICES,
|
||||
@ -98,7 +98,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
hass.data[DATA_DEVICE_REGISTER][EVENT_KEY_SENSOR] = add_new_device
|
||||
|
||||
|
||||
class RflinkSensor(RflinkDevice):
|
||||
class RflinkSensor(RflinkDevice, SensorEntity):
|
||||
"""Representation of a Rflink sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -8,6 +8,7 @@ from homeassistant.components.sensor import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICES,
|
||||
@ -129,7 +130,7 @@ async def async_setup_entry(
|
||||
connect_auto_add(hass, discovery_info, sensor_update)
|
||||
|
||||
|
||||
class RfxtrxSensor(RfxtrxEntity):
|
||||
class RfxtrxSensor(RfxtrxEntity, SensorEntity):
|
||||
"""Representation of a RFXtrx sensor."""
|
||||
|
||||
def __init__(self, device, device_id, data_type, event=None):
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""This component provides HA sensor support for Ring Door Bell/Chimes."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import PERCENTAGE, SIGNAL_STRENGTH_DECIBELS_MILLIWATT
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
|
||||
from . import DOMAIN
|
||||
@ -32,7 +32,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class RingSensor(RingEntityMixin, Entity):
|
||||
class RingSensor(RingEntityMixin, SensorEntity):
|
||||
"""A sensor implementation for Ring device."""
|
||||
|
||||
def __init__(self, config_entry_id, device, sensor_type):
|
||||
|
@ -4,10 +4,9 @@ from datetime import timedelta
|
||||
from pyripple import get_balance
|
||||
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
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
ATTRIBUTION = "Data provided by ripple.com"
|
||||
|
||||
@ -31,7 +30,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities([RippleSensor(name, address)], True)
|
||||
|
||||
|
||||
class RippleSensor(Entity):
|
||||
class RippleSensor(SensorEntity):
|
||||
"""Representation of an Ripple.com sensor."""
|
||||
|
||||
def __init__(self, name, address):
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""Sensor for Risco Events."""
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BS_DOMAIN
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
@ -42,7 +43,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class RiscoSensor(CoordinatorEntity):
|
||||
class RiscoSensor(CoordinatorEntity, SensorEntity):
|
||||
"""Sensor for Risco events."""
|
||||
|
||||
def __init__(self, coordinator, category_id, excludes, name, entry_id) -> None:
|
||||
|
@ -10,11 +10,10 @@ from RMVtransport.rmvtransport import (
|
||||
)
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME, CONF_TIMEOUT, TIME_MINUTES
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -104,7 +103,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class RMVDepartureSensor(Entity):
|
||||
class RMVDepartureSensor(SensorEntity):
|
||||
"""Implementation of an RMV departure sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Sensor for checking the battery level of Roomba."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.components.vacuum import STATE_DOCKED
|
||||
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
@ -16,7 +17,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities([roomba_vac], True)
|
||||
|
||||
|
||||
class RoombaBattery(IRobotEntity):
|
||||
class RoombaBattery(IRobotEntity, SensorEntity):
|
||||
"""Class to hold Roomba Sensor basic info."""
|
||||
|
||||
@property
|
||||
|
@ -7,14 +7,13 @@ from requests.exceptions import ConnectTimeout, HTTPError
|
||||
from rova.rova import Rova
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
CONF_NAME,
|
||||
DEVICE_CLASS_TIMESTAMP,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
# Config for rova requests.
|
||||
@ -80,7 +79,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(entities, True)
|
||||
|
||||
|
||||
class RovaSensor(Entity):
|
||||
class RovaSensor(SensorEntity):
|
||||
"""Representation of a Rova sensor."""
|
||||
|
||||
def __init__(self, platform_name, sensor_key, data_service):
|
||||
|
@ -4,7 +4,7 @@ import xmlrpc.client
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MONITORED_VARIABLES,
|
||||
CONF_NAME,
|
||||
@ -14,7 +14,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__)
|
||||
|
||||
@ -75,7 +74,7 @@ def format_speed(speed):
|
||||
return round(kb_spd, 2 if kb_spd < 0.1 else 1)
|
||||
|
||||
|
||||
class RTorrentSensor(Entity):
|
||||
class RTorrentSensor(SensorEntity):
|
||||
"""Representation of an rtorrent sensor."""
|
||||
|
||||
def __init__(self, sensor_type, rtorrent_client, client_name):
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Support for monitoring an SABnzbd NZB client."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import DATA_SABNZBD, SENSOR_TYPES, SIGNAL_SABNZBD_UPDATED
|
||||
|
||||
@ -18,7 +18,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
)
|
||||
|
||||
|
||||
class SabnzbdSensor(Entity):
|
||||
class SabnzbdSensor(SensorEntity):
|
||||
"""Representation of an SABnzbd sensor."""
|
||||
|
||||
def __init__(self, sensor_type, sabnzbd_api_data, client_name):
|
||||
|
@ -5,7 +5,7 @@ import logging
|
||||
import pysaj
|
||||
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,
|
||||
@ -26,7 +26,6 @@ from homeassistant.const import (
|
||||
from homeassistant.core import CALLBACK_TYPE, callback
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -160,7 +159,7 @@ def async_track_time_interval_backoff(hass, action) -> CALLBACK_TYPE:
|
||||
return remove_listener
|
||||
|
||||
|
||||
class SAJsensor(Entity):
|
||||
class SAJsensor(SensorEntity):
|
||||
"""Representation of a SAJ sensor."""
|
||||
|
||||
def __init__(self, serialnumber, pysaj_sensor, inverter_name=None):
|
||||
|
@ -6,7 +6,7 @@ from requests.auth import HTTPBasicAuth, HTTPDigestAuth
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.rest.data import RestData
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_AUTHENTICATION,
|
||||
CONF_HEADERS,
|
||||
@ -22,7 +22,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__)
|
||||
|
||||
@ -89,7 +88,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
)
|
||||
|
||||
|
||||
class ScrapeSensor(Entity):
|
||||
class ScrapeSensor(SensorEntity):
|
||||
"""Representation of a web scrape sensor."""
|
||||
|
||||
def __init__(self, rest, name, select, attr, index, value_template, unit):
|
||||
|
@ -3,7 +3,11 @@ import logging
|
||||
|
||||
from screenlogicpy.const import DEVICE_TYPE
|
||||
|
||||
from homeassistant.components.sensor import DEVICE_CLASS_POWER, DEVICE_CLASS_TEMPERATURE
|
||||
from homeassistant.components.sensor import (
|
||||
DEVICE_CLASS_POWER,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
SensorEntity,
|
||||
)
|
||||
|
||||
from . import ScreenlogicEntity
|
||||
from .const import DOMAIN
|
||||
@ -34,7 +38,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class ScreenLogicSensor(ScreenlogicEntity):
|
||||
class ScreenLogicSensor(ScreenlogicEntity, SensorEntity):
|
||||
"""Representation of a ScreenLogic sensor entity."""
|
||||
|
||||
@property
|
||||
@ -65,7 +69,7 @@ class ScreenLogicSensor(ScreenlogicEntity):
|
||||
return self.coordinator.data["sensors"][self._data_key]
|
||||
|
||||
|
||||
class ScreenLogicPumpSensor(ScreenlogicEntity):
|
||||
class ScreenLogicPumpSensor(ScreenlogicEntity, SensorEntity):
|
||||
"""Representation of a ScreenLogic pump sensor entity."""
|
||||
|
||||
def __init__(self, coordinator, pump, key):
|
||||
|
@ -6,10 +6,9 @@ import ephem
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import util
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_TYPE
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -109,7 +108,7 @@ def get_season(date, hemisphere, season_tracking_type):
|
||||
return HEMISPHERE_SEASON_SWAP.get(season)
|
||||
|
||||
|
||||
class Season(Entity):
|
||||
class Season(SensorEntity):
|
||||
"""Representation of the current season."""
|
||||
|
||||
def __init__(self, hass, hemisphere, season_tracking_type, name):
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Support for monitoring a Sense energy sensor."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
DEVICE_CLASS_POWER,
|
||||
@ -8,7 +9,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 (
|
||||
ACTIVE_NAME,
|
||||
@ -118,7 +118,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(devices)
|
||||
|
||||
|
||||
class SenseActiveSensor(Entity):
|
||||
class SenseActiveSensor(SensorEntity):
|
||||
"""Implementation of a Sense energy sensor."""
|
||||
|
||||
def __init__(
|
||||
@ -207,7 +207,7 @@ class SenseActiveSensor(Entity):
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
||||
class SenseVoltageSensor(Entity):
|
||||
class SenseVoltageSensor(SensorEntity):
|
||||
"""Implementation of a Sense energy voltage sensor."""
|
||||
|
||||
def __init__(
|
||||
@ -287,7 +287,7 @@ class SenseVoltageSensor(Entity):
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
||||
class SenseTrendsSensor(Entity):
|
||||
class SenseTrendsSensor(SensorEntity):
|
||||
"""Implementation of a Sense energy sensor."""
|
||||
|
||||
def __init__(
|
||||
@ -370,7 +370,7 @@ class SenseTrendsSensor(Entity):
|
||||
self.async_on_remove(self._coordinator.async_add_listener(self._async_update))
|
||||
|
||||
|
||||
class SenseEnergyDevice(Entity):
|
||||
class SenseEnergyDevice(SensorEntity):
|
||||
"""Implementation of a Sense energy device."""
|
||||
|
||||
def __init__(self, sense_devices_data, device, sense_monitor_id):
|
||||
|
@ -6,7 +6,7 @@ from pathlib import Path
|
||||
from sense_hat import SenseHat
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_DISPLAY_OPTIONS,
|
||||
CONF_NAME,
|
||||
@ -14,7 +14,6 @@ from homeassistant.const import (
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -68,7 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(dev, True)
|
||||
|
||||
|
||||
class SenseHatSensor(Entity):
|
||||
class SenseHatSensor(SensorEntity):
|
||||
"""Representation of a Sense HAT sensor."""
|
||||
|
||||
def __init__(self, data, sensor_types):
|
||||
|
@ -7,11 +7,10 @@ from serial import SerialException
|
||||
import serial_asyncio
|
||||
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_VALUE_TEMPLATE, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -103,7 +102,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities([sensor], True)
|
||||
|
||||
|
||||
class SerialSensor(Entity):
|
||||
class SerialSensor(SensorEntity):
|
||||
"""Representation of a Serial sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -4,10 +4,9 @@ import logging
|
||||
from pmsensor import serial_pm as pm
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -56,7 +55,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(dev)
|
||||
|
||||
|
||||
class ParticulateMatterSensor(Entity):
|
||||
class ParticulateMatterSensor(SensorEntity):
|
||||
"""Representation of an Particulate matter sensor."""
|
||||
|
||||
def __init__(self, pmDataCollector, name, pmname):
|
||||
|
@ -6,7 +6,7 @@ from py17track import Client as SeventeenTrackClient
|
||||
from py17track.errors import SeventeenTrackError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
@ -16,7 +16,6 @@ from homeassistant.const import (
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
from homeassistant.util import Throttle, slugify
|
||||
|
||||
@ -95,7 +94,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
await data.async_update()
|
||||
|
||||
|
||||
class SeventeenTrackSummarySensor(Entity):
|
||||
class SeventeenTrackSummarySensor(SensorEntity):
|
||||
"""Define a summary sensor."""
|
||||
|
||||
def __init__(self, data, status, initial_state):
|
||||
@ -166,7 +165,7 @@ class SeventeenTrackSummarySensor(Entity):
|
||||
self._state = self._data.summary.get(self._status)
|
||||
|
||||
|
||||
class SeventeenTrackPackageSensor(Entity):
|
||||
class SeventeenTrackPackageSensor(SensorEntity):
|
||||
"""Define an individual package sensor."""
|
||||
|
||||
def __init__(self, data, package):
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""Sensor for Shelly."""
|
||||
from homeassistant.components import sensor
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
DEGREE,
|
||||
@ -203,7 +204,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
)
|
||||
|
||||
|
||||
class ShellySensor(ShellyBlockAttributeEntity):
|
||||
class ShellySensor(ShellyBlockAttributeEntity, SensorEntity):
|
||||
"""Represent a shelly sensor."""
|
||||
|
||||
@property
|
||||
@ -212,7 +213,7 @@ class ShellySensor(ShellyBlockAttributeEntity):
|
||||
return self.attribute_value
|
||||
|
||||
|
||||
class ShellyRestSensor(ShellyRestAttributeEntity):
|
||||
class ShellyRestSensor(ShellyRestAttributeEntity, SensorEntity):
|
||||
"""Represent a shelly REST sensor."""
|
||||
|
||||
@property
|
||||
@ -221,7 +222,7 @@ class ShellyRestSensor(ShellyRestAttributeEntity):
|
||||
return self.attribute_value
|
||||
|
||||
|
||||
class ShellySleepingSensor(ShellySleepingBlockAttributeEntity):
|
||||
class ShellySleepingSensor(ShellySleepingBlockAttributeEntity, SensorEntity):
|
||||
"""Represent a shelly sleeping sensor."""
|
||||
|
||||
@property
|
||||
|
@ -5,10 +5,9 @@ import logging
|
||||
import shodan
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -47,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities([ShodanSensor(data, name)], True)
|
||||
|
||||
|
||||
class ShodanSensor(Entity):
|
||||
class ShodanSensor(SensorEntity):
|
||||
"""Representation of the Shodan sensor."""
|
||||
|
||||
def __init__(self, data, name):
|
||||
|
@ -7,7 +7,7 @@ import math
|
||||
from Adafruit_SHT31 import SHT31
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
CONF_NAME,
|
||||
@ -16,7 +16,6 @@ from homeassistant.const import (
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.temperature import display_temp
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
@ -93,7 +92,7 @@ class SHTClient:
|
||||
self.humidity = humidity
|
||||
|
||||
|
||||
class SHTSensor(Entity):
|
||||
class SHTSensor(SensorEntity):
|
||||
"""An abstract SHTSensor, can be either temperature or humidity."""
|
||||
|
||||
def __init__(self, sensor, name):
|
||||
|
@ -7,10 +7,9 @@ from urllib.parse import urljoin
|
||||
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_NAME, HTTP_OK, HTTP_UNAUTHORIZED
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -109,7 +108,7 @@ class SigfoxAPI:
|
||||
return self._devices
|
||||
|
||||
|
||||
class SigfoxDevice(Entity):
|
||||
class SigfoxDevice(SensorEntity):
|
||||
"""Class for single sigfox device."""
|
||||
|
||||
def __init__(self, device_id, auth, name):
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Support for SimpliSafe freeze sensor."""
|
||||
from simplipy.entity import EntityTypes
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_FAHRENHEIT
|
||||
from homeassistant.core import callback
|
||||
|
||||
@ -25,7 +26,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class SimplisafeFreezeSensor(SimpliSafeBaseSensor):
|
||||
class SimplisafeFreezeSensor(SimpliSafeBaseSensor, SensorEntity):
|
||||
"""Define a SimpliSafe freeze sensor entity."""
|
||||
|
||||
def __init__(self, simplisafe, system, sensor):
|
||||
|
@ -5,10 +5,9 @@ from random import Random
|
||||
|
||||
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
|
||||
|
||||
CONF_AMP = "amplitude"
|
||||
@ -67,7 +66,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities([sensor], True)
|
||||
|
||||
|
||||
class SimulatedSensor(Entity):
|
||||
class SimulatedSensor(SensorEntity):
|
||||
"""Class for simulated sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -8,7 +8,7 @@ from pygatt.backends import Characteristic, GATTToolBackend
|
||||
from pygatt.exceptions import BLEError, NotConnectedError, NotificationTimeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_MAC,
|
||||
CONF_NAME,
|
||||
@ -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__)
|
||||
|
||||
@ -62,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
mon.start()
|
||||
|
||||
|
||||
class SkybeaconHumid(Entity):
|
||||
class SkybeaconHumid(SensorEntity):
|
||||
"""Representation of a Skybeacon humidity sensor."""
|
||||
|
||||
def __init__(self, name, mon):
|
||||
@ -91,7 +90,7 @@ class SkybeaconHumid(Entity):
|
||||
return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1}
|
||||
|
||||
|
||||
class SkybeaconTemp(Entity):
|
||||
class SkybeaconTemp(SensorEntity):
|
||||
"""Representation of a Skybeacon temperature sensor."""
|
||||
|
||||
def __init__(self, name, mon):
|
||||
@ -120,7 +119,7 @@ class SkybeaconTemp(Entity):
|
||||
return {ATTR_DEVICE: "SKYBEACON", ATTR_MODEL: 1}
|
||||
|
||||
|
||||
class Monitor(threading.Thread):
|
||||
class Monitor(threading.Thread, SensorEntity):
|
||||
"""Connection handling."""
|
||||
|
||||
def __init__(self, hass, mac, name):
|
||||
|
@ -3,7 +3,7 @@ from datetime import timedelta
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
@ -38,7 +38,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(sensors, True)
|
||||
|
||||
|
||||
class SkybellSensor(SkybellDevice):
|
||||
class SkybellSensor(SkybellDevice, SensorEntity):
|
||||
"""A sensor implementation for Skybell devices."""
|
||||
|
||||
def __init__(self, device, sensor_type):
|
||||
|
@ -1,4 +1,6 @@
|
||||
"""Support for SleepIQ sensors."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
|
||||
from . import SleepIQSensor
|
||||
from .const import DOMAIN, SENSOR_TYPES, SIDES, SLEEP_NUMBER
|
||||
|
||||
@ -21,7 +23,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(dev)
|
||||
|
||||
|
||||
class SleepNumberSensor(SleepIQSensor):
|
||||
class SleepNumberSensor(SleepIQSensor, SensorEntity):
|
||||
"""Implementation of a SleepIQ sensor."""
|
||||
|
||||
def __init__(self, sleepiq_data, bed_id, side):
|
||||
|
@ -5,7 +5,7 @@ import logging
|
||||
import pysma
|
||||
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,
|
||||
@ -19,7 +19,6 @@ from homeassistant.const import (
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -169,7 +168,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_track_time_interval(hass, async_sma, interval)
|
||||
|
||||
|
||||
class SMAsensor(Entity):
|
||||
class SMAsensor(SensorEntity):
|
||||
"""Representation of a SMA sensor."""
|
||||
|
||||
def __init__(self, pysma_sensor, sub_sensors):
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Support for monitoring a Smappee energy sensor."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_POWER, ENERGY_WATT_HOUR, POWER_WATT, VOLT
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
@ -239,7 +239,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class SmappeeSensor(Entity):
|
||||
class SmappeeSensor(SensorEntity):
|
||||
"""Implementation of a Smappee sensor."""
|
||||
|
||||
def __init__(self, smappee_base, service_location, sensor, attributes):
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Support for Smart Meter Texas sensors."""
|
||||
from smart_meter_texas import Meter
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_ADDRESS, ENERGY_KILO_WATT_HOUR
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
@ -29,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
)
|
||||
|
||||
|
||||
class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity):
|
||||
class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity, SensorEntity):
|
||||
"""Representation of an Smart Meter Texas sensor."""
|
||||
|
||||
def __init__(self, meter: Meter, coordinator: DataUpdateCoordinator):
|
||||
|
@ -6,6 +6,7 @@ from typing import Sequence
|
||||
|
||||
from pysmartthings import Attribute, Capability
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
AREA_SQUARE_METERS,
|
||||
CONCENTRATION_PARTS_PER_MILLION,
|
||||
@ -306,7 +307,7 @@ def get_capabilities(capabilities: Sequence[str]) -> Sequence[str] | None:
|
||||
]
|
||||
|
||||
|
||||
class SmartThingsSensor(SmartThingsEntity):
|
||||
class SmartThingsSensor(SmartThingsEntity, SensorEntity):
|
||||
"""Define a SmartThings Sensor."""
|
||||
|
||||
def __init__(
|
||||
@ -346,7 +347,7 @@ class SmartThingsSensor(SmartThingsEntity):
|
||||
return UNITS.get(unit, unit) if unit else self._default_unit
|
||||
|
||||
|
||||
class SmartThingsThreeAxisSensor(SmartThingsEntity):
|
||||
class SmartThingsThreeAxisSensor(SmartThingsEntity, SensorEntity):
|
||||
"""Define a SmartThings Three Axis Sensor."""
|
||||
|
||||
def __init__(self, device, index):
|
||||
|
@ -2,6 +2,8 @@
|
||||
from enum import Enum
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
|
||||
from .const import DOMAIN, SMARTTUB_CONTROLLER
|
||||
from .entity import SmartTubSensorBase
|
||||
|
||||
@ -44,7 +46,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class SmartTubSensor(SmartTubSensorBase):
|
||||
class SmartTubSensor(SmartTubSensorBase, SensorEntity):
|
||||
"""Generic class for SmartTub status sensors."""
|
||||
|
||||
@property
|
||||
|
@ -3,6 +3,7 @@
|
||||
import datetime as dt
|
||||
import logging
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
DEVICE_CLASS_TIMESTAMP,
|
||||
@ -10,7 +11,6 @@ from homeassistant.const import (
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from . import DOMAIN, SIGNAL_UPDATE_SMARTY
|
||||
@ -35,7 +35,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class SmartySensor(Entity):
|
||||
class SmartySensor(SensorEntity):
|
||||
"""Representation of a Smarty Sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -3,8 +3,8 @@ import logging
|
||||
|
||||
import gammu # pylint: disable=import-error
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_SIGNAL_STRENGTH, SIGNAL_STRENGTH_DECIBELS
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN, SMS_GATEWAY
|
||||
|
||||
@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class GSMSignalSensor(Entity):
|
||||
class GSMSignalSensor(SensorEntity):
|
||||
"""Implementation of a GSM Signal sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -15,7 +15,7 @@ from pysnmp.hlapi.asyncio import (
|
||||
)
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_NAME,
|
||||
@ -26,7 +26,6 @@ from homeassistant.const import (
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import (
|
||||
CONF_ACCEPT_ERRORS,
|
||||
@ -139,7 +138,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities([SnmpSensor(data, name, unit, value_template)], True)
|
||||
|
||||
|
||||
class SnmpSensor(Entity):
|
||||
class SnmpSensor(SensorEntity):
|
||||
"""Representation of a SNMP sensor."""
|
||||
|
||||
def __init__(self, data, name, unit_of_measurement, value_template):
|
||||
|
@ -4,11 +4,10 @@ from datetime import timedelta
|
||||
from pysochain import ChainSo
|
||||
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
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
ATTRIBUTION = "Data provided by chain.so"
|
||||
|
||||
@ -40,7 +39,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities([SochainSensor(name, network.upper(), chainso)], True)
|
||||
|
||||
|
||||
class SochainSensor(Entity):
|
||||
class SochainSensor(SensorEntity):
|
||||
"""Representation of a Sochain sensor."""
|
||||
|
||||
def __init__(self, name, unit_of_measurement, chainso):
|
||||
|
@ -5,10 +5,9 @@ import logging
|
||||
import socialbladeclient
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -42,7 +41,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities([social_blade])
|
||||
|
||||
|
||||
class SocialBladeSensor(Entity):
|
||||
class SocialBladeSensor(SensorEntity):
|
||||
"""Representation of a Social Blade Sensor."""
|
||||
|
||||
def __init__(self, case, name):
|
||||
|
@ -7,10 +7,10 @@ from requests.exceptions import ConnectTimeout, HTTPError
|
||||
import solaredge
|
||||
from stringcase import snakecase
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_API_KEY, DEVICE_CLASS_BATTERY, DEVICE_CLASS_POWER
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
@ -117,7 +117,7 @@ class SolarEdgeSensorFactory:
|
||||
return sensor_class(self.platform_name, sensor_key, service)
|
||||
|
||||
|
||||
class SolarEdgeSensor(CoordinatorEntity, Entity):
|
||||
class SolarEdgeSensor(CoordinatorEntity, SensorEntity):
|
||||
"""Abstract class for a solaredge sensor."""
|
||||
|
||||
def __init__(self, platform_name, sensor_key, data_service):
|
||||
|
@ -8,7 +8,7 @@ from requests.exceptions import ConnectTimeout, HTTPError
|
||||
from solaredge_local import SolarEdge
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_IP_ADDRESS,
|
||||
CONF_NAME,
|
||||
@ -21,7 +21,6 @@ from homeassistant.const import (
|
||||
VOLT,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
DOMAIN = "solaredge_local"
|
||||
@ -231,7 +230,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(entities, True)
|
||||
|
||||
|
||||
class SolarEdgeSensor(Entity):
|
||||
class SolarEdgeSensor(SensorEntity):
|
||||
"""Representation of an SolarEdge Monitoring API sensor."""
|
||||
|
||||
def __init__(self, platform_name, data, json_key, name, unit, icon, attr):
|
||||
|
@ -5,8 +5,8 @@ from urllib.parse import ParseResult, urlparse
|
||||
from requests.exceptions import HTTPError, Timeout
|
||||
from sunwatcher.solarlog.solarlog import SolarLog
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import CONF_HOST
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from .const import DOMAIN, SCAN_INTERVAL, SENSOR_TYPES
|
||||
@ -55,7 +55,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||
return True
|
||||
|
||||
|
||||
class SolarlogSensor(Entity):
|
||||
class SolarlogSensor(SensorEntity):
|
||||
"""Representation of a Sensor."""
|
||||
|
||||
def __init__(self, entry_id, device_name, sensor_key, data):
|
||||
|
@ -6,11 +6,10 @@ from solax import real_time_api
|
||||
from solax.inverter import InverterError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_IP_ADDRESS, CONF_PORT, TEMP_CELSIUS
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
|
||||
DEFAULT_PORT = 80
|
||||
@ -73,7 +72,7 @@ class RealTimeDataEndpoint:
|
||||
sensor.async_schedule_update_ha_state()
|
||||
|
||||
|
||||
class Inverter(Entity):
|
||||
class Inverter(SensorEntity):
|
||||
"""Class for a sensor."""
|
||||
|
||||
def __init__(self, uid, serial, key, unit):
|
||||
|
@ -4,8 +4,8 @@ import logging
|
||||
|
||||
from requests import RequestException
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from . import DEVICES, SomaEntity
|
||||
@ -26,7 +26,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
)
|
||||
|
||||
|
||||
class SomaSensor(SomaEntity, Entity):
|
||||
class SomaSensor(SomaEntity, SensorEntity):
|
||||
"""Representation of a Soma cover device."""
|
||||
|
||||
@property
|
||||
|
@ -3,6 +3,7 @@
|
||||
from pymfy.api.devices.category import Category
|
||||
from pymfy.api.devices.thermostat import Thermostat
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
|
||||
from . import SomfyEntity
|
||||
@ -26,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class SomfyThermostatBatterySensor(SomfyEntity):
|
||||
class SomfyThermostatBatterySensor(SomfyEntity, SensorEntity):
|
||||
"""Representation of a Somfy thermostat battery."""
|
||||
|
||||
def __init__(self, coordinator, device_id, api):
|
||||
|
@ -7,6 +7,7 @@ from typing import Any, Callable
|
||||
|
||||
from sonarr import Sonarr, SonarrConnectionError, SonarrError
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import DATA_GIGABYTES
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@ -65,7 +66,7 @@ def sonarr_exception_handler(func):
|
||||
return handler
|
||||
|
||||
|
||||
class SonarrSensor(SonarrEntity):
|
||||
class SonarrSensor(SonarrEntity, SensorEntity):
|
||||
"""Implementation of the Sonarr sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Support for Speedtest.net internet speed testing sensor."""
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
@ -30,7 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class SpeedtestSensor(CoordinatorEntity, RestoreEntity):
|
||||
class SpeedtestSensor(CoordinatorEntity, RestoreEntity, SensorEntity):
|
||||
"""Implementation of a speedtest.net sensor."""
|
||||
|
||||
def __init__(self, coordinator, sensor_type):
|
||||
|
@ -6,7 +6,7 @@ from datetime import timedelta
|
||||
import spotcrime
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_LATITUDE,
|
||||
@ -20,7 +20,6 @@ from homeassistant.const import (
|
||||
CONF_RADIUS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import slugify
|
||||
|
||||
CONF_DAYS = "days"
|
||||
@ -66,7 +65,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
)
|
||||
|
||||
|
||||
class SpotCrimeSensor(Entity):
|
||||
class SpotCrimeSensor(SensorEntity):
|
||||
"""Representation of a Spot Crime Sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -8,10 +8,9 @@ from sqlalchemy.orm import scoped_session, sessionmaker
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.recorder import CONF_DB_URL, DEFAULT_DB_FILE, DEFAULT_URL
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLATE
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -90,7 +89,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(queries, True)
|
||||
|
||||
|
||||
class SQLSensor(Entity):
|
||||
class SQLSensor(SensorEntity):
|
||||
"""Representation of an SQL sensor."""
|
||||
|
||||
def __init__(self, name, sessmaker, query, column, unit, value_template):
|
||||
|
@ -5,8 +5,8 @@ import logging
|
||||
import async_timeout
|
||||
from requests.exceptions import ConnectionError as ConnectError, HTTPError, Timeout
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, ENERGY_KILO_WATT_HOUR
|
||||
from homeassistant.helpers import entity
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
from .const import (
|
||||
@ -71,7 +71,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||
async_add_entities([SrpEntity(coordinator)])
|
||||
|
||||
|
||||
class SrpEntity(entity.Entity):
|
||||
class SrpEntity(SensorEntity):
|
||||
"""Implementation of a Srp Energy Usage sensor."""
|
||||
|
||||
def __init__(self, coordinator):
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""Reads vehicle status from StarLine API."""
|
||||
from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE
|
||||
from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE, SensorEntity
|
||||
from homeassistant.const import (
|
||||
LENGTH_KILOMETERS,
|
||||
PERCENTAGE,
|
||||
@ -7,7 +7,6 @@ from homeassistant.const import (
|
||||
VOLT,
|
||||
VOLUME_LITERS,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.icon import icon_for_battery_level, icon_for_signal_level
|
||||
|
||||
from .account import StarlineAccount, StarlineDevice
|
||||
@ -38,7 +37,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class StarlineSensor(StarlineEntity, Entity):
|
||||
class StarlineSensor(StarlineEntity, SensorEntity):
|
||||
"""Representation of a StarLine sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -5,10 +5,9 @@ import requests
|
||||
from starlingbank import StarlingAccount
|
||||
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
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -62,7 +61,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
add_devices(sensors, True)
|
||||
|
||||
|
||||
class StarlingBalanceSensor(Entity):
|
||||
class StarlingBalanceSensor(SensorEntity):
|
||||
"""Representation of a Starling balance sensor."""
|
||||
|
||||
def __init__(self, starling_account, account_name, balance_data_type):
|
||||
|
@ -7,7 +7,7 @@ import async_timeout
|
||||
import voluptuous as vol
|
||||
import xmltodict
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_API_KEY,
|
||||
CONF_MONITORED_VARIABLES,
|
||||
@ -18,7 +18,6 @@ from homeassistant.const import (
|
||||
)
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -75,7 +74,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class StartcaSensor(Entity):
|
||||
class StartcaSensor(SensorEntity):
|
||||
"""Representation of Start.ca Bandwidth sensor."""
|
||||
|
||||
def __init__(self, startcadata, sensor_type, name):
|
||||
|
@ -7,7 +7,7 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.components.recorder.models import States
|
||||
from homeassistant.components.recorder.util import execute, session_scope
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CONF_ENTITY_ID,
|
||||
@ -18,7 +18,6 @@ from homeassistant.const import (
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import (
|
||||
async_track_point_in_utc_time,
|
||||
async_track_state_change_event,
|
||||
@ -85,7 +84,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
return True
|
||||
|
||||
|
||||
class StatisticsSensor(Entity):
|
||||
class StatisticsSensor(SensorEntity):
|
||||
"""Representation of a Statistics sensor."""
|
||||
|
||||
def __init__(self, entity_id, name, sampling_size, max_age, precision):
|
||||
|
@ -6,11 +6,10 @@ from time import mktime
|
||||
import steam
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_API_KEY
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import track_time_interval
|
||||
from homeassistant.util.dt import utc_from_timestamp
|
||||
|
||||
@ -71,7 +70,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
track_time_interval(hass, do_update, BASE_INTERVAL)
|
||||
|
||||
|
||||
class SteamSensor(Entity):
|
||||
class SteamSensor(SensorEntity):
|
||||
"""A class for the Steam account."""
|
||||
|
||||
def __init__(self, account, steamod):
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.components.streamlabswater import DOMAIN as STREAMLABSWATER_DOMAIN
|
||||
from homeassistant.const import VOLUME_GALLONS
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
DEPENDENCIES = ["streamlabswater"]
|
||||
@ -67,7 +67,7 @@ class StreamlabsUsageData:
|
||||
return self._this_year
|
||||
|
||||
|
||||
class StreamLabsDailyUsage(Entity):
|
||||
class StreamLabsDailyUsage(SensorEntity):
|
||||
"""Monitors the daily water usage."""
|
||||
|
||||
def __init__(self, location_name, streamlabs_usage_data):
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Support for Subaru sensors."""
|
||||
import subarulink.const as sc
|
||||
|
||||
from homeassistant.components.sensor import DEVICE_CLASSES
|
||||
from homeassistant.components.sensor import DEVICE_CLASSES, SensorEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_BATTERY,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
@ -170,7 +170,7 @@ def create_vehicle_sensors(vehicle_info, coordinator):
|
||||
]
|
||||
|
||||
|
||||
class SubaruSensor(SubaruEntity):
|
||||
class SubaruSensor(SubaruEntity, SensorEntity):
|
||||
"""Class for Subaru sensors."""
|
||||
|
||||
def __init__(
|
||||
|
@ -6,10 +6,9 @@ from pysuez import SuezClient
|
||||
from pysuez.client import PySuezError
|
||||
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, VOLUME_LITERS
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
CONF_COUNTER_ID = "counter_id"
|
||||
@ -47,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities([SuezSensor(client)], True)
|
||||
|
||||
|
||||
class SuezSensor(Entity):
|
||||
class SuezSensor(SensorEntity):
|
||||
"""Representation of a Sensor."""
|
||||
|
||||
def __init__(self, client):
|
||||
|
@ -4,10 +4,9 @@ import xmlrpc.client
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import CONF_URL
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -36,7 +35,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
)
|
||||
|
||||
|
||||
class SupervisorProcessSensor(Entity):
|
||||
class SupervisorProcessSensor(SensorEntity):
|
||||
"""Representation of a supervisor-monitored process."""
|
||||
|
||||
def __init__(self, info, server):
|
||||
|
@ -6,6 +6,7 @@ from typing import Any
|
||||
|
||||
from surepy import SureLockStateID, SurepyProduct
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.const import (
|
||||
ATTR_VOLTAGE,
|
||||
CONF_ID,
|
||||
@ -15,7 +16,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 SurePetcareAPI
|
||||
from .const import (
|
||||
@ -54,7 +54,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities(entities, True)
|
||||
|
||||
|
||||
class SurePetcareSensor(Entity):
|
||||
class SurePetcareSensor(SensorEntity):
|
||||
"""A binary sensor implementation for Sure Petcare Entities."""
|
||||
|
||||
def __init__(self, _id: int, sure_type: SurepyProduct, spc: SurePetcareAPI):
|
||||
|
@ -5,10 +5,9 @@ import logging
|
||||
from swisshydrodata import SwissHydroData
|
||||
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
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -83,7 +82,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(entities, True)
|
||||
|
||||
|
||||
class SwissHydrologicalDataSensor(Entity):
|
||||
class SwissHydrologicalDataSensor(SensorEntity):
|
||||
"""Implementation of a Swiss hydrological sensor."""
|
||||
|
||||
def __init__(self, hydro_data, station, condition):
|
||||
|
@ -6,11 +6,10 @@ from opendata_transport import OpendataTransport
|
||||
from opendata_transport.exceptions import OpendataTransportError
|
||||
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
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@ -68,7 +67,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
async_add_entities([SwissPublicTransportSensor(opendata, start, destination, name)])
|
||||
|
||||
|
||||
class SwissPublicTransportSensor(Entity):
|
||||
class SwissPublicTransportSensor(SensorEntity):
|
||||
"""Implementation of an Swiss public transport sensor."""
|
||||
|
||||
def __init__(self, opendata, start, destination, name):
|
||||
|
@ -5,11 +5,10 @@ import logging
|
||||
from pysyncthru import SYNCTHRU_STATE_HUMAN, SyncThru
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.config_entries import SOURCE_IMPORT
|
||||
from homeassistant.const import CONF_NAME, CONF_RESOURCE, CONF_URL, PERCENTAGE
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import device_identifiers
|
||||
from .const import DEFAULT_MODEL, DEFAULT_NAME_TEMPLATE, DOMAIN
|
||||
@ -81,7 +80,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
async_add_entities(devices, True)
|
||||
|
||||
|
||||
class SyncThruSensor(Entity):
|
||||
class SyncThruSensor(SensorEntity):
|
||||
"""Implementation of an abstract Samsung Printer sensor platform."""
|
||||
|
||||
def __init__(self, syncthru, name):
|
||||
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_DISKS,
|
||||
@ -86,7 +87,7 @@ async def async_setup_entry(
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class SynoDSMUtilSensor(SynologyDSMBaseEntity):
|
||||
class SynoDSMUtilSensor(SynologyDSMBaseEntity, SensorEntity):
|
||||
"""Representation a Synology Utilisation sensor."""
|
||||
|
||||
@property
|
||||
@ -118,7 +119,7 @@ class SynoDSMUtilSensor(SynologyDSMBaseEntity):
|
||||
return bool(self._api.utilisation)
|
||||
|
||||
|
||||
class SynoDSMStorageSensor(SynologyDSMDeviceEntity):
|
||||
class SynoDSMStorageSensor(SynologyDSMDeviceEntity, SensorEntity):
|
||||
"""Representation a Synology Storage sensor."""
|
||||
|
||||
@property
|
||||
@ -139,7 +140,7 @@ class SynoDSMStorageSensor(SynologyDSMDeviceEntity):
|
||||
return attr
|
||||
|
||||
|
||||
class SynoDSMInfoSensor(SynologyDSMBaseEntity):
|
||||
class SynoDSMInfoSensor(SynologyDSMBaseEntity, SensorEntity):
|
||||
"""Representation a Synology information sensor."""
|
||||
|
||||
def __init__(
|
||||
|
@ -7,7 +7,7 @@ import sys
|
||||
import psutil
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import (
|
||||
CONF_RESOURCES,
|
||||
CONF_TYPE,
|
||||
@ -20,7 +20,6 @@ from homeassistant.const import (
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import slugify
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
@ -182,7 +181,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
add_entities(dev, True)
|
||||
|
||||
|
||||
class SystemMonitorSensor(Entity):
|
||||
class SystemMonitorSensor(SensorEntity):
|
||||
"""Implementation of a system monitor sensor."""
|
||||
|
||||
def __init__(self, sensor_type, argument=""):
|
||||
|
Loading…
x
Reference in New Issue
Block a user