Rename BinarySensorDevice to BinarySensorEntity (#34462)

* Rename BinarySensorDevice to BinarySensorEntity

* Tweak

* Move deprecation warning to __new__, add test

* Move deprecation warning back to __init__

* Move deprecation warning to __init_subclass
This commit is contained in:
Erik Montnemery 2020-04-23 21:57:07 +02:00 committed by GitHub
parent 0b64f49e3a
commit b022e08db9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
147 changed files with 371 additions and 352 deletions

View file

@ -3,7 +3,7 @@ import abodepy.helpers.constants as CONST
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_WINDOW, DEVICE_CLASS_WINDOW,
BinarySensorDevice, BinarySensorEntity,
) )
from . import AbodeDevice from . import AbodeDevice
@ -30,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities) async_add_entities(entities)
class AbodeBinarySensor(AbodeDevice, BinarySensorDevice): class AbodeBinarySensor(AbodeDevice, BinarySensorEntity):
"""A binary sensor implementation for Abode device.""" """A binary sensor implementation for Abode device."""
@property @property

View file

@ -6,7 +6,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -37,7 +37,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([ads_sensor]) add_entities([ads_sensor])
class AdsBinarySensor(AdsEntity, BinarySensorDevice): class AdsBinarySensor(AdsEntity, BinarySensorEntity):
"""Representation of ADS binary sensors.""" """Representation of ADS binary sensors."""
def __init__(self, ads_hub, name, ads_var, device_class): def __init__(self, ads_hub, name, ads_var, device_class):

View file

@ -1,7 +1,7 @@
"""Support for AlarmDecoder zone states- represented as binary sensors.""" """Support for AlarmDecoder zone states- represented as binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import ( from . import (
CONF_RELAY_ADDR, CONF_RELAY_ADDR,
@ -53,7 +53,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return True return True
class AlarmDecoderBinarySensor(BinarySensorDevice): class AlarmDecoderBinarySensor(BinarySensorEntity):
"""Representation of an AlarmDecoder binary sensor.""" """Representation of an AlarmDecoder binary sensor."""
def __init__( def __init__(

View file

@ -1,7 +1,7 @@
"""Support for Ambient Weather Station binary sensors.""" """Support for Ambient Weather Station binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import ATTR_NAME from homeassistant.const import ATTR_NAME
from homeassistant.core import callback from homeassistant.core import callback
@ -54,7 +54,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(binary_sensor_list, True) async_add_entities(binary_sensor_list, True)
class AmbientWeatherBinarySensor(AmbientWeatherEntity, BinarySensorDevice): class AmbientWeatherBinarySensor(AmbientWeatherEntity, BinarySensorEntity):
"""Define an Ambient binary sensor.""" """Define an Ambient binary sensor."""
@property @property

View file

@ -7,7 +7,7 @@ from amcrest import AmcrestError
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_MOTION, DEVICE_CLASS_MOTION,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_BINARY_SENSORS, CONF_NAME from homeassistant.const import CONF_BINARY_SENSORS, CONF_NAME
from homeassistant.core import callback from homeassistant.core import callback
@ -63,7 +63,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
) )
class AmcrestBinarySensor(BinarySensorDevice): class AmcrestBinarySensor(BinarySensorEntity):
"""Binary sensor for Amcrest camera.""" """Binary sensor for Amcrest camera."""
def __init__(self, name, device, sensor_type): def __init__(self, name, device, sensor_type):

View file

@ -1,5 +1,5 @@
"""Support for Android IP Webcam binary sensors.""" """Support for Android IP Webcam binary sensors."""
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import CONF_HOST, CONF_NAME, DATA_IP_WEBCAM, KEY_MAP, AndroidIPCamEntity from . import CONF_HOST, CONF_NAME, DATA_IP_WEBCAM, KEY_MAP, AndroidIPCamEntity
@ -16,7 +16,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([IPWebcamBinarySensor(name, host, ipcam, "motion_active")], True) async_add_entities([IPWebcamBinarySensor(name, host, ipcam, "motion_active")], True)
class IPWebcamBinarySensor(AndroidIPCamEntity, BinarySensorDevice): class IPWebcamBinarySensor(AndroidIPCamEntity, BinarySensorEntity):
"""Representation of an IP Webcam binary sensor.""" """Representation of an IP Webcam binary sensor."""
def __init__(self, name, host, ipcam, sensor): def __init__(self, name, host, ipcam, sensor):

View file

@ -1,7 +1,7 @@
"""Support for tracking the online status of a UPS.""" """Support for tracking the online status of a UPS."""
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_NAME from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -20,7 +20,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([OnlineStatus(config, apcups_data)], True) add_entities([OnlineStatus(config, apcups_data)], True)
class OnlineStatus(BinarySensorDevice): class OnlineStatus(BinarySensorEntity):
"""Representation of an UPS online status.""" """Representation of an UPS online status."""
def __init__(self, config, data): def __init__(self, config, data):

View file

@ -8,7 +8,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import ( from homeassistant.const import (
CONF_DEVICE_CLASS, CONF_DEVICE_CLASS,
@ -67,7 +67,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
) )
class ArestBinarySensor(BinarySensorDevice): class ArestBinarySensor(BinarySensorEntity):
"""Implement an aREST binary sensor for a pin.""" """Implement an aREST binary sensor for a pin."""
def __init__(self, arest, resource, name, device_class, pin): def __init__(self, arest, resource, name, device_class, pin):

View file

