Migrate integrations f-h to extend SensorEntity (#48212)

pull/48194/head
Erik Montnemery 2021-03-22 19:45:17 +01:00 committed by GitHub
parent a49989241a
commit 339a56e434
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 154 additions and 167 deletions

View File

@ -6,10 +6,9 @@ import re
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_FILE_PATH, CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -45,7 +44,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(device_list, True)
class BanSensor(Entity):
class BanSensor(SensorEntity):
"""Implementation of a fail2ban sensor."""
def __init__(self, name, jail, log_parser):

View File

@ -1,4 +1,5 @@
"""Support for Fast.com internet speed testing sensor."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DATA_RATE_MEGABITS_PER_SECOND
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -14,7 +15,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([SpeedtestSensor(hass.data[FASTDOTCOM_DOMAIN])])
class SpeedtestSensor(RestoreEntity):
class SpeedtestSensor(RestoreEntity, SensorEntity):
"""Implementation of a FAst.com sensor."""
def __init__(self, speedtest_data):

View File

@ -1,5 +1,5 @@
"""Support for Fibaro sensors."""
from homeassistant.components.sensor import DOMAIN
from homeassistant.components.sensor import DOMAIN, SensorEntity
from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
DEVICE_CLASS_CO2,
@ -11,7 +11,6 @@ from homeassistant.const import (
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
from homeassistant.helpers.entity import Entity
from . import FIBARO_DEVICES, FibaroDevice
@ -55,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
)
class FibaroSensor(FibaroDevice, Entity):
class FibaroSensor(FibaroDevice, SensorEntity):
"""Representation of a Fibaro Sensor."""
def __init__(self, fibaro_device):

View File

@ -11,7 +11,7 @@ from pyfido import FidoClient
from pyfido.client import PyFidoError
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,
@ -21,7 +21,6 @@ from homeassistant.const import (
TIME_MINUTES,
)
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 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(sensors, True)
class FidoSensor(Entity):
class FidoSensor(SensorEntity):
"""Implementation of a Fido sensor."""
def __init__(self, fido_data, sensor_type, name, number):

View File

@ -4,7 +4,7 @@ import os
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_FILE_PATH,
CONF_NAME,
@ -12,7 +12,6 @@ from homeassistant.const import (
CONF_VALUE_TEMPLATE,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -46,7 +45,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
_LOGGER.error("'%s' is not an allowed directory", file_path)
class FileSensor(Entity):
class FileSensor(SensorEntity):
"""Implementation of a file sensor."""
def __init__(self, name, file_path, unit_of_measurement, value_template):

View File

@ -5,10 +5,9 @@ import os
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import DATA_MEGABYTES
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.reload import setup_reload_service
from . import DOMAIN, PLATFORMS
@ -40,7 +39,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(sensors, True)
class Filesize(Entity):
class Filesize(SensorEntity):
"""Encapsulates file size information."""
def __init__(self, path):

View File

@ -18,6 +18,7 @@ from homeassistant.components.sensor import (
DEVICE_CLASSES as SENSOR_DEVICE_CLASSES,
DOMAIN as SENSOR_DOMAIN,
PLATFORM_SCHEMA,
SensorEntity,
)
from homeassistant.const import (
ATTR_DEVICE_CLASS,
@ -31,7 +32,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
from homeassistant.util.decorator import Registry
@ -179,7 +179,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([SensorFilter(name, entity_id, filters)])
class SensorFilter(Entity):
class SensorFilter(SensorEntity):
"""Representation of a Filter Sensor."""
def __init__(self, name, entity_id, filters):
@ -454,7 +454,7 @@ class Filter:
@FILTERS.register(FILTER_NAME_RANGE)
class RangeFilter(Filter):
class RangeFilter(Filter, SensorEntity):
"""Range filter.
Determines if new state is in the range of upper_bound and lower_bound.
@ -509,7 +509,7 @@ class RangeFilter(Filter):
@FILTERS.register(FILTER_NAME_OUTLIER)
class OutlierFilter(Filter):
class OutlierFilter(Filter, SensorEntity):
"""BASIC outlier filter.
Determines if new state is in a band around the median.
@ -547,7 +547,7 @@ class OutlierFilter(Filter):
@FILTERS.register(FILTER_NAME_LOWPASS)
class LowPassFilter(Filter):
class LowPassFilter(Filter, SensorEntity):
"""BASIC Low Pass Filter."""
def __init__(self, window_size, precision, entity, time_constant: int):
@ -571,7 +571,7 @@ class LowPassFilter(Filter):
@FILTERS.register(FILTER_NAME_TIME_SMA)
class TimeSMAFilter(Filter):
class TimeSMAFilter(Filter, SensorEntity):
"""Simple Moving Average (SMA) Filter.
The window_size is determined by time, and SMA is time weighted.
@ -617,7 +617,7 @@ class TimeSMAFilter(Filter):
@FILTERS.register(FILTER_NAME_THROTTLE)
class ThrottleFilter(Filter):
class ThrottleFilter(Filter, SensorEntity):
"""Throttle Filter.
One sample per window.
@ -640,7 +640,7 @@ class ThrottleFilter(Filter):
@FILTERS.register(FILTER_NAME_TIME_THROTTLE)
class TimeThrottleFilter(Filter):
class TimeThrottleFilter(Filter, SensorEntity):
"""Time Throttle Filter.
One sample per time period.

View File

@ -8,10 +8,9 @@ from fints.client import FinTS3PinTanClient
from fints.dialog import FinTSDialogError
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_PIN, CONF_URL, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -154,7 +153,7 @@ class FinTsClient:
return balance_accounts, holdings_accounts
class FinTsAccount(Entity):
class FinTsAccount(SensorEntity):
"""Sensor for a FinTS balance account.
A balance account contains an amount of money (=balance). The amount may
@ -206,7 +205,7 @@ class FinTsAccount(Entity):
return ICON
class FinTsHoldingsAccount(Entity):
class FinTsHoldingsAccount(SensorEntity):
"""Sensor for a FinTS holdings account.
A holdings account does not contain money but rather some financial

View File

@ -1,6 +1,7 @@
"""Sensor platform for FireServiceRota integration."""
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -21,7 +22,7 @@ async def async_setup_entry(
async_add_entities([IncidentsSensor(client)])
class IncidentsSensor(RestoreEntity):
class IncidentsSensor(RestoreEntity, SensorEntity):
"""Representation of FireServiceRota incidents sensor."""
def __init__(self, client):

View File

@ -2,10 +2,10 @@
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME, CONF_PIN
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import Entity
from .const import CONF_DIFFERENTIAL, CONF_PIN_MODE, DOMAIN
from .entity import FirmataPinEntity
@ -42,7 +42,7 @@ async def async_setup_entry(
async_add_entities(new_entities)
class FirmataSensor(FirmataPinEntity, Entity):
class FirmataSensor(FirmataPinEntity, SensorEntity):
"""Representation of a sensor on a Firmata board."""
async def async_added_to_hass(self) -> None:

View File

@ -10,7 +10,7 @@ from oauthlib.oauth2.rfc6749.errors import MismatchingStateError, MissingTokenEr
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
ATTR_ATTRIBUTION,
CONF_CLIENT_ID,
@ -25,7 +25,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.icon import icon_for_battery_level
from homeassistant.helpers.network import get_url
from homeassistant.util.json import load_json, save_json
@ -403,7 +402,7 @@ class FitbitAuthCallbackView(HomeAssistantView):
return html_response
class FitbitSensor(Entity):
class FitbitSensor(SensorEntity):
"""Implementation of a Fitbit sensor."""
def __init__(

View File

@ -6,10 +6,9 @@ from fixerio import Fixerio
from fixerio.exceptions import FixerioException
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, CONF_TARGET
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -49,7 +48,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([ExchangeRateSensor(data, name, target)], True)
class ExchangeRateSensor(Entity):
class ExchangeRateSensor(SensorEntity):
"""Representation of a Exchange sensor."""
def __init__(self, data, name, target):

View File

@ -5,10 +5,10 @@ import logging
import async_timeout
from pyflick import FlickAPI, FlickPrice
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_FRIENDLY_NAME
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import Entity
from homeassistant.util.dt import utcnow
from .const import ATTR_COMPONENTS, ATTR_END_AT, ATTR_START_AT, DOMAIN
@ -33,7 +33,7 @@ async def async_setup_entry(
async_add_entities([FlickPricingSensor(api)], True)
class FlickPricingSensor(Entity):
class FlickPricingSensor(SensorEntity):
"""Entity object for Flick Electric sensor."""
def __init__(self, api: FlickAPI):

View File

@ -1,6 +1,7 @@
"""Support for Flo Water Monitor sensors."""
from __future__ import annotations
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_HUMIDITY,
@ -56,7 +57,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities)
class FloDailyUsageSensor(FloEntity):
class FloDailyUsageSensor(FloEntity, SensorEntity):
"""Monitors the daily water usage."""
def __init__(self, device):
@ -82,7 +83,7 @@ class FloDailyUsageSensor(FloEntity):
return VOLUME_GALLONS
class FloSystemModeSensor(FloEntity):
class FloSystemModeSensor(FloEntity, SensorEntity):
"""Monitors the current Flo system mode."""
def __init__(self, device):
@ -98,7 +99,7 @@ class FloSystemModeSensor(FloEntity):
return self._device.current_system_mode
class FloCurrentFlowRateSensor(FloEntity):
class FloCurrentFlowRateSensor(FloEntity, SensorEntity):
"""Monitors the current water flow rate."""
def __init__(self, device):
@ -124,7 +125,7 @@ class FloCurrentFlowRateSensor(FloEntity):
return "gpm"
class FloTemperatureSensor(FloEntity):
class FloTemperatureSensor(FloEntity, SensorEntity):
"""Monitors the temperature."""
def __init__(self, name, device):
@ -150,7 +151,7 @@ class FloTemperatureSensor(FloEntity):
return DEVICE_CLASS_TEMPERATURE
class FloHumiditySensor(FloEntity):
class FloHumiditySensor(FloEntity, SensorEntity):
"""Monitors the humidity."""
def __init__(self, device):
@ -176,7 +177,7 @@ class FloHumiditySensor(FloEntity):
return DEVICE_CLASS_HUMIDITY
class FloPressureSensor(FloEntity):
class FloPressureSensor(FloEntity, SensorEntity):
"""Monitors the water pressure."""
def __init__(self, device):
@ -202,7 +203,7 @@ class FloPressureSensor(FloEntity):
return DEVICE_CLASS_PRESSURE
class FloBatterySensor(FloEntity):
class FloBatterySensor(FloEntity, SensorEntity):
"""Monitors the battery level for battery-powered leak detectors."""
def __init__(self, device):

View File

@ -6,7 +6,7 @@ from numbers import Number
from pyflume import FlumeData
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_CLIENT_ID,
@ -108,7 +108,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(flume_entity_list)
class FlumeSensor(CoordinatorEntity):
class FlumeSensor(CoordinatorEntity, SensorEntity):
"""Representation of the Flume sensor."""
def __init__(self, coordinator, flume_device, flume_query_sensor, name, device_id):

View File

@ -1,4 +1,5 @@
"""Support for user- and CDC-based flu info sensors from Flu Near You."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_STATE,
@ -85,7 +86,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors)
class FluNearYouSensor(CoordinatorEntity):
class FluNearYouSensor(CoordinatorEntity, SensorEntity):
"""Define a base Flu Near You sensor."""
def __init__(self, coordinator, config_entry, sensor_type, name, icon, unit):

View File

@ -6,10 +6,9 @@ import os
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import DATA_MEGABYTES
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -51,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([folder], True)
class Folder(Entity):
class Folder(SensorEntity):
"""Representation of a folder."""
ICON = "mdi:folder"

View File

@ -7,6 +7,7 @@ import aiohttp
from foobot_async import FoobotClient
import voluptuous as vol
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
ATTR_TEMPERATURE,
ATTR_TIME,
@ -91,7 +92,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(dev, True)
class FoobotSensor(Entity):
class FoobotSensor(SensorEntity):
"""Implementation of a Foobot sensor."""
def __init__(self, data, device, sensor_type):

View File

@ -3,11 +3,11 @@ from __future__ import annotations
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DATA_RATE_KILOBYTES_PER_SECOND
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import HomeAssistantType
import homeassistant.util.dt as dt_util
@ -74,7 +74,7 @@ async def async_setup_entry(
async_add_entities(entities, True)
class FreeboxSensor(Entity):
class FreeboxSensor(SensorEntity):
"""Representation of a Freebox sensor."""
def __init__(

View File

@ -1,8 +1,8 @@
"""Support for AVM Fritz!Box smarthome temperature sensor only devices."""
import requests
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import CONF_DEVICES, TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
from .const import (
ATTR_STATE_DEVICE_LOCKED,
@ -32,7 +32,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities)
class FritzBoxTempSensor(Entity):
class FritzBoxTempSensor(SensorEntity):
"""The entity class for Fritzbox temperature sensors."""
def __init__(self, device, fritz):

View File

@ -8,7 +8,7 @@ from time import sleep
from fritzconnection.core.fritzmonitor import FritzMonitor
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_HOST,
@ -19,7 +19,6 @@ from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from .const import (
ATTR_PREFIXES,
@ -102,7 +101,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities([sensor])
class FritzBoxCallSensor(Entity):
class FritzBoxCallSensor(SensorEntity):
"""Implementation of a Fritz!Box call monitor."""
def __init__(self, name, unique_id, fritzbox_phonebook, prefixes, host, port):

View File

@ -7,10 +7,9 @@ from fritzconnection.lib.fritzstatus import FritzStatus
from requests.exceptions import RequestException
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, STATE_UNAVAILABLE
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
@ -62,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([FritzboxMonitorSensor(name, fstatus)], True)
class FritzboxMonitorSensor(Entity):
class FritzboxMonitorSensor(SensorEntity):
"""Implementation of a fritzbox monitor sensor."""
def __init__(self, name, fstatus):

View File

@ -8,7 +8,7 @@ import logging
from pyfronius import Fronius
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_MONITORED_CONDITIONS,
@ -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.helpers.event import async_track_time_interval
_LOGGER = logging.getLogger(__name__)
@ -252,7 +251,7 @@ class FroniusPowerFlow(FroniusAdapter):
return await self.bridge.current_power_flow()
class FroniusTemplateSensor(Entity):
class FroniusTemplateSensor(SensorEntity):
"""Sensor for the single values (e.g. pv power, ac power)."""
def __init__(self, parent: FroniusAdapter, name):

View File

@ -10,9 +10,9 @@ from garminconnect import (
GarminConnectTooManyRequestsError,
)
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION, CONF_ID
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import HomeAssistantType
from .alarm_util import calculate_next_active_alarms
@ -70,7 +70,7 @@ async def async_setup_entry(
async_add_entities(entities, True)
class GarminConnectSensor(Entity):
class GarminConnectSensor(SensorEntity):
"""Representation of a Garmin Connect Sensor."""
def __init__(

View File

@ -3,9 +3,9 @@ from __future__ import annotations
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from homeassistant.util import dt
from .const import DEFAULT_ICON, DOMAIN, FEED
@ -34,7 +34,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
_LOGGER.debug("Sensor setup done")
class GdacsSensor(Entity):
class GdacsSensor(SensorEntity):
"""This is a status sensor for the GDACS integration."""
def __init__(self, config_entry_id, config_unique_id, config_title, manager):

View File

@ -4,10 +4,9 @@ from datetime import timedelta
from geizhals import Device, Geizhals
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
from homeassistant.util import Throttle
CONF_DESCRIPTION = "description"
@ -38,7 +37,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([Geizwatch(name, description, product_id, domain)], True)
class Geizwatch(Entity):
class Geizwatch(SensorEntity):
"""Implementation of Geizwatch."""
def __init__(self, name, description, product_id, domain):

View File

@ -4,6 +4,7 @@ from __future__ import annotations
from datetime import timedelta
from typing import Any
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
import homeassistant.util.dt as dt_util
@ -38,7 +39,7 @@ async def async_setup_platform(
async_add_entities(sensors + issues, update_before_add=True)
class GeniusBattery(GeniusDevice):
class GeniusBattery(GeniusDevice, SensorEntity):
"""Representation of a Genius Hub sensor."""
def __init__(self, broker, device, state_attr) -> None:
@ -88,7 +89,7 @@ class GeniusBattery(GeniusDevice):
return level if level != 255 else 0
class GeniusIssue(GeniusEntity):
class GeniusIssue(GeniusEntity, SensorEntity):
"""Representation of a Genius Hub sensor."""
def __init__(self, broker, level) -> None:

View File

@ -12,7 +12,7 @@ from georss_client import UPDATE_OK, UPDATE_OK_NO_DATA
from georss_generic_client import GenericFeed
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_LATITUDE,
CONF_LONGITUDE,
@ -23,7 +23,6 @@ from homeassistant.const import (
LENGTH_KILOMETERS,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -96,7 +95,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True)
class GeoRssServiceSensor(Entity):
class GeoRssServiceSensor(SensorEntity):
"""Representation of a Sensor."""
def __init__(

View File

@ -3,9 +3,9 @@ from __future__ import annotations
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from homeassistant.util import dt
from .const import DOMAIN, FEED
@ -35,7 +35,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
_LOGGER.debug("Sensor setup done")
class GeonetnzQuakesSensor(Entity):
class GeonetnzQuakesSensor(SensorEntity):
"""This is a status sensor for the GeoNet NZ Quakes integration."""
def __init__(self, config_entry_id, config_unique_id, config_title, manager):

View File

@ -3,6 +3,7 @@ from __future__ import annotations
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_LATITUDE,
@ -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 homeassistant.util import dt
from homeassistant.util.unit_system import IMPERIAL_SYSTEM
@ -54,7 +54,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
_LOGGER.debug("Sensor setup done")
class GeonetnzVolcanoSensor(Entity):
class GeonetnzVolcanoSensor(SensorEntity):
"""This represents an external event with GeoNet NZ Volcano feed data."""
def __init__(self, config_entry_id, feed_manager, external_id, unit_system):

View File

@ -5,7 +5,7 @@ import logging
import github
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_ACCESS_TOKEN,
@ -14,7 +14,6 @@ from homeassistant.const import (
CONF_URL,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -72,7 +71,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(sensors, True)
class GitHubSensor(Entity):
class GitHubSensor(SensorEntity):
"""Representation of a GitHub sensor."""
def __init__(self, github_data):

View File

@ -5,7 +5,7 @@ import logging
from gitlab import Gitlab, GitlabAuthenticationError, GitlabGetError
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,
@ -14,7 +14,6 @@ from homeassistant.const import (
CONF_URL,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
@ -66,7 +65,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([GitLabSensor(_gitlab_data, _name)], True)
class GitLabSensor(Entity):
class GitLabSensor(SensorEntity):
"""Representation of a GitLab sensor."""
def __init__(self, gitlab_data, name):

View File

@ -5,10 +5,9 @@ from gitterpy.client import GitterClient
from gitterpy.errors import GitterRoomError, GitterTokenError
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_ROOM
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([GitterSensor(gitter, room, name, username)], True)
class GitterSensor(Entity):
class GitterSensor(SensorEntity):
"""Representation of a Gitter sensor."""
def __init__(self, data, room, name, username):

View File

@ -1,8 +1,8 @@
"""Support gathering system information of hosts which are running glances."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import CONF_NAME, STATE_UNAVAILABLE
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from .const import DATA_UPDATED, DOMAIN, SENSOR_TYPES
@ -60,7 +60,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(dev, True)
class GlancesSensor(Entity):
class GlancesSensor(SensorEntity):
"""Implementation of a Glances sensor."""
def __init__(

View File

@ -6,6 +6,7 @@ from typing import Callable
from gogogate2_api.common import AbstractDoor, get_configured_doors
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
@ -48,7 +49,7 @@ async def async_setup_entry(
async_add_entities(sensors)
class DoorSensorBattery(GoGoGate2Entity):
class DoorSensorBattery(GoGoGate2Entity, SensorEntity):
"""Battery sensor entity for gogogate2 door sensor."""
def __init__(
@ -86,7 +87,7 @@ class DoorSensorBattery(GoGoGate2Entity):
return None
class DoorSensorTemperature(GoGoGate2Entity):
class DoorSensorTemperature(GoGoGate2Entity, SensorEntity):
"""Temperature sensor entity for gogogate2 door sensor."""
def __init__(

View File

@ -5,7 +5,7 @@ import logging
import googlemaps
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,
@ -18,7 +18,6 @@ from homeassistant.const import (
)
from homeassistant.helpers import location
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
import homeassistant.util.dt as dt_util
_LOGGER = logging.getLogger(__name__)
@ -180,7 +179,7 @@ def setup_platform(hass, config, add_entities_callback, discovery_info=None):
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, run_setup)
class GoogleTravelTimeSensor(Entity):
class GoogleTravelTimeSensor(SensorEntity):
"""Representation of a Google travel time sensor."""
def __init__(self, hass, name, api_key, origin, destination, options):

View File

@ -5,7 +5,7 @@ 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 (
CONF_HOST,
CONF_MONITORED_CONDITIONS,
@ -14,7 +14,6 @@ from homeassistant.const import (
TIME_DAYS,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle, dt
_LOGGER = logging.getLogger(__name__)
@ -71,7 +70,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(dev, True)
class GoogleWifiSensor(Entity):
class GoogleWifiSensor(SensorEntity):
"""Representation of a Google Wifi sensor."""
def __init__(self, api, name, variable):

View File

@ -5,7 +5,7 @@ import socket
from gps3.agps3threaded import AGPS3mechanism
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
@ -15,7 +15,6 @@ from homeassistant.const import (
CONF_PORT,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -65,7 +64,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([GpsdSensor(hass, name, host, port)])
class GpsdSensor(Entity):
class GpsdSensor(SensorEntity):
"""Representation of a GPS receiver available via GPSD."""
def __init__(self, hass, name, host, port):

View File

@ -1,4 +1,5 @@
"""Support for the sensors in a GreenEye Monitor."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
CONF_NAME,
CONF_SENSOR_TYPE,
@ -9,7 +10,6 @@ from homeassistant.const import (
TIME_SECONDS,
VOLT,
)
from homeassistant.helpers.entity import Entity
from . import (
CONF_COUNTED_QUANTITY,
@ -85,7 +85,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(entities)
class GEMSensor(Entity):
class GEMSensor(SensorEntity):
"""Base class for GreenEye Monitor sensors."""
def __init__(self, monitor_serial_number, name, sensor_type, number):

View File

@ -7,7 +7,7 @@ import re
import growattServer
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,
@ -28,7 +28,6 @@ from homeassistant.const import (
VOLT,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
@ -416,7 +415,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(entities, True)
class GrowattInverter(Entity):
class GrowattInverter(SensorEntity):
"""Representation of a Growatt Sensor."""
def __init__(self, probe, name, sensor, unique_id):

View File

@ -11,7 +11,7 @@ import pygtfs
from sqlalchemy.sql import text
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,
@ -20,7 +20,6 @@ from homeassistant.const import (
STATE_UNKNOWN,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import (
ConfigType,
DiscoveryInfoType,
@ -519,7 +518,7 @@ def setup_platform(
)
class GTFSDepartureSensor(Entity):
class GTFSDepartureSensor(SensorEntity):
"""Implementation of a GTFS departure sensor."""
def __init__(

View File

@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Callable
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
@ -110,7 +111,7 @@ async def async_setup_entry(
async_add_entities(sensors)
class PairedSensorSensor(PairedSensorEntity):
class PairedSensorSensor(PairedSensorEntity, SensorEntity):
"""Define a binary sensor related to a Guardian valve controller."""
def __init__(
@ -153,7 +154,7 @@ class PairedSensorSensor(PairedSensorEntity):
self._state = self.coordinator.data["temperature"]
class ValveControllerSensor(ValveControllerEntity):
class ValveControllerSensor(ValveControllerEntity, SensorEntity):
"""Define a generic Guardian sensor."""
def __init__(

View File

@ -5,8 +5,8 @@ import logging
from aiohttp import ClientResponseError
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import CONF_NAME, HTTP_TOO_MANY_REQUESTS
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
from .const import DOMAIN
@ -125,7 +125,7 @@ class HabitipyData:
)
class HabitipySensor(Entity):
class HabitipySensor(SensorEntity):
"""A generic Habitica sensor."""
def __init__(self, name, sensor_name, updater):
@ -165,7 +165,7 @@ class HabitipySensor(Entity):
return self._sensor_type.unit
class HabitipyTaskSensor(Entity):
class HabitipyTaskSensor(SensorEntity):
"""A Habitica task sensor."""
def __init__(self, name, task_name, updater):

View File

@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Callable
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import Entity
@ -36,7 +37,7 @@ async def async_setup_entry(
async_add_entities(entities)
class HassioAddonSensor(HassioAddonEntity):
class HassioAddonSensor(HassioAddonEntity, SensorEntity):
"""Sensor to track a Hass.io add-on attribute."""
@property
@ -45,7 +46,7 @@ class HassioAddonSensor(HassioAddonEntity):
return self.addon_info[self.attribute_name]
class HassioOSSensor(HassioOSEntity):
class HassioOSSensor(HassioOSEntity, SensorEntity):
"""Sensor to track a Hass.io add-on attribute."""
@property

View File

@ -6,7 +6,7 @@ from aiohttp.hdrs import USER_AGENT
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 (
ATTR_ATTRIBUTION,
CONF_API_KEY,
@ -15,7 +15,6 @@ from homeassistant.const import (
HTTP_OK,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import track_point_in_time
from homeassistant.util import Throttle
import homeassistant.util.dt as dt_util
@ -54,7 +53,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices)
class HaveIBeenPwnedSensor(Entity):
class HaveIBeenPwnedSensor(SensorEntity):
"""Implementation of a HaveIBeenPwned sensor."""
def __init__(self, data, email):

View File

@ -6,7 +6,7 @@ from telnetlib import Telnet
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_DISKS,
CONF_HOST,
@ -16,7 +16,6 @@ from homeassistant.const import (
TEMP_FAHRENHEIT,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -60,7 +59,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(dev, True)
class HddTempSensor(Entity):
class HddTempSensor(SensorEntity):
"""Representation of a HDDTemp sensor."""
def __init__(self, name, disk, hddtemp):

View File

@ -8,7 +8,7 @@ from typing import Callable
import herepy
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,
@ -26,7 +26,6 @@ from homeassistant.const import (
from homeassistant.core import HomeAssistant, State, callback
from homeassistant.helpers import location
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import DiscoveryInfoType
import homeassistant.util.dt as dt
@ -215,7 +214,7 @@ def _are_valid_client_credentials(here_client: herepy.RoutingApi) -> bool:
return True
class HERETravelTimeSensor(Entity):
class HERETravelTimeSensor(SensorEntity):
"""Representation of a HERE travel time sensor."""
def __init__(

View File

@ -6,7 +6,7 @@ import math
import voluptuous as vol
from homeassistant.components import history
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_ENTITY_ID,
CONF_NAME,
@ -19,7 +19,6 @@ from homeassistant.const import (
from homeassistant.core import CoreState, callback
from homeassistant.exceptions import TemplateError
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 setup_reload_service
import homeassistant.util.dt as dt_util
@ -102,7 +101,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return True
class HistoryStatsSensor(Entity):
class HistoryStatsSensor(SensorEntity):
"""Representation of a HistoryStats sensor."""
def __init__(

View File

@ -2,8 +2,7 @@
from datetime import timedelta
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY
from homeassistant.helpers.entity import Entity
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, SensorEntity
from . import HiveEntity
from .const import DOMAIN
@ -27,7 +26,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(entities, True)
class HiveSensorEntity(HiveEntity, Entity):
class HiveSensorEntity(HiveEntity, SensorEntity):
"""Hive Sensor Entity."""
@property

View File

@ -3,6 +3,7 @@
from datetime import timedelta
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import CONF_ENTITIES, DEVICE_CLASS_TIMESTAMP
import homeassistant.util.dt as dt_util
@ -27,7 +28,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(await hass.async_add_executor_job(get_entities), True)
class HomeConnectSensor(HomeConnectEntity):
class HomeConnectSensor(HomeConnectEntity, SensorEntity):
"""Sensor class for Home Connect."""
def __init__(self, device, desc, key, unit, icon, device_class, sign=1):

View File

@ -2,6 +2,7 @@
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
DEVICE_CLASS_BATTERY,
@ -39,7 +40,7 @@ SIMPLE_SENSOR = {
}
class HomeKitHumiditySensor(HomeKitEntity):
class HomeKitHumiditySensor(HomeKitEntity, SensorEntity):
"""Representation of a Homekit humidity sensor."""
def get_characteristic_types(self):
@ -72,7 +73,7 @@ class HomeKitHumiditySensor(HomeKitEntity):
return self.service.value(CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT)
class HomeKitTemperatureSensor(HomeKitEntity):
class HomeKitTemperatureSensor(HomeKitEntity, SensorEntity):
"""Representation of a Homekit temperature sensor."""
def get_characteristic_types(self):
@ -105,7 +106,7 @@ class HomeKitTemperatureSensor(HomeKitEntity):
return self.service.value(CharacteristicsTypes.TEMPERATURE_CURRENT)
class HomeKitLightSensor(HomeKitEntity):
class HomeKitLightSensor(HomeKitEntity, SensorEntity):
"""Representation of a Homekit light level sensor."""
def get_characteristic_types(self):
@ -138,7 +139,7 @@ class HomeKitLightSensor(HomeKitEntity):
return self.service.value(CharacteristicsTypes.LIGHT_LEVEL_CURRENT)
class HomeKitCarbonDioxideSensor(HomeKitEntity):
class HomeKitCarbonDioxideSensor(HomeKitEntity, SensorEntity):
"""Representation of a Homekit Carbon Dioxide sensor."""
def get_characteristic_types(self):
@ -166,7 +167,7 @@ class HomeKitCarbonDioxideSensor(HomeKitEntity):
return self.service.value(CharacteristicsTypes.CARBON_DIOXIDE_LEVEL)
class HomeKitBatterySensor(HomeKitEntity):
class HomeKitBatterySensor(HomeKitEntity, SensorEntity):
"""Representation of a Homekit battery sensor."""
def get_characteristic_types(self):
@ -233,7 +234,7 @@ class HomeKitBatterySensor(HomeKitEntity):
return self.service.value(CharacteristicsTypes.BATTERY_LEVEL)
class SimpleSensor(CharacteristicEntity):
class SimpleSensor(CharacteristicEntity, SensorEntity):
"""
A simple sensor for a single characteristic.

View File

@ -1,6 +1,7 @@
"""Support for HomeMatic sensors."""
import logging
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
DEGREE,
DEVICE_CLASS_HUMIDITY,
@ -97,7 +98,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True)
class HMSensor(HMDevice):
class HMSensor(HMDevice, SensorEntity):
"""Representation of a HomeMatic sensor."""
@property

View File

@ -26,6 +26,7 @@ from homematicip.aio.device import (
)
from homematicip.base.enums import ValveState
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_HUMIDITY,
@ -123,7 +124,7 @@ async def async_setup_entry(
async_add_entities(entities)
class HomematicipAccesspointDutyCycle(HomematicipGenericEntity):
class HomematicipAccesspointDutyCycle(HomematicipGenericEntity, SensorEntity):
"""Representation of then HomeMaticIP access point."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -146,7 +147,7 @@ class HomematicipAccesspointDutyCycle(HomematicipGenericEntity):
return PERCENTAGE
class HomematicipHeatingThermostat(HomematicipGenericEntity):
class HomematicipHeatingThermostat(HomematicipGenericEntity, SensorEntity):
"""Representation of the HomematicIP heating thermostat."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -175,7 +176,7 @@ class HomematicipHeatingThermostat(HomematicipGenericEntity):
return PERCENTAGE
class HomematicipHumiditySensor(HomematicipGenericEntity):
class HomematicipHumiditySensor(HomematicipGenericEntity, SensorEntity):
"""Representation of the HomematicIP humidity sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -198,7 +199,7 @@ class HomematicipHumiditySensor(HomematicipGenericEntity):
return PERCENTAGE
class HomematicipTemperatureSensor(HomematicipGenericEntity):
class HomematicipTemperatureSensor(HomematicipGenericEntity, SensorEntity):
"""Representation of the HomematicIP thermometer."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -235,7 +236,7 @@ class HomematicipTemperatureSensor(HomematicipGenericEntity):
return state_attr
class HomematicipIlluminanceSensor(HomematicipGenericEntity):
class HomematicipIlluminanceSensor(HomematicipGenericEntity, SensorEntity):
"""Representation of the HomematicIP Illuminance sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -273,7 +274,7 @@ class HomematicipIlluminanceSensor(HomematicipGenericEntity):
return state_attr
class HomematicipPowerSensor(HomematicipGenericEntity):
class HomematicipPowerSensor(HomematicipGenericEntity, SensorEntity):
"""Representation of the HomematicIP power measuring sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -296,7 +297,7 @@ class HomematicipPowerSensor(HomematicipGenericEntity):
return POWER_WATT
class HomematicipWindspeedSensor(HomematicipGenericEntity):
class HomematicipWindspeedSensor(HomematicipGenericEntity, SensorEntity):
"""Representation of the HomematicIP wind speed sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -329,7 +330,7 @@ class HomematicipWindspeedSensor(HomematicipGenericEntity):
return state_attr
class HomematicipTodayRainSensor(HomematicipGenericEntity):
class HomematicipTodayRainSensor(HomematicipGenericEntity, SensorEntity):
"""Representation of the HomematicIP rain counter of a day sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None:
@ -347,7 +348,7 @@ class HomematicipTodayRainSensor(HomematicipGenericEntity):
return LENGTH_MILLIMETERS
class HomematicipPassageDetectorDeltaCounter(HomematicipGenericEntity):
class HomematicipPassageDetectorDeltaCounter(HomematicipGenericEntity, SensorEntity):
"""Representation of the HomematicIP passage detector delta counter."""
@property

View File

@ -5,7 +5,7 @@ import logging
import hpilo
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_HOST,
CONF_MONITORED_VARIABLES,
@ -18,7 +18,6 @@ from homeassistant.const import (
CONF_VALUE_TEMPLATE,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
@ -100,7 +99,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True)
class HpIloSensor(Entity):
class HpIloSensor(SensorEntity):
"""Representation of a HP iLO sensor."""
def __init__(

View File

@ -7,10 +7,9 @@ from i2csense.htu21d import HTU21D # pylint: disable=import-error
import smbus
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, PERCENTAGE, 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
@ -70,7 +69,7 @@ class HTU21DHandler:
self.sensor.update()
class HTU21DSensor(Entity):
class HTU21DSensor(SensorEntity):
"""Implementation of the HTU21D sensor."""
def __init__(self, htu21d_client, name, variable, unit):

View File

@ -12,6 +12,7 @@ from homeassistant.components.sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_SIGNAL_STRENGTH,
DOMAIN as SENSOR_DOMAIN,
SensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
@ -373,7 +374,7 @@ def format_default(value: StateType) -> tuple[StateType, str | None]:
@attr.s
class HuaweiLteSensor(HuaweiLteBaseEntity):
class HuaweiLteSensor(HuaweiLteBaseEntity, SensorEntity):
"""Huawei LTE sensor entity."""
key: str = attr.ib()

View File

@ -6,6 +6,7 @@ from aiohue.sensors import (
TYPE_ZLL_TEMPERATURE,
)
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_ILLUMINANCE,
@ -14,7 +15,6 @@ from homeassistant.const import (
PERCENTAGE,
TEMP_CELSIUS,
)
from homeassistant.helpers.entity import Entity
from .const import DOMAIN as HUE_DOMAIN
from .sensor_base import SENSOR_CONFIG_MAP, GenericHueSensor, GenericZLLSensor
@ -31,7 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
].sensor_manager.async_register_component("sensor", async_add_entities)
class GenericHueGaugeSensorEntity(GenericZLLSensor, Entity):
class GenericHueGaugeSensorEntity(GenericZLLSensor, SensorEntity):
"""Parent class for all 'gauge' Hue device sensors."""
async def _async_update_ha_state(self, *args, **kwargs):
@ -88,7 +88,7 @@ class HueTemperature(GenericHueGaugeSensorEntity):
return self.sensor.temperature / 100
class HueBattery(GenericHueSensor):
class HueBattery(GenericHueSensor, SensorEntity):
"""Battery class for when a batt-powered device is only represented as an event."""
@property

View File

@ -1,4 +1,5 @@
"""Platform for sensor integration."""
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ID, POWER_WATT
from homeassistant.core import HomeAssistant
@ -23,7 +24,7 @@ async def async_setup_entry(
)
class HuisbaasjeSensor(CoordinatorEntity):
class HuisbaasjeSensor(CoordinatorEntity, SensorEntity):
"""Defines a Huisbaasje sensor."""
def __init__(

View File

@ -1,6 +1,7 @@
"""Support for hunterdouglass_powerview sensors."""
from aiopvapi.resources.shade import factory as PvShade
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.core import callback
@ -45,7 +46,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(entities)
class PowerViewShadeBatterySensor(ShadeEntity):
class PowerViewShadeBatterySensor(ShadeEntity, SensorEntity):
"""Representation of an shade battery charge sensor."""
@property

View File

@ -6,9 +6,9 @@ from aiohttp import ClientConnectorError
from pygti.exceptions import InvalidAuth
from pytz import timezone
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_ID, DEVICE_CLASS_TIMESTAMP
from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
from homeassistant.util.dt import utcnow
@ -43,7 +43,7 @@ async def async_setup_entry(hass, config_entry, async_add_devices):
async_add_devices([sensor], True)
class HVVDepartureSensor(Entity):
class HVVDepartureSensor(SensorEntity):
"""HVVDepartureSensor class."""
def __init__(self, hass, config_entry, session, hub):

View File

@ -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.util import dt
@ -36,7 +36,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(sensors, True)
class HydrawiseSensor(HydrawiseEntity):
class HydrawiseSensor(HydrawiseEntity, SensorEntity):
"""A sensor implementation for Hydrawise device."""
@property