@ -11,7 +11,7 @@ from homeassistant.components.binary_sensor import (
DEVICE_CLASS_DOOR, DEVICE_CLASS_DOOR,
DEVICE_CLASS_MOTION, DEVICE_CLASS_MOTION,
DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OCCUPANCY,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.event import async_track_point_in_utc_time from homeassistant.helpers.event import async_track_point_in_utc_time
@ -108,7 +108,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(devices, True) async_add_entities(devices, True)
class AugustDoorBinarySensor(AugustEntityMixin, BinarySensorDevice): class AugustDoorBinarySensor(AugustEntityMixin, BinarySensorEntity):
"""Representation of an August Door binary sensor.""" """Representation of an August Door binary sensor."""
def __init__(self, data, sensor_type, device): def __init__(self, data, sensor_type, device):
@ -155,7 +155,7 @@ class AugustDoorBinarySensor(AugustEntityMixin, BinarySensorDevice):
return f"{self._device_id}_open" return f"{self._device_id}_open"
class AugustDoorbellBinarySensor(AugustEntityMixin, BinarySensorDevice): class AugustDoorbellBinarySensor(AugustEntityMixin, BinarySensorEntity):
"""Representation of an August binary sensor.""" """Representation of an August binary sensor."""
def __init__(self, data, sensor_type, device): def __init__(self, data, sensor_type, device):

View file

@ -7,7 +7,7 @@ from aiohttp.hdrs import USER_AGENT
import requests import requests
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle from homeassistant.util import Throttle
@ -54,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([AuroraSensor(aurora_data, name)], True) add_entities([AuroraSensor(aurora_data, name)], True)
class AuroraSensor(BinarySensorDevice): class AuroraSensor(BinarySensorEntity):
"""Implementation of an aurora sensor.""" """Implementation of an aurora sensor."""
def __init__(self, aurora_data, name): def __init__(self, aurora_data, name):

View file

@ -4,7 +4,7 @@ from datetime import timedelta
from axis.event_stream import CLASS_INPUT, CLASS_OUTPUT from axis.event_stream import CLASS_INPUT, CLASS_OUTPUT
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_TRIGGER_TIME from homeassistant.const import CONF_TRIGGER_TIME
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -32,7 +32,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class AxisBinarySensor(AxisEventBase, BinarySensorDevice): class AxisBinarySensor(AxisEventBase, BinarySensorEntity):
"""Representation of a binary Axis event.""" """Representation of a binary Axis event."""
def __init__(self, event, device): def __init__(self, event, device):

View file

@ -3,7 +3,7 @@ from collections import OrderedDict
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ( from homeassistant.const import (
CONF_ABOVE, CONF_ABOVE,
CONF_BELOW, CONF_BELOW,
@ -113,7 +113,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
) )
class BayesianBinarySensor(BinarySensorDevice): class BayesianBinarySensor(BinarySensorEntity):
"""Representation of a Bayesian sensor.""" """Representation of a Bayesian sensor."""
def __init__(self, name, prior, observations, probability_threshold, device_class): def __init__(self, name, prior, observations, probability_threshold, device_class):

View file

@ -4,7 +4,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components import bbb_gpio from homeassistant.components import bbb_gpio
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(binary_sensors) add_entities(binary_sensors)
class BBBGPIOBinarySensor(BinarySensorDevice): class BBBGPIOBinarySensor(BinarySensorEntity):
"""Representation of a binary sensor that uses Beaglebone Black GPIO.""" """Representation of a binary sensor that uses Beaglebone Black GPIO."""
def __init__(self, pin, params): def __init__(self, pin, params):

View file

@ -15,6 +15,8 @@ from homeassistant.helpers.entity_component import EntityComponent
# mypy: allow-untyped-defs, no-check-untyped-defs # mypy: allow-untyped-defs, no-check-untyped-defs
_LOGGER = logging.getLogger(__name__)
DOMAIN = "binary_sensor" DOMAIN = "binary_sensor"
SCAN_INTERVAL = timedelta(seconds=30) SCAN_INTERVAL = timedelta(seconds=30)
@ -142,7 +144,7 @@ async def async_unload_entry(hass, entry):
return await hass.data[DOMAIN].async_unload_entry(entry) return await hass.data[DOMAIN].async_unload_entry(entry)
class BinarySensorDevice(Entity): class BinarySensorEntity(Entity):
"""Represent a binary sensor.""" """Represent a binary sensor."""
@property @property
@ -159,3 +161,15 @@ class BinarySensorDevice(Entity):
def device_class(self): def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES.""" """Return the class of this device, from component DEVICE_CLASSES."""
return None return None
class BinarySensorDevice(BinarySensorEntity):
"""Represent a binary sensor (for backwards compatibility)."""
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"BinarySensorDevice is deprecated, modify %s to extend BinarySensorEntity",
cls.__name__,
)

View file

@ -1,5 +1,5 @@
"""Support for Blink system camera control.""" """Support for Blink system camera control."""
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.const import CONF_MONITORED_CONDITIONS
from . import BINARY_SENSORS, BLINK_DATA from . import BINARY_SENSORS, BLINK_DATA
@ -18,7 +18,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devs, True) add_entities(devs, True)
class BlinkBinarySensor(BinarySensorDevice): class BlinkBinarySensor(BinarySensorEntity):
"""Representation of a Blink binary sensor.""" """Representation of a Blink binary sensor."""
def __init__(self, data, camera, sensor_type): def __init__(self, data, camera, sensor_type):

View file

@ -3,7 +3,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.const import CONF_MONITORED_CONDITIONS
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -33,7 +33,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([BloomSkySensor(bloomsky, device, variable)], True) add_entities([BloomSkySensor(bloomsky, device, variable)], True)
class BloomSkySensor(BinarySensorDevice): class BloomSkySensor(BinarySensorEntity):
"""Representation of a single binary sensor in a BloomSky device.""" """Representation of a single binary sensor in a BloomSky device."""
def __init__(self, bs, device, sensor_name): def __init__(self, bs, device, sensor_name):

View file

@ -3,7 +3,7 @@ import logging
from bimmer_connected.state import ChargingState, LockState from bimmer_connected.state import ChargingState, LockState
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, LENGTH_KILOMETERS from homeassistant.const import ATTR_ATTRIBUTION, LENGTH_KILOMETERS
from . import DOMAIN as BMW_DOMAIN from . import DOMAIN as BMW_DOMAIN
@ -54,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True) add_entities(devices, True)
class BMWConnectedDriveSensor(BinarySensorDevice): class BMWConnectedDriveSensor(BinarySensorEntity):
"""Representation of a BMW vehicle binary sensor.""" """Representation of a BMW vehicle binary sensor."""
def __init__( def __init__(

View file

@ -1,7 +1,7 @@
"""Support for Home Assistant Cloud binary sensors.""" """Support for Home Assistant Cloud binary sensors."""
import asyncio import asyncio
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import DISPATCHER_REMOTE_UPDATE, DOMAIN from .const import DISPATCHER_REMOTE_UPDATE, DOMAIN
@ -18,7 +18,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([CloudRemoteBinary(cloud)]) async_add_entities([CloudRemoteBinary(cloud)])
class CloudRemoteBinary(BinarySensorDevice): class CloudRemoteBinary(BinarySensorEntity):
"""Representation of an Cloud Remote UI Connection binary sensor.""" """Representation of an Cloud Remote UI Connection binary sensor."""
def __init__(self, cloud): def __init__(self, cloud):

View file

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import ( from homeassistant.const import (
CONF_COMMAND, CONF_COMMAND,
@ -68,7 +68,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
) )
class CommandBinarySensor(BinarySensorDevice): class CommandBinarySensor(BinarySensorEntity):
"""Representation of a command line binary sensor.""" """Representation of a command line binary sensor."""
def __init__( def __init__(

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DEVICE_CLASSES,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -95,7 +95,7 @@ def get_opening_type(zone):
return "opening" return "opening"
class Concord232ZoneSensor(BinarySensorDevice): class Concord232ZoneSensor(BinarySensorEntity):
"""Representation of a Concord232 zone as a sensor.""" """Representation of a Concord232 zone as a sensor."""
def __init__(self, hass, client, zone, zone_type): def __init__(self, hass, client, zone, zone_type):

View file

@ -1,7 +1,7 @@
"""Support for the for Danfoss Air HRV binary sensors.""" """Support for the for Danfoss Air HRV binary sensors."""
from pydanfossair.commands import ReadCommand from pydanfossair.commands import ReadCommand
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import DOMAIN as DANFOSS_AIR_DOMAIN from . import DOMAIN as DANFOSS_AIR_DOMAIN
@ -23,7 +23,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(dev, True) add_entities(dev, True)
class DanfossAirBinarySensor(BinarySensorDevice): class DanfossAirBinarySensor(BinarySensorEntity):
"""Representation of a Danfoss Air binary sensor.""" """Representation of a Danfoss Air binary sensor."""
def __init__(self, data, name, sensor_type, device_class): def __init__(self, data, name, sensor_type, device_class):

View file

@ -1,7 +1,7 @@
"""Support for deCONZ binary sensors.""" """Support for deCONZ binary sensors."""
from pydeconz.sensor import Presence, Vibration from pydeconz.sensor import Presence, Vibration
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import ATTR_TEMPERATURE from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -53,7 +53,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class DeconzBinarySensor(DeconzDevice, BinarySensorDevice): class DeconzBinarySensor(DeconzDevice, BinarySensorEntity):
"""Representation of a deCONZ binary sensor.""" """Representation of a deCONZ binary sensor."""
@callback @callback

View file

@ -1,5 +1,5 @@
"""Demo platform that has two fake binary sensors.""" """Demo platform that has two fake binary sensors."""
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import DOMAIN from . import DOMAIN
@ -19,7 +19,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
await async_setup_platform(hass, {}, async_add_entities) await async_setup_platform(hass, {}, async_add_entities)
class DemoBinarySensor(BinarySensorDevice): class DemoBinarySensor(BinarySensorEntity):
"""representation of a Demo binary sensor.""" """representation of a Demo binary sensor."""
def __init__(self, unique_id, name, state, device_class): def __init__(self, unique_id, name, state, device_class):

View file

@ -3,7 +3,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ATTR_ATTRIBUTION from homeassistant.const import ATTR_ATTRIBUTION
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -50,7 +50,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(dev, True) add_entities(dev, True)
class DigitalOceanBinarySensor(BinarySensorDevice): class DigitalOceanBinarySensor(BinarySensorEntity):
"""Representation of a Digital Ocean droplet sensor.""" """Representation of a Digital Ocean droplet sensor."""
def __init__(self, do, droplet_id): def __init__(self, do, droplet_id):

View file

@ -1,7 +1,7 @@
"""Support for Ecobee binary sensors.""" """Support for Ecobee binary sensors."""
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OCCUPANCY,
BinarySensorDevice, BinarySensorEntity,
) )
from .const import _LOGGER, DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER from .const import _LOGGER, DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
@ -22,7 +22,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(dev, True) async_add_entities(dev, True)
class EcobeeBinarySensor(BinarySensorDevice): class EcobeeBinarySensor(BinarySensorEntity):
"""Representation of an Ecobee sensor.""" """Representation of an Ecobee sensor."""
def __init__(self, data, sensor_name, sensor_index): def __init__(self, data, sensor_name, sensor_index):

View file

@ -1,7 +1,7 @@
"""Interfaces with Egardia/Woonveilig alarm control panel.""" """Interfaces with Egardia/Woonveilig alarm control panel."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.const import STATE_OFF, STATE_ON
from . import ATTR_DISCOVER_DEVICES, EGARDIA_DEVICE from . import ATTR_DISCOVER_DEVICES, EGARDIA_DEVICE
@ -38,7 +38,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
) )
class EgardiaBinarySensor(BinarySensorDevice): class EgardiaBinarySensor(BinarySensorEntity):
"""Represents a sensor based on an Egardia sensor (IR, Door Contact).""" """Represents a sensor based on an Egardia sensor (IR, Door Contact)."""
def __init__(self, sensor_id, name, egardia_system, device_class): def __init__(self, sensor_id, name, egardia_system, device_class):

View file

@ -1,7 +1,7 @@
"""Support for Eight Sleep binary sensors.""" """Support for Eight Sleep binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import CONF_BINARY_SENSORS, DATA_EIGHT, NAME_MAP, EightSleepHeatEntity from . import CONF_BINARY_SENSORS, DATA_EIGHT, NAME_MAP, EightSleepHeatEntity
@ -25,7 +25,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(all_sensors, True) async_add_entities(all_sensors, True)
class EightHeatSensor(EightSleepHeatEntity, BinarySensorDevice): class EightHeatSensor(EightSleepHeatEntity, BinarySensorEntity):
"""Representation of a Eight Sleep heat-based sensor.""" """Representation of a Eight Sleep heat-based sensor."""
def __init__(self, name, eight, sensor): def __init__(self, name, eight, sensor):

View file

@ -7,7 +7,7 @@ from homeassistant.components import enocean
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ID, CONF_NAME from homeassistant.const import CONF_DEVICE_CLASS, CONF_ID, CONF_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -36,7 +36,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([EnOceanBinarySensor(dev_id, dev_name, device_class)]) add_entities([EnOceanBinarySensor(dev_id, dev_name, device_class)])
class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorDevice): class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorEntity):
"""Representation of EnOcean binary sensors such as wall switches. """Representation of EnOcean binary sensors such as wall switches.
Supported EEPs (EnOcean Equipment Profiles): Supported EEPs (EnOcean Equipment Profiles):

View file

@ -2,7 +2,7 @@
import datetime import datetime
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import ATTR_LAST_TRIP_TIME from homeassistant.const import ATTR_LAST_TRIP_TIME
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -40,7 +40,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(devices) async_add_entities(devices)
class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice): class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorEntity):
"""Representation of an Envisalink binary sensor.""" """Representation of an Envisalink binary sensor."""
def __init__(self, hass, zone_number, zone_name, zone_type, info, controller): def __init__(self, hass, zone_number, zone_name, zone_type, info, controller):

View file

@ -3,7 +3,7 @@ from typing import Optional
from aioesphomeapi import BinarySensorInfo, BinarySensorState from aioesphomeapi import BinarySensorInfo, BinarySensorState
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import EsphomeEntity, platform_async_setup_entry from . import EsphomeEntity, platform_async_setup_entry
@ -21,7 +21,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
) )
class EsphomeBinarySensor(EsphomeEntity, BinarySensorDevice): class EsphomeBinarySensor(EsphomeEntity, BinarySensorEntity):
"""A binary sensor implementation for ESPHome.""" """A binary sensor implementation for ESPHome."""
@property @property

View file

@ -4,7 +4,7 @@ import logging
import haffmpeg.sensor as ffmpeg_sensor import haffmpeg.sensor as ffmpeg_sensor
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.components.ffmpeg import ( from homeassistant.components.ffmpeg import (
CONF_EXTRA_ARGUMENTS, CONF_EXTRA_ARGUMENTS,
CONF_INITIAL_STATE, CONF_INITIAL_STATE,
@ -55,7 +55,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([entity]) async_add_entities([entity])
class FFmpegBinarySensor(FFmpegBase, BinarySensorDevice): class FFmpegBinarySensor(FFmpegBase, BinarySensorEntity):
"""A binary sensor which use FFmpeg for noise detection.""" """A binary sensor which use FFmpeg for noise detection."""
def __init__(self, config): def __init__(self, config):

View file

@ -1,7 +1,7 @@
"""Support for Fibaro binary sensors.""" """Support for Fibaro binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice from homeassistant.components.binary_sensor import DOMAIN, BinarySensorEntity
from homeassistant.const import CONF_DEVICE_CLASS, CONF_ICON from homeassistant.const import CONF_DEVICE_CLASS, CONF_ICON
from . import FIBARO_DEVICES, FibaroDevice from . import FIBARO_DEVICES, FibaroDevice
@ -33,7 +33,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
) )
class FibaroBinarySensor(FibaroDevice, BinarySensorDevice): class FibaroBinarySensor(FibaroDevice, BinarySensorEntity):
"""Representation of a Fibaro Binary Sensor.""" """Representation of a Fibaro Binary Sensor."""
def __init__(self, fibaro_device): def __init__(self, fibaro_device):

View file

@ -12,7 +12,7 @@ from pyflic import (
) )
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ( from homeassistant.const import (
CONF_DISCOVERY, CONF_DISCOVERY,
CONF_HOST, CONF_HOST,
@ -123,7 +123,7 @@ def setup_button(hass, config, add_entities, client, address):
add_entities([button]) add_entities([button])
class FlicButton(BinarySensorDevice): class FlicButton(BinarySensorEntity):
"""Representation of a flic button.""" """Representation of a flic button."""
def __init__(self, hass, client, address, timeout, ignored_click_types): def __init__(self, hass, client, address, timeout, ignored_click_types):

View file

@ -1,7 +1,7 @@
"""Support for Fritzbox binary sensors.""" """Support for Fritzbox binary sensors."""
import requests import requests
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_DEVICES from homeassistant.const import CONF_DEVICES
from .const import CONF_CONNECTIONS, DOMAIN as FRITZBOX_DOMAIN, LOGGER from .const import CONF_CONNECTIONS, DOMAIN as FRITZBOX_DOMAIN, LOGGER
@ -21,7 +21,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities, True) async_add_entities(entities, True)
class FritzboxBinarySensor(BinarySensorDevice): class FritzboxBinarySensor(BinarySensorEntity):
"""Representation of a binary Fritzbox device.""" """Representation of a binary Fritzbox device."""
def __init__(self, device, fritz): def __init__(self, device, fritz):

View file

@ -1,7 +1,7 @@
"""Support for binary sensor using GC100.""" """Support for binary sensor using GC100."""
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -26,7 +26,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(binary_sensors, True) add_entities(binary_sensors, True)
class GC100BinarySensor(BinarySensorDevice): class GC100BinarySensor(BinarySensorEntity):
"""Representation of a binary sensor from GC100.""" """Representation of a binary sensor from GC100."""
def __init__(self, name, port_addr, gc100): def __init__(self, name, port_addr, gc100):

View file

@ -1,5 +1,5 @@
"""Support for Genius Hub binary_sensor devices.""" """Support for Genius Hub binary_sensor devices."""
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.helpers.typing import ConfigType, HomeAssistantType from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from . import DOMAIN, GeniusDevice from . import DOMAIN, GeniusDevice
@ -25,7 +25,7 @@ async def async_setup_platform(
async_add_entities(switches, update_before_add=True) async_add_entities(switches, update_before_add=True)
class GeniusBinarySensor(GeniusDevice, BinarySensorDevice): class GeniusBinarySensor(GeniusDevice, BinarySensorEntity):
"""Representation of a Genius Hub binary_sensor.""" """Representation of a Genius Hub binary_sensor."""
def __init__(self, broker, device, state_attr) -> None: def __init__(self, broker, device, state_attr) -> None:

View file

@ -5,7 +5,7 @@ import logging
from pyhik.hikvision import HikCamera from pyhik.hikvision import HikCamera
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ( from homeassistant.const import (
ATTR_LAST_TRIP_TIME, ATTR_LAST_TRIP_TIME,
CONF_CUSTOMIZE, CONF_CUSTOMIZE,
@ -183,7 +183,7 @@ class HikvisionData:
return self.camdata.fetch_attributes(sensor, channel) return self.camdata.fetch_attributes(sensor, channel)
class HikvisionBinarySensor(BinarySensorDevice): class HikvisionBinarySensor(BinarySensorEntity):
"""Representation of a Hikvision binary sensor.""" """Representation of a Hikvision binary sensor."""
def __init__(self, hass, sensor, channel, cam, delay): def __init__(self, hass, sensor, channel, cam, delay):

View file

@ -1,5 +1,5 @@
"""Support for the Hive binary sensors.""" """Support for the Hive binary sensors."""
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import DATA_HIVE, DOMAIN, HiveEntity from . import DATA_HIVE, DOMAIN, HiveEntity
@ -18,7 +18,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devs) add_entities(devs)
class HiveBinarySensorEntity(HiveEntity, BinarySensorDevice): class HiveBinarySensorEntity(HiveEntity, BinarySensorEntity):
"""Representation of a Hive binary sensor.""" """Representation of a Hive binary sensor."""
@property @property

View file

@ -9,7 +9,7 @@ from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OCCUPANCY,
DEVICE_CLASS_OPENING, DEVICE_CLASS_OPENING,
DEVICE_CLASS_SMOKE, DEVICE_CLASS_SMOKE,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.core import callback from homeassistant.core import callback
@ -18,7 +18,7 @@ from . import KNOWN_DEVICES, HomeKitEntity
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
class HomeKitMotionSensor(HomeKitEntity, BinarySensorDevice): class HomeKitMotionSensor(HomeKitEntity, BinarySensorEntity):
"""Representation of a Homekit motion sensor.""" """Representation of a Homekit motion sensor."""
def get_characteristic_types(self): def get_characteristic_types(self):
@ -36,7 +36,7 @@ class HomeKitMotionSensor(HomeKitEntity, BinarySensorDevice):
return self.service.value(CharacteristicsTypes.MOTION_DETECTED) return self.service.value(CharacteristicsTypes.MOTION_DETECTED)
class HomeKitContactSensor(HomeKitEntity, BinarySensorDevice): class HomeKitContactSensor(HomeKitEntity, BinarySensorEntity):
"""Representation of a Homekit contact sensor.""" """Representation of a Homekit contact sensor."""
def get_characteristic_types(self): def get_characteristic_types(self):
@ -54,7 +54,7 @@ class HomeKitContactSensor(HomeKitEntity, BinarySensorDevice):
return self.service.value(CharacteristicsTypes.CONTACT_STATE) == 1 return self.service.value(CharacteristicsTypes.CONTACT_STATE) == 1
class HomeKitSmokeSensor(HomeKitEntity, BinarySensorDevice): class HomeKitSmokeSensor(HomeKitEntity, BinarySensorEntity):
"""Representation of a Homekit smoke sensor.""" """Representation of a Homekit smoke sensor."""
@property @property
@ -72,7 +72,7 @@ class HomeKitSmokeSensor(HomeKitEntity, BinarySensorDevice):
return self.service.value(CharacteristicsTypes.SMOKE_DETECTED) == 1 return self.service.value(CharacteristicsTypes.SMOKE_DETECTED) == 1
class HomeKitOccupancySensor(HomeKitEntity, BinarySensorDevice): class HomeKitOccupancySensor(HomeKitEntity, BinarySensorEntity):
"""Representation of a Homekit occupancy sensor.""" """Representation of a Homekit occupancy sensor."""
@property @property
@ -90,7 +90,7 @@ class HomeKitOccupancySensor(HomeKitEntity, BinarySensorDevice):
return self.service.value(CharacteristicsTypes.OCCUPANCY_DETECTED) == 1 return self.service.value(CharacteristicsTypes.OCCUPANCY_DETECTED) == 1
class HomeKitLeakSensor(HomeKitEntity, BinarySensorDevice): class HomeKitLeakSensor(HomeKitEntity, BinarySensorEntity):
"""Representation of a Homekit leak sensor.""" """Representation of a Homekit leak sensor."""
def get_characteristic_types(self): def get_characteristic_types(self):

View file

@ -7,7 +7,7 @@ from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OPENING, DEVICE_CLASS_OPENING,
DEVICE_CLASS_PRESENCE, DEVICE_CLASS_PRESENCE,
DEVICE_CLASS_SMOKE, DEVICE_CLASS_SMOKE,
BinarySensorDevice, BinarySensorEntity,
) )
from .const import ATTR_DISCOVER_DEVICES, ATTR_DISCOVERY_TYPE, DISCOVER_BATTERY from .const import ATTR_DISCOVER_DEVICES, ATTR_DISCOVERY_TYPE, DISCOVER_BATTERY
@ -48,7 +48,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True) add_entities(devices, True)
class HMBinarySensor(HMDevice, BinarySensorDevice): class HMBinarySensor(HMDevice, BinarySensorEntity):
"""Representation of a binary HomeMatic device.""" """Representation of a binary HomeMatic device."""
@property @property
@ -73,7 +73,7 @@ class HMBinarySensor(HMDevice, BinarySensorDevice):
self._data.update({self._state: None}) self._data.update({self._state: None})
class HMBatterySensor(HMDevice, BinarySensorDevice): class HMBatterySensor(HMDevice, BinarySensorEntity):
"""Representation of an HomeMatic low battery sensor.""" """Representation of an HomeMatic low battery sensor."""
@property @property

View file

@ -36,7 +36,7 @@ from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PRESENCE, DEVICE_CLASS_PRESENCE,
DEVICE_CLASS_SAFETY, DEVICE_CLASS_SAFETY,
DEVICE_CLASS_SMOKE, DEVICE_CLASS_SMOKE,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.typing import HomeAssistantType
@ -131,7 +131,7 @@ async def async_setup_entry(
async_add_entities(entities) async_add_entities(entities)
class HomematicipAccelerationSensor(HomematicipGenericDevice, BinarySensorDevice): class HomematicipAccelerationSensor(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud acceleration sensor.""" """Representation of a HomematicIP Cloud acceleration sensor."""
@property @property
@ -157,7 +157,7 @@ class HomematicipAccelerationSensor(HomematicipGenericDevice, BinarySensorDevice
return state_attr return state_attr
class HomematicipContactInterface(HomematicipGenericDevice, BinarySensorDevice): class HomematicipContactInterface(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud contact interface.""" """Representation of a HomematicIP Cloud contact interface."""
@property @property
@ -173,7 +173,7 @@ class HomematicipContactInterface(HomematicipGenericDevice, BinarySensorDevice):
return self._device.windowState != WindowState.CLOSED return self._device.windowState != WindowState.CLOSED
class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice): class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud shutter contact.""" """Representation of a HomematicIP Cloud shutter contact."""
@property @property
@ -189,7 +189,7 @@ class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice):
return self._device.windowState != WindowState.CLOSED return self._device.windowState != WindowState.CLOSED
class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorDevice): class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud motion detector.""" """Representation of a HomematicIP Cloud motion detector."""
@property @property
@ -203,7 +203,7 @@ class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorDevice):
return self._device.motionDetected return self._device.motionDetected
class HomematicipPresenceDetector(HomematicipGenericDevice, BinarySensorDevice): class HomematicipPresenceDetector(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud presence detector.""" """Representation of a HomematicIP Cloud presence detector."""
@property @property
@ -217,7 +217,7 @@ class HomematicipPresenceDetector(HomematicipGenericDevice, BinarySensorDevice):
return self._device.presenceDetected return self._device.presenceDetected
class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorDevice): class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud smoke detector.""" """Representation of a HomematicIP Cloud smoke detector."""
@property @property
@ -236,7 +236,7 @@ class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorDevice):
return False return False
class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorDevice): class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud water detector.""" """Representation of a HomematicIP Cloud water detector."""
@property @property
@ -250,7 +250,7 @@ class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorDevice):
return self._device.moistureDetected or self._device.waterlevelDetected return self._device.moistureDetected or self._device.waterlevelDetected
class HomematicipStormSensor(HomematicipGenericDevice, BinarySensorDevice): class HomematicipStormSensor(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud storm sensor.""" """Representation of a HomematicIP Cloud storm sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None: def __init__(self, hap: HomematicipHAP, device) -> None:
@ -268,7 +268,7 @@ class HomematicipStormSensor(HomematicipGenericDevice, BinarySensorDevice):
return self._device.storm return self._device.storm
class HomematicipRainSensor(HomematicipGenericDevice, BinarySensorDevice): class HomematicipRainSensor(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud rain sensor.""" """Representation of a HomematicIP Cloud rain sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None: def __init__(self, hap: HomematicipHAP, device) -> None:
@ -286,7 +286,7 @@ class HomematicipRainSensor(HomematicipGenericDevice, BinarySensorDevice):
return self._device.raining return self._device.raining
class HomematicipSunshineSensor(HomematicipGenericDevice, BinarySensorDevice): class HomematicipSunshineSensor(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud sunshine sensor.""" """Representation of a HomematicIP Cloud sunshine sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None: def __init__(self, hap: HomematicipHAP, device) -> None:
@ -315,7 +315,7 @@ class HomematicipSunshineSensor(HomematicipGenericDevice, BinarySensorDevice):
return state_attr return state_attr
class HomematicipBatterySensor(HomematicipGenericDevice, BinarySensorDevice): class HomematicipBatterySensor(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud low battery sensor.""" """Representation of a HomematicIP Cloud low battery sensor."""
def __init__(self, hap: HomematicipHAP, device) -> None: def __init__(self, hap: HomematicipHAP, device) -> None:
@ -334,7 +334,7 @@ class HomematicipBatterySensor(HomematicipGenericDevice, BinarySensorDevice):
class HomematicipPluggableMainsFailureSurveillanceSensor( class HomematicipPluggableMainsFailureSurveillanceSensor(
HomematicipGenericDevice, BinarySensorDevice HomematicipGenericDevice, BinarySensorEntity
): ):
"""Representation of a HomematicIP Cloud pluggable mains failure surveillance sensor.""" """Representation of a HomematicIP Cloud pluggable mains failure surveillance sensor."""
@ -353,7 +353,7 @@ class HomematicipPluggableMainsFailureSurveillanceSensor(
return not self._device.powerMainsFailure return not self._device.powerMainsFailure
class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorDevice): class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorEntity):
"""Representation of a HomematicIP Cloud security zone group.""" """Representation of a HomematicIP Cloud security zone group."""
def __init__(self, hap: HomematicipHAP, device, post: str = "SecurityZone") -> None: def __init__(self, hap: HomematicipHAP, device, post: str = "SecurityZone") -> None:
@ -409,7 +409,7 @@ class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorD
class HomematicipSecuritySensorGroup( class HomematicipSecuritySensorGroup(
HomematicipSecurityZoneSensorGroup, BinarySensorDevice HomematicipSecurityZoneSensorGroup, BinarySensorEntity
): ):
"""Representation of a HomematicIP security group.""" """Representation of a HomematicIP security group."""

View file

@ -8,7 +8,7 @@ from huawei_lte_api.enums.cradle import ConnectionStatusEnum
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR_DOMAIN, DOMAIN as BINARY_SENSOR_DOMAIN,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_URL from homeassistant.const import CONF_URL
@ -33,7 +33,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
@attr.s @attr.s
class HuaweiLteBaseBinarySensor(HuaweiLteBaseEntity, BinarySensorDevice): class HuaweiLteBaseBinarySensor(HuaweiLteBaseEntity, BinarySensorEntity):
"""Huawei LTE binary sensor device base class.""" """Huawei LTE binary sensor device base class."""
key: str key: str

View file

@ -4,7 +4,7 @@ from aiohue.sensors import TYPE_ZLL_PRESENCE
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION, DEVICE_CLASS_MOTION,
BinarySensorDevice, BinarySensorEntity,
) )
from .const import DOMAIN as HUE_DOMAIN from .const import DOMAIN as HUE_DOMAIN
@ -20,7 +20,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
].sensor_manager.async_register_component("binary_sensor", async_add_entities) ].sensor_manager.async_register_component("binary_sensor", async_add_entities)
class HuePresence(GenericZLLSensor, BinarySensorDevice): class HuePresence(GenericZLLSensor, BinarySensorEntity):
"""The presence sensor entity for a Hue motion sensor device.""" """The presence sensor entity for a Hue motion sensor device."""
device_class = DEVICE_CLASS_MOTION device_class = DEVICE_CLASS_MOTION

View file

@ -3,7 +3,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.const import CONF_MONITORED_CONDITIONS
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(sensors, True) add_entities(sensors, True)
class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorDevice): class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorEntity):
"""A sensor implementation for Hydrawise device.""" """A sensor implementation for Hydrawise device."""
@property @property

View file

@ -4,7 +4,7 @@ import logging
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_COLD, DEVICE_CLASS_COLD,
DOMAIN, DOMAIN,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.typing import HomeAssistantType
@ -27,7 +27,7 @@ async def async_setup_entry(
async_add_entities(devs, True) async_add_entities(devs, True)
class HassAqualinkBinarySensor(AqualinkEntity, BinarySensorDevice): class HassAqualinkBinarySensor(AqualinkEntity, BinarySensorEntity):
"""Representation of a binary sensor.""" """Representation of a binary sensor."""
@property @property

View file

@ -1,5 +1,5 @@
"""Support for IHC binary sensors.""" """Support for IHC binary sensors."""
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_TYPE from homeassistant.const import CONF_TYPE
from . import IHC_CONTROLLER, IHC_INFO from . import IHC_CONTROLLER, IHC_INFO
@ -35,7 +35,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices) add_entities(devices)
class IHCBinarySensor(IHCDevice, BinarySensorDevice): class IHCBinarySensor(IHCDevice, BinarySensorEntity):
"""IHC Binary Sensor. """IHC Binary Sensor.
The associated IHC resource can be any in or output from a IHC product The associated IHC resource can be any in or output from a IHC product

View file

@ -3,7 +3,7 @@ from typing import Any, Dict, Optional
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR_DOMAIN, DOMAIN as BINARY_SENSOR_DOMAIN,
BinarySensorDevice, BinarySensorEntity,
) )
from . import DOMAIN, IncomfortChild from . import DOMAIN, IncomfortChild
@ -20,7 +20,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([IncomfortFailed(client, h) for h in heaters]) async_add_entities([IncomfortFailed(client, h) for h in heaters])
class IncomfortFailed(IncomfortChild, BinarySensorDevice): class IncomfortFailed(IncomfortChild, BinarySensorEntity):
"""Representation of an InComfort Failed sensor.""" """Representation of an InComfort Failed sensor."""
def __init__(self, client, heater) -> None: def __init__(self, client, heater) -> None:

View file

@ -1,7 +1,7 @@
"""Support for INSTEON dimmers via PowerLinc Modem.""" """Support for INSTEON dimmers via PowerLinc Modem."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from .insteon_entity import InsteonEntity from .insteon_entity import InsteonEntity
@ -38,7 +38,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([new_entity]) async_add_entities([new_entity])
class InsteonBinarySensor(InsteonEntity, BinarySensorDevice): class InsteonBinarySensor(InsteonEntity, BinarySensorEntity):
"""A Class for an Insteon device entity.""" """A Class for an Insteon device entity."""
def __init__(self, device, state_key): def __init__(self, device, state_key):

View file

@ -6,7 +6,7 @@ import pyiss
import requests import requests
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ( from homeassistant.const import (
ATTR_LATITUDE, ATTR_LATITUDE,
ATTR_LONGITUDE, ATTR_LONGITUDE,
@ -53,7 +53,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([IssBinarySensor(iss_data, name, show_on_map)], True) add_entities([IssBinarySensor(iss_data, name, show_on_map)], True)
class IssBinarySensor(BinarySensorDevice): class IssBinarySensor(BinarySensorEntity):
"""Implementation of the ISS binary sensor.""" """Implementation of the ISS binary sensor."""
def __init__(self, iss_data, name, show): def __init__(self, iss_data, name, show):

View file

@ -3,7 +3,7 @@ from datetime import timedelta
import logging import logging
from typing import Callable from typing import Callable
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice from homeassistant.components.binary_sensor import DOMAIN, BinarySensorEntity
from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.event import async_track_point_in_utc_time from homeassistant.helpers.event import async_track_point_in_utc_time
@ -31,7 +31,7 @@ def setup_platform(
for node in hass.data[ISY994_NODES][DOMAIN]: for node in hass.data[ISY994_NODES][DOMAIN]:
if node.parent_node is None: if node.parent_node is None:
device = ISYBinarySensorDevice(node) device = ISYBinarySensorEntity(node)
devices.append(device) devices.append(device)
devices_by_nid[node.nid] = device devices_by_nid[node.nid] = device
else: else:
@ -66,7 +66,7 @@ def setup_platform(
else: else:
# We don't yet have any special logic for other sensor types, # We don't yet have any special logic for other sensor types,
# so add the nodes as individual devices # so add the nodes as individual devices
device = ISYBinarySensorDevice(node) device = ISYBinarySensorEntity(node)
devices.append(device) devices.append(device)
for name, status, _ in hass.data[ISY994_PROGRAMS][DOMAIN]: for name, status, _ in hass.data[ISY994_PROGRAMS][DOMAIN]:
@ -95,7 +95,7 @@ def _is_val_unknown(val):
return val == -1 * float("inf") return val == -1 * float("inf")
class ISYBinarySensorDevice(ISYDevice, BinarySensorDevice): class ISYBinarySensorEntity(ISYDevice, BinarySensorEntity):
"""Representation of an ISY994 binary sensor device. """Representation of an ISY994 binary sensor device.
Often times, a single device is represented by multiple nodes in the ISY, Often times, a single device is represented by multiple nodes in the ISY,
@ -253,7 +253,7 @@ class ISYBinarySensorDevice(ISYDevice, BinarySensorDevice):
return self._device_class_from_type return self._device_class_from_type
class ISYBinarySensorHeartbeat(ISYDevice, BinarySensorDevice): class ISYBinarySensorHeartbeat(ISYDevice, BinarySensorEntity):
"""Representation of the battery state of an ISY994 sensor.""" """Representation of the battery state of an ISY994 sensor."""
def __init__(self, node, parent_device) -> None: def __init__(self, node, parent_device) -> None:
@ -353,7 +353,7 @@ class ISYBinarySensorHeartbeat(ISYDevice, BinarySensorDevice):
return attr return attr
class ISYBinarySensorProgram(ISYDevice, BinarySensorDevice): class ISYBinarySensorProgram(ISYDevice, BinarySensorEntity):
"""Representation of an ISY994 binary sensor program. """Representation of an ISY994 binary sensor program.
This does not need all of the subnode logic in the device version of binary This does not need all of the subnode logic in the device version of binary

View file

@ -3,7 +3,7 @@ import logging
import hdate import hdate
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
import homeassistant.util.dt as dt_util import homeassistant.util.dt as dt_util
from . import DOMAIN, SENSOR_TYPES from . import DOMAIN, SENSOR_TYPES
@ -24,7 +24,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
) )
class JewishCalendarBinarySensor(BinarySensorDevice): class JewishCalendarBinarySensor(BinarySensorEntity):
"""Representation of an Jewish Calendar binary sensor.""" """Representation of an Jewish Calendar binary sensor."""
def __init__(self, data, sensor, sensor_info): def __init__(self, data, sensor, sensor_info):

View file

@ -6,7 +6,7 @@ from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PLUG, DEVICE_CLASS_PLUG,
DEVICE_CLASS_POWER, DEVICE_CLASS_POWER,
DEVICE_CLASS_SAFETY, DEVICE_CLASS_SAFETY,
BinarySensorDevice, BinarySensorEntity,
) )
from . import DOMAIN from . import DOMAIN
@ -36,7 +36,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(sensors) async_add_entities(sensors)
class KebaBinarySensor(BinarySensorDevice): class KebaBinarySensor(BinarySensorEntity):
"""Representation of a binary sensor of a KEBA charging station.""" """Representation of a binary sensor of a KEBA charging station."""
def __init__(self, keba, key, name, entity_type, device_class): def __init__(self, keba, key, name, entity_type, device_class):

View file

@ -2,7 +2,7 @@
import voluptuous as vol import voluptuous as vol
from xknx.devices import BinarySensor from xknx.devices import BinarySensor
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME
from homeassistant.core import callback from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -102,7 +102,7 @@ def async_add_entities_config(hass, config, async_add_entities):
async_add_entities([entity]) async_add_entities([entity])
class KNXBinarySensor(BinarySensorDevice): class KNXBinarySensor(BinarySensorEntity):
"""Representation of a KNX binary sensor.""" """Representation of a KNX binary sensor."""
def __init__(self, device): def __init__(self, device):

View file

@ -1,7 +1,7 @@
"""Support for wired binary sensors attached to a Konnected device.""" """Support for wired binary sensors attached to a Konnected device."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
ATTR_STATE, ATTR_STATE,
@ -31,7 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors) async_add_entities(sensors)
class KonnectedBinarySensor(BinarySensorDevice): class KonnectedBinarySensor(BinarySensorEntity):
"""Representation of a Konnected binary sensor.""" """Representation of a Konnected binary sensor."""
def __init__(self, device_id, zone_num, data): def __init__(self, device_id, zone_num, data):

View file

@ -1,7 +1,7 @@
"""Support for LCN binary sensors.""" """Support for LCN binary sensors."""
import pypck import pypck
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_ADDRESS from homeassistant.const import CONF_ADDRESS
from . import LcnDevice from . import LcnDevice
@ -36,7 +36,7 @@ async def async_setup_platform(
async_add_entities(devices) async_add_entities(devices)
class LcnRegulatorLockSensor(LcnDevice, BinarySensorDevice): class LcnRegulatorLockSensor(LcnDevice, BinarySensorEntity):
"""Representation of a LCN binary sensor for regulator locks.""" """Representation of a LCN binary sensor for regulator locks."""
def __init__(self, config, address_connection): def __init__(self, config, address_connection):
@ -71,7 +71,7 @@ class LcnRegulatorLockSensor(LcnDevice, BinarySensorDevice):
self.async_write_ha_state() self.async_write_ha_state()
class LcnBinarySensor(LcnDevice, BinarySensorDevice): class LcnBinarySensor(LcnDevice, BinarySensorEntity):
"""Representation of a LCN binary sensor for binary sensor ports.""" """Representation of a LCN binary sensor for binary sensor ports."""
def __init__(self, config, address_connection): def __init__(self, config, address_connection):
@ -103,7 +103,7 @@ class LcnBinarySensor(LcnDevice, BinarySensorDevice):
self.async_write_ha_state() self.async_write_ha_state()
class LcnLockKeysSensor(LcnDevice, BinarySensorDevice): class LcnLockKeysSensor(LcnDevice, BinarySensorEntity):
"""Representation of a LCN sensor for key locks.""" """Representation of a LCN sensor for key locks."""
def __init__(self, config, address_connection): def __init__(self, config, address_connection):

View file

@ -3,7 +3,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from . import ( from . import (
@ -44,7 +44,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(dev, True) add_entities(dev, True)
class LinodeBinarySensor(BinarySensorDevice): class LinodeBinarySensor(BinarySensorEntity):
"""Representation of a Linode droplet sensor.""" """Representation of a Linode droplet sensor."""
def __init__(self, li, node_id): def __init__(self, li, node_id):

View file

@ -4,7 +4,7 @@ import logging
import lupupy.constants as CONST import lupupy.constants as CONST
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorDevice from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
from . import DOMAIN as LUPUSEC_DOMAIN, LupusecDevice from . import DOMAIN as LUPUSEC_DOMAIN, LupusecDevice
@ -29,7 +29,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices) add_entities(devices)
class LupusecBinarySensor(LupusecDevice, BinarySensorDevice): class LupusecBinarySensor(LupusecDevice, BinarySensorEntity):
"""A binary sensor implementation for Lupusec device.""" """A binary sensor implementation for Lupusec device."""
@property @property

View file

@ -3,7 +3,7 @@ from pylutron import OccupancyGroup
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OCCUPANCY,
BinarySensorDevice, BinarySensorEntity,
) )
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
@ -21,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devs) add_entities(devs)
class LutronOccupancySensor(LutronDevice, BinarySensorDevice): class LutronOccupancySensor(LutronDevice, BinarySensorEntity):
"""Representation of a Lutron Occupancy Group. """Representation of a Lutron Occupancy Group.
The Lutron integration API reports "occupancy groups" rather than The Lutron integration API reports "occupancy groups" rather than

View file

@ -3,7 +3,7 @@ from pylutron_caseta import OCCUPANCY_GROUP_OCCUPIED
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OCCUPANCY,
BinarySensorDevice, BinarySensorEntity,
) )
from . import LUTRON_CASETA_SMARTBRIDGE, LutronCasetaDevice from . import LUTRON_CASETA_SMARTBRIDGE, LutronCasetaDevice
@ -21,7 +21,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(entities, True) async_add_entities(entities, True)
class LutronOccupancySensor(LutronCasetaDevice, BinarySensorDevice): class LutronOccupancySensor(LutronCasetaDevice, BinarySensorEntity):
"""Representation of a Lutron occupancy group.""" """Representation of a Lutron occupancy group."""
@property @property

View file

@ -1,7 +1,7 @@
"""Support for MAX! binary sensors via MAX! Cube.""" """Support for MAX! binary sensors via MAX! Cube."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import DATA_KEY from . import DATA_KEY
@ -24,11 +24,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices) add_entities(devices)
class MaxCubeShutter(BinarySensorDevice): class MaxCubeShutter(BinarySensorEntity):
"""Representation of a MAX! Cube Binary Sensor device.""" """Representation of a MAX! Cube Binary Sensor device."""
def __init__(self, handler, name, rf_address): def __init__(self, handler, name, rf_address):
"""Initialize MAX! Cube BinarySensorDevice.""" """Initialize MAX! Cube BinarySensorEntity."""
self._name = name self._name = name
self._sensor_type = "window" self._sensor_type = "window"
self._rf_address = rf_address self._rf_address = rf_address
@ -42,7 +42,7 @@ class MaxCubeShutter(BinarySensorDevice):
@property @property
def name(self): def name(self):
"""Return the name of the BinarySensorDevice.""" """Return the name of the BinarySensorEntity."""
return self._name return self._name
@property @property

View file

@ -7,7 +7,7 @@ import busio # pylint: disable=import-error
import digitalio # pylint: disable=import-error import digitalio # pylint: disable=import-error
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -60,7 +60,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(binary_sensors, True) add_devices(binary_sensors, True)
class MCP23017BinarySensor(BinarySensorDevice): class MCP23017BinarySensor(BinarySensorEntity):
"""Represent a binary sensor that uses MCP23017.""" """Represent a binary sensor that uses MCP23017."""
def __init__(self, name, pin, pull_mode, invert_logic): def __init__(self, name, pin, pull_mode, invert_logic):

View file

@ -5,7 +5,7 @@ import logging
from meteoalertapi import Meteoalert from meteoalertapi import Meteoalert
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -49,7 +49,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([MeteoAlertBinarySensor(api, name)], True) add_entities([MeteoAlertBinarySensor(api, name)], True)
class MeteoAlertBinarySensor(BinarySensorDevice): class MeteoAlertBinarySensor(BinarySensorEntity):
"""Representation of a MeteoAlert binary sensor.""" """Representation of a MeteoAlert binary sensor."""
def __init__(self, api, name): def __init__(self, api, name):

View file

@ -2,7 +2,7 @@
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_CONNECTIVITY,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType from homeassistant.helpers.typing import HomeAssistantType
@ -24,7 +24,7 @@ async def async_setup_entry(
async_add_entities(entities, True) async_add_entities(entities, True)
class MinecraftServerStatusBinarySensor(MinecraftServerEntity, BinarySensorDevice): class MinecraftServerStatusBinarySensor(MinecraftServerEntity, BinarySensorEntity):
"""Representation of a Minecraft Server status binary sensor.""" """Representation of a Minecraft Server status binary sensor."""
def __init__(self, server: MinecraftServer) -> None: def __init__(self, server: MinecraftServer) -> None:

View file

@ -1,7 +1,7 @@
"""Binary sensor platform for mobile_app.""" """Binary sensor platform for mobile_app."""
from functools import partial from functools import partial
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_WEBHOOK_ID from homeassistant.const import CONF_WEBHOOK_ID
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -57,7 +57,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class MobileAppBinarySensor(MobileAppEntity, BinarySensorDevice): class MobileAppBinarySensor(MobileAppEntity, BinarySensorEntity):
"""Representation of an mobile app binary sensor.""" """Representation of an mobile app binary sensor."""
@property @property

View file

@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME, CONF_SLAVE from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME, CONF_SLAVE
from homeassistant.helpers import config_validation as cv from homeassistant.helpers import config_validation as cv
@ -73,7 +73,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(sensors) add_entities(sensors)
class ModbusBinarySensor(BinarySensorDevice): class ModbusBinarySensor(BinarySensorEntity):
"""Modbus binary sensor.""" """Modbus binary sensor."""
def __init__(self, hub, name, slave, address, device_class, input_type): def __init__(self, hub, name, slave, address, device_class, input_type):

View file

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components import binary_sensor, mqtt from homeassistant.components import binary_sensor, mqtt
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import ( from homeassistant.const import (
CONF_DEVICE, CONF_DEVICE,
@ -107,7 +107,7 @@ class MqttBinarySensor(
MqttAvailability, MqttAvailability,
MqttDiscoveryUpdate, MqttDiscoveryUpdate,
MqttEntityDeviceInfo, MqttEntityDeviceInfo,
BinarySensorDevice, BinarySensorEntity,
): ):
"""Representation a binary sensor that is updated by MQTT.""" """Representation a binary sensor that is updated by MQTT."""

View file

@ -3,7 +3,7 @@ import logging
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR_DOMAIN, DOMAIN as BINARY_SENSOR_DOMAIN,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.util import slugify from homeassistant.util import slugify
@ -29,7 +29,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(sensors) async_add_entities(sensors)
class EVBinarySensor(BinarySensorDevice): class EVBinarySensor(BinarySensorEntity):
"""Base EVSensor class. """Base EVSensor class.
The only real difference between sensors is which units and what The only real difference between sensors is which units and what

View file

@ -3,7 +3,7 @@ import logging
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_CONNECTIVITY,
BinarySensorDevice, BinarySensorEntity,
) )
from .const import ( from .const import (
@ -31,12 +31,12 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
for device in myq.devices.values(): for device in myq.devices.values():
if device.device_json[MYQ_DEVICE_FAMILY] == MYQ_DEVICE_FAMILY_GATEWAY: if device.device_json[MYQ_DEVICE_FAMILY] == MYQ_DEVICE_FAMILY_GATEWAY:
entities.append(MyQBinarySensorDevice(coordinator, device)) entities.append(MyQBinarySensorEntity(coordinator, device))
async_add_entities(entities, True) async_add_entities(entities, True)
class MyQBinarySensorDevice(BinarySensorDevice): class MyQBinarySensorEntity(BinarySensorEntity):
"""Representation of a MyQ gateway.""" """Representation of a MyQ gateway."""
def __init__(self, coordinator, device): def __init__(self, coordinator, device):

View file

@ -3,7 +3,7 @@ from homeassistant.components import mysensors
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DEVICE_CLASSES,
DOMAIN, DOMAIN,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import STATE_ON from homeassistant.const import STATE_ON
@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
) )
class MySensorsBinarySensor(mysensors.device.MySensorsEntity, BinarySensorDevice): class MySensorsBinarySensor(mysensors.device.MySensorsEntity, BinarySensorEntity):
"""Representation of a MySensors Binary Sensor child node.""" """Representation of a MySensors Binary Sensor child node."""
@property @property

View file

@ -1,7 +1,7 @@
"""Support for the myStrom buttons.""" """Support for the myStrom buttons."""
import logging import logging
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice from homeassistant.components.binary_sensor import DOMAIN, BinarySensorEntity
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView
from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY
from homeassistant.core import callback from homeassistant.core import callback
@ -59,7 +59,7 @@ class MyStromView(HomeAssistantView):
self.buttons[entity_id].async_on_update(new_state) self.buttons[entity_id].async_on_update(new_state)
class MyStromBinarySensor(BinarySensorDevice): class MyStromBinarySensor(BinarySensorEntity):
"""Representation of a myStrom button.""" """Representation of a myStrom button."""
def __init__(self, button_id): def __init__(self, button_id):

View file

@ -1,7 +1,7 @@
"""Support for Ness D8X/D16X zone states - represented as binary sensors.""" """Support for Ness D8X/D16X zone states - represented as binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -38,7 +38,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(devices) async_add_entities(devices)
class NessZoneBinarySensor(BinarySensorDevice): class NessZoneBinarySensor(BinarySensorEntity):
"""Representation of an Ness alarm zone as a binary sensor.""" """Representation of an Ness alarm zone as a binary sensor."""
def __init__(self, zone_id, name, zone_type): def __init__(self, zone_id, name, zone_type):

View file

@ -2,7 +2,7 @@
from itertools import chain from itertools import chain
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.const import CONF_MONITORED_CONDITIONS
from . import CONF_BINARY_SENSORS, DATA_NEST, DATA_NEST_CONFIG, NestSensorDevice from . import CONF_BINARY_SENSORS, DATA_NEST, DATA_NEST_CONFIG, NestSensorDevice
@ -114,7 +114,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(await hass.async_add_job(get_binary_sensors), True) async_add_entities(await hass.async_add_job(get_binary_sensors), True)
class NestBinarySensor(NestSensorDevice, BinarySensorDevice): class NestBinarySensor(NestSensorDevice, BinarySensorEntity):
"""Represents a Nest binary sensor.""" """Represents a Nest binary sensor."""
@property @property

View file

@ -1,7 +1,7 @@
"""Support for Netgear LTE binary sensors.""" """Support for Netgear LTE binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice from homeassistant.components.binary_sensor import DOMAIN, BinarySensorEntity
from homeassistant.exceptions import PlatformNotReady from homeassistant.exceptions import PlatformNotReady
from . import CONF_MONITORED_CONDITIONS, DATA_KEY, LTEEntity from . import CONF_MONITORED_CONDITIONS, DATA_KEY, LTEEntity
@ -30,7 +30,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info)
async_add_entities(binary_sensors) async_add_entities(binary_sensors)
class LTEBinarySensor(LTEEntity, BinarySensorDevice): class LTEBinarySensor(LTEEntity, BinarySensorEntity):
"""Netgear LTE binary sensor entity.""" """Netgear LTE binary sensor entity."""
@property @property

View file

@ -1,6 +1,6 @@
"""Support for Nexia / Trane XL Thermostats.""" """Support for Nexia / Trane XL Thermostats."""
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from .const import DOMAIN, NEXIA_DEVICE, UPDATE_COORDINATOR from .const import DOMAIN, NEXIA_DEVICE, UPDATE_COORDINATOR
from .entity import NexiaThermostatEntity from .entity import NexiaThermostatEntity
@ -34,7 +34,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities, True) async_add_entities(entities, True)
class NexiaBinarySensor(NexiaThermostatEntity, BinarySensorDevice): class NexiaBinarySensor(NexiaThermostatEntity, BinarySensorEntity):
"""Provices Nexia BinarySensor support.""" """Provices Nexia BinarySensor support."""
def __init__(self, coordinator, thermostat, sensor_call, sensor_name): def __init__(self, coordinator, thermostat, sensor_call, sensor_name):

View file

@ -1,7 +1,7 @@
"""Summary binary data from Nextcoud.""" """Summary binary data from Nextcoud."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import BINARY_SENSORS, DOMAIN from . import BINARY_SENSORS, DOMAIN
@ -19,7 +19,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(binary_sensors, True) add_entities(binary_sensors, True)
class NextcloudBinarySensor(BinarySensorDevice): class NextcloudBinarySensor(BinarySensorEntity):
"""Represents a Nextcloud binary sensor.""" """Represents a Nextcloud binary sensor."""
def __init__(self, item): def __init__(self, item):

View file

@ -1,7 +1,7 @@
"""Plugged In Status Support for the Nissan Leaf.""" """Plugged In Status Support for the Nissan Leaf."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import DATA_CHARGING, DATA_LEAF, DATA_PLUGGED_IN, LeafEntity from . import DATA_CHARGING, DATA_LEAF, DATA_PLUGGED_IN, LeafEntity
@ -22,7 +22,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True) add_entities(devices, True)
class LeafPluggedInSensor(LeafEntity, BinarySensorDevice): class LeafPluggedInSensor(LeafEntity, BinarySensorEntity):
"""Plugged In Sensor class.""" """Plugged In Sensor class."""
@property @property
@ -43,7 +43,7 @@ class LeafPluggedInSensor(LeafEntity, BinarySensorDevice):
return "mdi:power-plug-off" return "mdi:power-plug-off"
class LeafChargingSensor(LeafEntity, BinarySensorDevice): class LeafChargingSensor(LeafEntity, BinarySensorEntity):
"""Charging Sensor class.""" """Charging Sensor class."""
@property @property

View file

@ -1,7 +1,7 @@
"""Support for Notion binary sensors.""" """Support for Notion binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback from homeassistant.core import callback
from . import ( from . import (
@ -50,7 +50,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(sensor_list, True) async_add_entities(sensor_list, True)
class NotionBinarySensor(NotionEntity, BinarySensorDevice): class NotionBinarySensor(NotionEntity, BinarySensorEntity):
"""Define a Notion sensor.""" """Define a Notion sensor."""
@property @property

View file

@ -10,7 +10,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DEVICE_CLASSES,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -72,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return True return True
class NX584ZoneSensor(BinarySensorDevice): class NX584ZoneSensor(BinarySensorEntity):
"""Representation of a NX584 zone as a sensor.""" """Representation of a NX584 zone as a sensor."""
def __init__(self, zone, zone_type): def __init__(self, zone, zone_type):

View file

@ -3,7 +3,7 @@ import logging
import requests import requests
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import BINARY_SENSOR_TYPES, DOMAIN as COMPONENT_DOMAIN from . import BINARY_SENSOR_TYPES, DOMAIN as COMPONENT_DOMAIN
@ -36,7 +36,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True) add_entities(devices, True)
class OctoPrintBinarySensor(BinarySensorDevice): class OctoPrintBinarySensor(BinarySensorEntity):
"""Representation an OctoPrint binary sensor.""" """Representation an OctoPrint binary sensor."""
def __init__( def __init__(

View file

@ -1,7 +1,7 @@
"""Support for OpenTherm Gateway binary sensors.""" """Support for OpenTherm Gateway binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySensorDevice from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySensorEntity
from homeassistant.const import CONF_ID from homeassistant.const import CONF_ID
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -31,7 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(sensors) async_add_entities(sensors)
class OpenThermBinarySensor(BinarySensorDevice): class OpenThermBinarySensor(BinarySensorEntity):
"""Represent an OpenTherm Gateway binary sensor.""" """Represent an OpenTherm Gateway binary sensor."""
def __init__(self, gw_dev, var, device_class, friendly_name_format): def __init__(self, gw_dev, var, device_class, friendly_name_format):

View file

@ -1,7 +1,7 @@
"""Support for OpenUV binary sensors.""" """Support for OpenUV binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.util.dt import as_local, parse_datetime, utcnow from homeassistant.util.dt import as_local, parse_datetime, utcnow
@ -37,7 +37,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
async_add_entities(binary_sensors, True) async_add_entities(binary_sensors, True)
class OpenUvBinarySensor(OpenUvEntity, BinarySensorDevice): class OpenUvBinarySensor(OpenUvEntity, BinarySensorEntity):
"""Define a binary sensor for OpenUV.""" """Define a binary sensor for OpenUV."""
def __init__(self, openuv, sensor_type, name, icon, entry_id): def __init__(self, openuv, sensor_type, name, icon, entry_id):

View file

@ -1,6 +1,6 @@
"""Support for binary sensor using Orange Pi GPIO.""" """Support for binary sensor using Orange Pi GPIO."""
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from . import edge_detect, read_input, setup_input, setup_mode from . import edge_detect, read_input, setup_input, setup_mode
from .const import CONF_INVERT_LOGIC, CONF_PIN_MODE, CONF_PORTS, PORT_SCHEMA from .const import CONF_INVERT_LOGIC, CONF_PIN_MODE, CONF_PORTS, PORT_SCHEMA
@ -24,7 +24,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(binary_sensors) async_add_entities(binary_sensors)
class OPiGPIOBinarySensor(BinarySensorDevice): class OPiGPIOBinarySensor(BinarySensorEntity):
"""Represent a binary sensor that uses Orange Pi GPIO.""" """Represent a binary sensor that uses Orange Pi GPIO."""
def __init__(self, hass, name, port, invert_logic): def __init__(self, hass, name, port, invert_logic):

View file

@ -4,7 +4,7 @@ import logging
from pcal9535a import PCAL9535A from pcal9535a import PCAL9535A
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(binary_sensors, True) add_entities(binary_sensors, True)
class PCAL9535ABinarySensor(BinarySensorDevice): class PCAL9535ABinarySensor(BinarySensorEntity):
"""Represent a binary sensor that uses PCAL9535A.""" """Represent a binary sensor that uses PCAL9535A."""
def __init__(self, name, pin, pull_mode, invert_logic): def __init__(self, name, pin, pull_mode, invert_logic):

View file

@ -4,7 +4,7 @@ import logging
from pi4ioe5v9xxxx import pi4ioe5v9xxxx # pylint: disable=import-error from pi4ioe5v9xxxx import pi4ioe5v9xxxx # pylint: disable=import-error
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import DEVICE_DEFAULT_NAME from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -54,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(binary_sensors, True) add_entities(binary_sensors, True)
class Pi4ioe5v9BinarySensor(BinarySensorDevice): class Pi4ioe5v9BinarySensor(BinarySensorEntity):
"""Represent a binary sensor that uses pi4ioe5v9xxxx IO expander in read mode.""" """Represent a binary sensor that uses pi4ioe5v9xxxx IO expander in read mode."""
def __init__(self, name, pin, invert_logic): def __init__(self, name, pin, invert_logic):

View file

@ -5,7 +5,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components import pilight from homeassistant.components import pilight
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ( from homeassistant.const import (
CONF_DISARM_AFTER_TRIGGER, CONF_DISARM_AFTER_TRIGGER,
CONF_NAME, CONF_NAME,
@ -72,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
) )
class PilightBinarySensor(BinarySensorDevice): class PilightBinarySensor(BinarySensorEntity):
"""Representation of a binary sensor that can be updated using Pilight.""" """Representation of a binary sensor that can be updated using Pilight."""
def __init__(self, hass, name, variable, payload, on_value, off_value): def __init__(self, hass, name, variable, payload, on_value, off_value):
@ -121,7 +121,7 @@ class PilightBinarySensor(BinarySensorDevice):
self.schedule_update_ha_state() self.schedule_update_ha_state()
class PilightTriggerSensor(BinarySensorDevice): class PilightTriggerSensor(BinarySensorEntity):
"""Representation of a binary sensor that can be updated using Pilight.""" """Representation of a binary sensor that can be updated using Pilight."""
def __init__( def __init__(

View file

@ -7,7 +7,7 @@ import sys
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_HOST, CONF_NAME from homeassistant.const import CONF_HOST, CONF_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -54,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([PingBinarySensor(name, PingData(host, count))], True) add_entities([PingBinarySensor(name, PingData(host, count))], True)
class PingBinarySensor(BinarySensorDevice): class PingBinarySensor(BinarySensorEntity):
"""Representation of a Ping Binary sensor.""" """Representation of a Ping Binary sensor."""
def __init__(self, name, ping): def __init__(self, name, ping):

View file

@ -1,7 +1,7 @@
"""Support for Minut Point binary sensors.""" """Support for Minut Point binary sensors."""
import logging import logging
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice from homeassistant.components.binary_sensor import DOMAIN, BinarySensorEntity
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -63,7 +63,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
) )
class MinutPointBinarySensor(MinutPointEntity, BinarySensorDevice): class MinutPointBinarySensor(MinutPointEntity, BinarySensorEntity):
"""The platform class required by Home Assistant.""" """The platform class required by Home Assistant."""
def __init__(self, point_client, device_id, device_class): def __init__(self, point_client, device_id, device_class):

View file

@ -6,7 +6,7 @@ from tesla_powerwall import GridStatus
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY_CHARGING, DEVICE_CLASS_BATTERY_CHARGING,
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_CONNECTIVITY,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import DEVICE_CLASS_POWER from homeassistant.const import DEVICE_CLASS_POWER
@ -56,7 +56,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
async_add_entities(entities, True) async_add_entities(entities, True)
class PowerWallRunningSensor(PowerWallEntity, BinarySensorDevice): class PowerWallRunningSensor(PowerWallEntity, BinarySensorEntity):
"""Representation of an Powerwall running sensor.""" """Representation of an Powerwall running sensor."""
@property @property
@ -89,7 +89,7 @@ class PowerWallRunningSensor(PowerWallEntity, BinarySensorDevice):
} }
class PowerWallConnectedSensor(PowerWallEntity, BinarySensorDevice): class PowerWallConnectedSensor(PowerWallEntity, BinarySensorEntity):
"""Representation of an Powerwall connected sensor.""" """Representation of an Powerwall connected sensor."""
@property @property
@ -113,7 +113,7 @@ class PowerWallConnectedSensor(PowerWallEntity, BinarySensorDevice):
return self._coordinator.data[POWERWALL_API_SITEMASTER].connected_to_tesla return self._coordinator.data[POWERWALL_API_SITEMASTER].connected_to_tesla
class PowerWallGridStatusSensor(PowerWallEntity, BinarySensorDevice): class PowerWallGridStatusSensor(PowerWallEntity, BinarySensorEntity):
"""Representation of an Powerwall grid status sensor.""" """Representation of an Powerwall grid status sensor."""
@property @property
@ -137,7 +137,7 @@ class PowerWallGridStatusSensor(PowerWallEntity, BinarySensorDevice):
return self._coordinator.data[POWERWALL_API_GRID_STATUS] == GridStatus.CONNECTED return self._coordinator.data[POWERWALL_API_GRID_STATUS] == GridStatus.CONNECTED
class PowerWallChargingStatusSensor(PowerWallEntity, BinarySensorDevice): class PowerWallChargingStatusSensor(PowerWallEntity, BinarySensorEntity):
"""Representation of an Powerwall charging status sensor.""" """Representation of an Powerwall charging status sensor."""
@property @property

View file

@ -1,7 +1,7 @@
"""Binary sensor to read Proxmox VE data.""" """Binary sensor to read Proxmox VE data."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, CONF_HOST, CONF_PORT from homeassistant.const import ATTR_ATTRIBUTION, CONF_HOST, CONF_PORT
from . import CONF_CONTAINERS, CONF_NODES, CONF_VMS, PROXMOX_CLIENTS, ProxmoxItemType from . import CONF_CONTAINERS, CONF_NODES, CONF_VMS, PROXMOX_CLIENTS, ProxmoxItemType
@ -42,7 +42,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(sensors, True) add_entities(sensors, True)
class ProxmoxBinarySensor(BinarySensorDevice): class ProxmoxBinarySensor(BinarySensorEntity):
"""A binary sensor for reading Proxmox VE data.""" """A binary sensor for reading Proxmox VE data."""
def __init__(self, proxmox_client, item_node, item_type, item_id): def __init__(self, proxmox_client, item_node, item_type, item_id):

View file

@ -3,7 +3,7 @@ import logging
from pyqwikswitch.qwikswitch import SENSORS from pyqwikswitch.qwikswitch import SENSORS
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback from homeassistant.core import callback
from . import DOMAIN as QWIKSWITCH, QSEntity from . import DOMAIN as QWIKSWITCH, QSEntity
@ -22,7 +22,7 @@ async def async_setup_platform(hass, _, add_entities, discovery_info=None):
add_entities(devs) add_entities(devs)
class QSBinarySensor(QSEntity, BinarySensorDevice): class QSBinarySensor(QSEntity, BinarySensorEntity):
"""Sensor based on a Qwikswitch relay/dimmer module.""" """Sensor based on a Qwikswitch relay/dimmer module."""
_val = False _val = False

View file

@ -4,7 +4,7 @@ import logging
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_CONNECTIVITY,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -38,7 +38,7 @@ def _create_entities(hass, config_entry):
return entities return entities
class RachioControllerBinarySensor(RachioDevice, BinarySensorDevice): class RachioControllerBinarySensor(RachioDevice, BinarySensorEntity):
"""Represent a binary sensor that reflects a Rachio state.""" """Represent a binary sensor that reflects a Rachio state."""
def __init__(self, controller, poll=True): def __init__(self, controller, poll=True):

View file

@ -3,7 +3,7 @@ import logging
from pyrainbird import RainbirdController from pyrainbird import RainbirdController
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from . import ( from . import (
DATA_RAINBIRD, DATA_RAINBIRD,
@ -27,7 +27,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
) )
class RainBirdSensor(BinarySensorDevice): class RainBirdSensor(BinarySensorEntity):
"""A sensor implementation for Rain Bird device.""" """A sensor implementation for Rain Bird device."""
def __init__(self, controller: RainbirdController, sensor_type): def __init__(self, controller: RainbirdController, sensor_type):

View file

@ -3,7 +3,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_MONITORED_CONDITIONS from homeassistant.const import CONF_MONITORED_CONDITIONS
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -41,7 +41,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return True return True
class RainCloudBinarySensor(RainCloudEntity, BinarySensorDevice): class RainCloudBinarySensor(RainCloudEntity, BinarySensorEntity):
"""A sensor implementation for raincloud device.""" """A sensor implementation for raincloud device."""
@property @property

View file

@ -1,7 +1,7 @@
"""This platform provides binary sensors for key RainMachine data.""" """This platform provides binary sensors for key RainMachine data."""
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
@ -86,7 +86,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
) )
class RainMachineBinarySensor(RainMachineEntity, BinarySensorDevice): class RainMachineBinarySensor(RainMachineEntity, BinarySensorEntity):
"""A sensor implementation for raincloud device.""" """A sensor implementation for raincloud device."""
def __init__( def __init__(

View file

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -32,7 +32,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities([RandomSensor(name, device_class)], True) async_add_entities([RandomSensor(name, device_class)], True)
class RandomSensor(BinarySensorDevice): class RandomSensor(BinarySensorEntity):
"""Representation of a Random binary sensor.""" """Representation of a Random binary sensor."""
def __init__(self, name, device_class): def __init__(self, name, device_class):

View file

@ -3,7 +3,7 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import ( from homeassistant.const import (
CONF_ADDRESS, CONF_ADDRESS,
CONF_DEVICE_CLASS, CONF_DEVICE_CLASS,
@ -81,7 +81,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(binary_sensors) add_entities(binary_sensors)
class I2CHatBinarySensor(BinarySensorDevice): class I2CHatBinarySensor(BinarySensorEntity):
"""Representation of a binary sensor that uses a I2C-HAT digital input.""" """Representation of a binary sensor that uses a I2C-HAT digital input."""
I2C_HATS_MANAGER = None I2C_HATS_MANAGER = None

View file

@ -4,7 +4,7 @@ import logging
import requests import requests
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorDevice from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_HOST from homeassistant.const import CONF_HOST
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -57,7 +57,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(devices, True) add_entities(devices, True)
class RemoteRPiGPIOBinarySensor(BinarySensorDevice): class RemoteRPiGPIOBinarySensor(BinarySensorEntity):
"""Represent a binary sensor that uses a Remote Raspberry Pi GPIO.""" """Represent a binary sensor that uses a Remote Raspberry Pi GPIO."""
def __init__(self, name, button, invert_logic): def __init__(self, name, button, invert_logic):

View file

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import ( from homeassistant.const import (
CONF_AUTHENTICATION, CONF_AUTHENTICATION,
@ -91,7 +91,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities([RestBinarySensor(hass, rest, name, device_class, value_template)]) add_entities([RestBinarySensor(hass, rest, name, device_class, value_template)])
class RestBinarySensor(BinarySensorDevice): class RestBinarySensor(BinarySensorEntity):
"""Representation of a REST binary sensor.""" """Representation of a REST binary sensor."""
def __init__(self, hass, rest, name, device_class, value_template): def __init__(self, hass, rest, name, device_class, value_template):

View file

@ -6,7 +6,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import CONF_DEVICE_CLASS, CONF_FORCE_UPDATE, CONF_NAME from homeassistant.const import CONF_DEVICE_CLASS, CONF_FORCE_UPDATE, CONF_NAME
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -56,7 +56,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(devices_from_config(config)) async_add_entities(devices_from_config(config))
class RflinkBinarySensor(RflinkDevice, BinarySensorDevice): class RflinkBinarySensor(RflinkDevice, BinarySensorEntity):
"""Representation of an Rflink binary sensor.""" """Representation of an Rflink binary sensor."""
def __init__( def __init__(

View file

@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA, DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDevice, BinarySensorEntity,
) )
from homeassistant.const import ( from homeassistant.const import (
CONF_COMMAND_OFF, CONF_COMMAND_OFF,
@ -171,7 +171,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
RECEIVED_EVT_SUBSCRIBERS.append(binary_sensor_update) RECEIVED_EVT_SUBSCRIBERS.append(binary_sensor_update)
class RfxtrxBinarySensor(BinarySensorDevice): class RfxtrxBinarySensor(BinarySensorEntity):
"""A representation of a RFXtrx binary sensor.""" """A representation of a RFXtrx binary sensor."""
def __init__( def __init__(

Some files were not shown because too many files have changed in this diff Show more