From b022e08db9b722af39fe34ebd543d81be8e1744d Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 23 Apr 2020 21:57:07 +0200 Subject: [PATCH] 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 --- .../components/abode/binary_sensor.py | 4 +- homeassistant/components/ads/binary_sensor.py | 4 +- .../components/alarmdecoder/binary_sensor.py | 4 +- .../ambient_station/binary_sensor.py | 4 +- .../components/amcrest/binary_sensor.py | 4 +- .../android_ip_webcam/binary_sensor.py | 4 +- .../components/apcupsd/binary_sensor.py | 4 +- .../components/arest/binary_sensor.py | 4 +- .../components/august/binary_sensor.py | 6 +-- .../components/aurora/binary_sensor.py | 4 +- .../components/axis/binary_sensor.py | 4 +- .../components/bayesian/binary_sensor.py | 4 +- .../components/bbb_gpio/binary_sensor.py | 4 +- .../components/binary_sensor/__init__.py | 16 +++++++- .../components/blink/binary_sensor.py | 4 +- .../components/bloomsky/binary_sensor.py | 4 +- .../bmw_connected_drive/binary_sensor.py | 4 +- .../components/cloud/binary_sensor.py | 4 +- .../components/command_line/binary_sensor.py | 4 +- .../components/concord232/binary_sensor.py | 4 +- .../components/danfoss_air/binary_sensor.py | 4 +- .../components/deconz/binary_sensor.py | 4 +- .../components/demo/binary_sensor.py | 4 +- .../components/digital_ocean/binary_sensor.py | 4 +- .../components/ecobee/binary_sensor.py | 4 +- .../components/egardia/binary_sensor.py | 4 +- .../components/eight_sleep/binary_sensor.py | 4 +- .../components/enocean/binary_sensor.py | 4 +- .../components/envisalink/binary_sensor.py | 4 +- .../components/esphome/binary_sensor.py | 4 +- .../components/ffmpeg_motion/binary_sensor.py | 4 +- .../components/fibaro/binary_sensor.py | 4 +- .../components/flic/binary_sensor.py | 4 +- .../components/fritzbox/binary_sensor.py | 4 +- .../components/gc100/binary_sensor.py | 4 +- .../components/geniushub/binary_sensor.py | 4 +- .../components/hikvision/binary_sensor.py | 4 +- .../components/hive/binary_sensor.py | 4 +- .../homekit_controller/binary_sensor.py | 12 +++--- .../components/homematic/binary_sensor.py | 6 +-- .../homematicip_cloud/binary_sensor.py | 30 +++++++-------- .../components/huawei_lte/binary_sensor.py | 4 +- homeassistant/components/hue/binary_sensor.py | 4 +- .../components/hydrawise/binary_sensor.py | 4 +- .../components/iaqualink/binary_sensor.py | 4 +- homeassistant/components/ihc/binary_sensor.py | 4 +- .../components/incomfort/binary_sensor.py | 4 +- .../components/insteon/binary_sensor.py | 4 +- homeassistant/components/iss/binary_sensor.py | 4 +- .../components/isy994/binary_sensor.py | 12 +++--- .../jewish_calendar/binary_sensor.py | 4 +- .../components/keba/binary_sensor.py | 4 +- homeassistant/components/knx/binary_sensor.py | 4 +- .../components/konnected/binary_sensor.py | 4 +- homeassistant/components/lcn/binary_sensor.py | 8 ++-- .../components/linode/binary_sensor.py | 4 +- .../components/lupusec/binary_sensor.py | 4 +- .../components/lutron/binary_sensor.py | 4 +- .../components/lutron_caseta/binary_sensor.py | 4 +- .../components/maxcube/binary_sensor.py | 8 ++-- .../components/mcp23017/binary_sensor.py | 4 +- .../components/meteoalarm/binary_sensor.py | 4 +- .../minecraft_server/binary_sensor.py | 4 +- .../components/mobile_app/binary_sensor.py | 4 +- .../components/modbus/binary_sensor.py | 4 +- .../components/mqtt/binary_sensor.py | 4 +- .../components/mychevy/binary_sensor.py | 4 +- homeassistant/components/myq/binary_sensor.py | 6 +-- .../components/mysensors/binary_sensor.py | 4 +- .../components/mystrom/binary_sensor.py | 4 +- .../components/ness_alarm/binary_sensor.py | 4 +- .../components/nest/binary_sensor.py | 4 +- .../components/netgear_lte/binary_sensor.py | 4 +- .../components/nexia/binary_sensor.py | 4 +- .../components/nextcloud/binary_sensor.py | 4 +- .../components/nissan_leaf/binary_sensor.py | 6 +-- .../components/notion/binary_sensor.py | 4 +- .../components/nx584/binary_sensor.py | 4 +- .../components/octoprint/binary_sensor.py | 4 +- .../components/opentherm_gw/binary_sensor.py | 4 +- .../components/openuv/binary_sensor.py | 4 +- .../components/orangepi_gpio/binary_sensor.py | 4 +- .../components/pcal9535a/binary_sensor.py | 4 +- .../components/pi4ioe5v9xxxx/binary_sensor.py | 4 +- .../components/pilight/binary_sensor.py | 6 +-- .../components/ping/binary_sensor.py | 4 +- .../components/point/binary_sensor.py | 4 +- .../components/powerwall/binary_sensor.py | 10 ++--- .../components/proxmoxve/binary_sensor.py | 4 +- .../components/qwikswitch/binary_sensor.py | 4 +- .../components/rachio/binary_sensor.py | 4 +- .../components/rainbird/binary_sensor.py | 4 +- .../components/raincloud/binary_sensor.py | 4 +- .../components/rainmachine/binary_sensor.py | 4 +- .../components/random/binary_sensor.py | 4 +- .../components/raspihats/binary_sensor.py | 4 +- .../remote_rpi_gpio/binary_sensor.py | 4 +- .../components/rest/binary_sensor.py | 4 +- .../components/rflink/binary_sensor.py | 4 +- .../components/rfxtrx/binary_sensor.py | 4 +- .../components/ring/binary_sensor.py | 4 +- .../components/roomba/binary_sensor.py | 4 +- .../components/rpi_gpio/binary_sensor.py | 4 +- .../components/rpi_pfio/binary_sensor.py | 4 +- .../components/satel_integra/binary_sensor.py | 4 +- .../components/sense/binary_sensor.py | 4 +- .../components/skybell/binary_sensor.py | 4 +- .../components/sleepiq/binary_sensor.py | 4 +- .../components/smartthings/binary_sensor.py | 4 +- .../components/smarty/binary_sensor.py | 4 +- homeassistant/components/spc/binary_sensor.py | 4 +- .../components/starline/binary_sensor.py | 4 +- .../components/stookalert/binary_sensor.py | 4 +- .../streamlabswater/binary_sensor.py | 4 +- .../components/surepetcare/binary_sensor.py | 8 ++-- .../components/tahoma/binary_sensor.py | 4 +- .../components/tapsaff/binary_sensor.py | 4 +- homeassistant/components/tcp/binary_sensor.py | 4 +- .../components/tellduslive/binary_sensor.py | 4 +- .../components/template/binary_sensor.py | 4 +- .../components/tesla/binary_sensor.py | 4 +- .../components/threshold/binary_sensor.py | 4 +- homeassistant/components/tod/binary_sensor.py | 4 +- .../components/toon/binary_sensor.py | 4 +- .../components/totalconnect/binary_sensor.py | 4 +- .../components/trend/binary_sensor.py | 4 +- .../components/upcloud/binary_sensor.py | 4 +- .../components/updater/binary_sensor.py | 4 +- .../components/uptimerobot/binary_sensor.py | 4 +- .../components/velbus/binary_sensor.py | 4 +- .../components/vera/binary_sensor.py | 4 +- .../components/verisure/binary_sensor.py | 6 +-- .../components/volvooncall/binary_sensor.py | 4 +- .../components/vultr/binary_sensor.py | 4 +- .../components/w800rf32/binary_sensor.py | 4 +- .../components/wemo/binary_sensor.py | 4 +- .../components/wink/binary_sensor.py | 22 +++++------ .../components/wirelesstag/binary_sensor.py | 4 +- .../components/workday/binary_sensor.py | 4 +- .../components/xiaomi_aqara/binary_sensor.py | 4 +- .../components/yeelight/binary_sensor.py | 4 +- homeassistant/components/zha/binary_sensor.py | 4 +- .../components/zigbee/binary_sensor.py | 4 +- .../components/zoneminder/binary_sensor.py | 4 +- .../components/zwave/binary_sensor.py | 4 +- tests/components/binary_sensor/test_init.py | 37 +++++++++++-------- .../custom_components/test/binary_sensor.py | 4 +- 147 files changed, 371 insertions(+), 352 deletions(-) diff --git a/homeassistant/components/abode/binary_sensor.py b/homeassistant/components/abode/binary_sensor.py index 916ed2e26139..7175fbc550a9 100644 --- a/homeassistant/components/abode/binary_sensor.py +++ b/homeassistant/components/abode/binary_sensor.py @@ -3,7 +3,7 @@ import abodepy.helpers.constants as CONST from homeassistant.components.binary_sensor import ( DEVICE_CLASS_WINDOW, - BinarySensorDevice, + BinarySensorEntity, ) from . import AbodeDevice @@ -30,7 +30,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(entities) -class AbodeBinarySensor(AbodeDevice, BinarySensorDevice): +class AbodeBinarySensor(AbodeDevice, BinarySensorEntity): """A binary sensor implementation for Abode device.""" @property diff --git a/homeassistant/components/ads/binary_sensor.py b/homeassistant/components/ads/binary_sensor.py index 9e2f7b0cc4a4..df8a74dc1d55 100644 --- a/homeassistant/components/ads/binary_sensor.py +++ b/homeassistant/components/ads/binary_sensor.py @@ -6,7 +6,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME 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]) -class AdsBinarySensor(AdsEntity, BinarySensorDevice): +class AdsBinarySensor(AdsEntity, BinarySensorEntity): """Representation of ADS binary sensors.""" def __init__(self, ads_hub, name, ads_var, device_class): diff --git a/homeassistant/components/alarmdecoder/binary_sensor.py b/homeassistant/components/alarmdecoder/binary_sensor.py index b34c90bc35ad..cec1b8356b02 100644 --- a/homeassistant/components/alarmdecoder/binary_sensor.py +++ b/homeassistant/components/alarmdecoder/binary_sensor.py @@ -1,7 +1,7 @@ """Support for AlarmDecoder zone states- represented as binary sensors.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import ( CONF_RELAY_ADDR, @@ -53,7 +53,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): return True -class AlarmDecoderBinarySensor(BinarySensorDevice): +class AlarmDecoderBinarySensor(BinarySensorEntity): """Representation of an AlarmDecoder binary sensor.""" def __init__( diff --git a/homeassistant/components/ambient_station/binary_sensor.py b/homeassistant/components/ambient_station/binary_sensor.py index d1b1f9b8f1de..5aba9d637d42 100644 --- a/homeassistant/components/ambient_station/binary_sensor.py +++ b/homeassistant/components/ambient_station/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Ambient Weather Station binary sensors.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.const import ATTR_NAME 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) -class AmbientWeatherBinarySensor(AmbientWeatherEntity, BinarySensorDevice): +class AmbientWeatherBinarySensor(AmbientWeatherEntity, BinarySensorEntity): """Define an Ambient binary sensor.""" @property diff --git a/homeassistant/components/amcrest/binary_sensor.py b/homeassistant/components/amcrest/binary_sensor.py index 40cb755bd988..a3057211f2a4 100644 --- a/homeassistant/components/amcrest/binary_sensor.py +++ b/homeassistant/components/amcrest/binary_sensor.py @@ -7,7 +7,7 @@ from amcrest import AmcrestError from homeassistant.components.binary_sensor import ( DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_MOTION, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_BINARY_SENSORS, CONF_NAME 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.""" def __init__(self, name, device, sensor_type): diff --git a/homeassistant/components/android_ip_webcam/binary_sensor.py b/homeassistant/components/android_ip_webcam/binary_sensor.py index 0e9cca46afbf..143845657184 100644 --- a/homeassistant/components/android_ip_webcam/binary_sensor.py +++ b/homeassistant/components/android_ip_webcam/binary_sensor.py @@ -1,5 +1,5 @@ """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 @@ -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) -class IPWebcamBinarySensor(AndroidIPCamEntity, BinarySensorDevice): +class IPWebcamBinarySensor(AndroidIPCamEntity, BinarySensorEntity): """Representation of an IP Webcam binary sensor.""" def __init__(self, name, host, ipcam, sensor): diff --git a/homeassistant/components/apcupsd/binary_sensor.py b/homeassistant/components/apcupsd/binary_sensor.py index 000e738052d7..daf9592f3e6e 100644 --- a/homeassistant/components/apcupsd/binary_sensor.py +++ b/homeassistant/components/apcupsd/binary_sensor.py @@ -1,7 +1,7 @@ """Support for tracking the online status of a UPS.""" 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 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) -class OnlineStatus(BinarySensorDevice): +class OnlineStatus(BinarySensorEntity): """Representation of an UPS online status.""" def __init__(self, config, data): diff --git a/homeassistant/components/arest/binary_sensor.py b/homeassistant/components/arest/binary_sensor.py index 1b914f80aa7f..3cd9038f1a89 100644 --- a/homeassistant/components/arest/binary_sensor.py +++ b/homeassistant/components/arest/binary_sensor.py @@ -8,7 +8,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import ( 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.""" def __init__(self, arest, resource, name, device_class, pin): diff --git a/homeassistant/components/august/binary_sensor.py b/homeassistant/components/august/binary_sensor.py index e61de7303026..6602cfe86613 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -11,7 +11,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_DOOR, DEVICE_CLASS_MOTION, DEVICE_CLASS_OCCUPANCY, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.core import callback 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) -class AugustDoorBinarySensor(AugustEntityMixin, BinarySensorDevice): +class AugustDoorBinarySensor(AugustEntityMixin, BinarySensorEntity): """Representation of an August Door binary sensor.""" def __init__(self, data, sensor_type, device): @@ -155,7 +155,7 @@ class AugustDoorBinarySensor(AugustEntityMixin, BinarySensorDevice): return f"{self._device_id}_open" -class AugustDoorbellBinarySensor(AugustEntityMixin, BinarySensorDevice): +class AugustDoorbellBinarySensor(AugustEntityMixin, BinarySensorEntity): """Representation of an August binary sensor.""" def __init__(self, data, sensor_type, device): diff --git a/homeassistant/components/aurora/binary_sensor.py b/homeassistant/components/aurora/binary_sensor.py index e2f07276c6ce..1d5a6e83ec19 100644 --- a/homeassistant/components/aurora/binary_sensor.py +++ b/homeassistant/components/aurora/binary_sensor.py @@ -7,7 +7,7 @@ from aiohttp.hdrs import USER_AGENT import requests 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 import homeassistant.helpers.config_validation as cv 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) -class AuroraSensor(BinarySensorDevice): +class AuroraSensor(BinarySensorEntity): """Implementation of an aurora sensor.""" def __init__(self, aurora_data, name): diff --git a/homeassistant/components/axis/binary_sensor.py b/homeassistant/components/axis/binary_sensor.py index d992c28746c3..4709d706ad07 100644 --- a/homeassistant/components/axis/binary_sensor.py +++ b/homeassistant/components/axis/binary_sensor.py @@ -4,7 +4,7 @@ from datetime import timedelta 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.core import callback 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.""" def __init__(self, event, device): diff --git a/homeassistant/components/bayesian/binary_sensor.py b/homeassistant/components/bayesian/binary_sensor.py index b51653bb3c80..c4150131901e 100644 --- a/homeassistant/components/bayesian/binary_sensor.py +++ b/homeassistant/components/bayesian/binary_sensor.py @@ -3,7 +3,7 @@ from collections import OrderedDict 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_ABOVE, 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.""" def __init__(self, name, prior, observations, probability_threshold, device_class): diff --git a/homeassistant/components/bbb_gpio/binary_sensor.py b/homeassistant/components/bbb_gpio/binary_sensor.py index b1245aeabde2..229f7a6c61e0 100644 --- a/homeassistant/components/bbb_gpio/binary_sensor.py +++ b/homeassistant/components/bbb_gpio/binary_sensor.py @@ -4,7 +4,7 @@ import logging import voluptuous as vol 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 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) -class BBBGPIOBinarySensor(BinarySensorDevice): +class BBBGPIOBinarySensor(BinarySensorEntity): """Representation of a binary sensor that uses Beaglebone Black GPIO.""" def __init__(self, pin, params): diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index 7dc5d958537b..f022509f9dea 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -15,6 +15,8 @@ from homeassistant.helpers.entity_component import EntityComponent # mypy: allow-untyped-defs, no-check-untyped-defs +_LOGGER = logging.getLogger(__name__) + DOMAIN = "binary_sensor" 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) -class BinarySensorDevice(Entity): +class BinarySensorEntity(Entity): """Represent a binary sensor.""" @property @@ -159,3 +161,15 @@ class BinarySensorDevice(Entity): def device_class(self): """Return the class of this device, from component DEVICE_CLASSES.""" 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__, + ) diff --git a/homeassistant/components/blink/binary_sensor.py b/homeassistant/components/blink/binary_sensor.py index e8c01953bffd..219b9fb8cd36 100644 --- a/homeassistant/components/blink/binary_sensor.py +++ b/homeassistant/components/blink/binary_sensor.py @@ -1,5 +1,5 @@ """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 . import BINARY_SENSORS, BLINK_DATA @@ -18,7 +18,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devs, True) -class BlinkBinarySensor(BinarySensorDevice): +class BlinkBinarySensor(BinarySensorEntity): """Representation of a Blink binary sensor.""" def __init__(self, data, camera, sensor_type): diff --git a/homeassistant/components/bloomsky/binary_sensor.py b/homeassistant/components/bloomsky/binary_sensor.py index 140d7e638a74..b98bb688ca38 100644 --- a/homeassistant/components/bloomsky/binary_sensor.py +++ b/homeassistant/components/bloomsky/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 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) -class BloomSkySensor(BinarySensorDevice): +class BloomSkySensor(BinarySensorEntity): """Representation of a single binary sensor in a BloomSky device.""" def __init__(self, bs, device, sensor_name): diff --git a/homeassistant/components/bmw_connected_drive/binary_sensor.py b/homeassistant/components/bmw_connected_drive/binary_sensor.py index fc3069f284cd..ee89873e8fef 100644 --- a/homeassistant/components/bmw_connected_drive/binary_sensor.py +++ b/homeassistant/components/bmw_connected_drive/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 . import DOMAIN as BMW_DOMAIN @@ -54,7 +54,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class BMWConnectedDriveSensor(BinarySensorDevice): +class BMWConnectedDriveSensor(BinarySensorEntity): """Representation of a BMW vehicle binary sensor.""" def __init__( diff --git a/homeassistant/components/cloud/binary_sensor.py b/homeassistant/components/cloud/binary_sensor.py index c2974678faae..baa63679d42c 100644 --- a/homeassistant/components/cloud/binary_sensor.py +++ b/homeassistant/components/cloud/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Home Assistant Cloud binary sensors.""" 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 .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)]) -class CloudRemoteBinary(BinarySensorDevice): +class CloudRemoteBinary(BinarySensorEntity): """Representation of an Cloud Remote UI Connection binary sensor.""" def __init__(self, cloud): diff --git a/homeassistant/components/command_line/binary_sensor.py b/homeassistant/components/command_line/binary_sensor.py index eaa371be1a30..dc62d8daa9d7 100644 --- a/homeassistant/components/command_line/binary_sensor.py +++ b/homeassistant/components/command_line/binary_sensor.py @@ -7,7 +7,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import ( 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.""" def __init__( diff --git a/homeassistant/components/concord232/binary_sensor.py b/homeassistant/components/concord232/binary_sensor.py index 326ac799f069..3077056c397d 100644 --- a/homeassistant/components/concord232/binary_sensor.py +++ b/homeassistant/components/concord232/binary_sensor.py @@ -9,7 +9,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_HOST, CONF_PORT import homeassistant.helpers.config_validation as cv @@ -95,7 +95,7 @@ def get_opening_type(zone): return "opening" -class Concord232ZoneSensor(BinarySensorDevice): +class Concord232ZoneSensor(BinarySensorEntity): """Representation of a Concord232 zone as a sensor.""" def __init__(self, hass, client, zone, zone_type): diff --git a/homeassistant/components/danfoss_air/binary_sensor.py b/homeassistant/components/danfoss_air/binary_sensor.py index caac12c1b204..7f6876a709be 100644 --- a/homeassistant/components/danfoss_air/binary_sensor.py +++ b/homeassistant/components/danfoss_air/binary_sensor.py @@ -1,7 +1,7 @@ """Support for the for Danfoss Air HRV binary sensors.""" 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 @@ -23,7 +23,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(dev, True) -class DanfossAirBinarySensor(BinarySensorDevice): +class DanfossAirBinarySensor(BinarySensorEntity): """Representation of a Danfoss Air binary sensor.""" def __init__(self, data, name, sensor_type, device_class): diff --git a/homeassistant/components/deconz/binary_sensor.py b/homeassistant/components/deconz/binary_sensor.py index d16722525f92..95fa223c6979 100644 --- a/homeassistant/components/deconz/binary_sensor.py +++ b/homeassistant/components/deconz/binary_sensor.py @@ -1,7 +1,7 @@ """Support for deCONZ binary sensors.""" 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.core import callback 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.""" @callback diff --git a/homeassistant/components/demo/binary_sensor.py b/homeassistant/components/demo/binary_sensor.py index 0f6dfa9f3577..04d8e72f9a80 100644 --- a/homeassistant/components/demo/binary_sensor.py +++ b/homeassistant/components/demo/binary_sensor.py @@ -1,5 +1,5 @@ """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 @@ -19,7 +19,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): await async_setup_platform(hass, {}, async_add_entities) -class DemoBinarySensor(BinarySensorDevice): +class DemoBinarySensor(BinarySensorEntity): """representation of a Demo binary sensor.""" def __init__(self, unique_id, name, state, device_class): diff --git a/homeassistant/components/digital_ocean/binary_sensor.py b/homeassistant/components/digital_ocean/binary_sensor.py index c35151775353..d076dae9210f 100644 --- a/homeassistant/components/digital_ocean/binary_sensor.py +++ b/homeassistant/components/digital_ocean/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 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) -class DigitalOceanBinarySensor(BinarySensorDevice): +class DigitalOceanBinarySensor(BinarySensorEntity): """Representation of a Digital Ocean droplet sensor.""" def __init__(self, do, droplet_id): diff --git a/homeassistant/components/ecobee/binary_sensor.py b/homeassistant/components/ecobee/binary_sensor.py index 2f422007ff45..64c4b07ed1f0 100644 --- a/homeassistant/components/ecobee/binary_sensor.py +++ b/homeassistant/components/ecobee/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Ecobee binary sensors.""" from homeassistant.components.binary_sensor import ( DEVICE_CLASS_OCCUPANCY, - BinarySensorDevice, + BinarySensorEntity, ) 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) -class EcobeeBinarySensor(BinarySensorDevice): +class EcobeeBinarySensor(BinarySensorEntity): """Representation of an Ecobee sensor.""" def __init__(self, data, sensor_name, sensor_index): diff --git a/homeassistant/components/egardia/binary_sensor.py b/homeassistant/components/egardia/binary_sensor.py index 4f02d6fdde00..4be443a36f44 100644 --- a/homeassistant/components/egardia/binary_sensor.py +++ b/homeassistant/components/egardia/binary_sensor.py @@ -1,7 +1,7 @@ """Interfaces with Egardia/Woonveilig alarm control panel.""" 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 . 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).""" def __init__(self, sensor_id, name, egardia_system, device_class): diff --git a/homeassistant/components/eight_sleep/binary_sensor.py b/homeassistant/components/eight_sleep/binary_sensor.py index 7b801578ccd4..803b20383b6f 100644 --- a/homeassistant/components/eight_sleep/binary_sensor.py +++ b/homeassistant/components/eight_sleep/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Eight Sleep binary sensors.""" 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 @@ -25,7 +25,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(all_sensors, True) -class EightHeatSensor(EightSleepHeatEntity, BinarySensorDevice): +class EightHeatSensor(EightSleepHeatEntity, BinarySensorEntity): """Representation of a Eight Sleep heat-based sensor.""" def __init__(self, name, eight, sensor): diff --git a/homeassistant/components/enocean/binary_sensor.py b/homeassistant/components/enocean/binary_sensor.py index 4ff1b4611292..7fb8ea5e3f2f 100644 --- a/homeassistant/components/enocean/binary_sensor.py +++ b/homeassistant/components/enocean/binary_sensor.py @@ -7,7 +7,7 @@ from homeassistant.components import enocean from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_DEVICE_CLASS, CONF_ID, CONF_NAME 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)]) -class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorDevice): +class EnOceanBinarySensor(enocean.EnOceanDevice, BinarySensorEntity): """Representation of EnOcean binary sensors such as wall switches. Supported EEPs (EnOcean Equipment Profiles): diff --git a/homeassistant/components/envisalink/binary_sensor.py b/homeassistant/components/envisalink/binary_sensor.py index f698a9d27d92..544456604845 100644 --- a/homeassistant/components/envisalink/binary_sensor.py +++ b/homeassistant/components/envisalink/binary_sensor.py @@ -2,7 +2,7 @@ import datetime 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.core import callback 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) -class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorDevice): +class EnvisalinkBinarySensor(EnvisalinkDevice, BinarySensorEntity): """Representation of an Envisalink binary sensor.""" def __init__(self, hass, zone_number, zone_name, zone_type, info, controller): diff --git a/homeassistant/components/esphome/binary_sensor.py b/homeassistant/components/esphome/binary_sensor.py index fe41bb2f7bb6..d605a48410b8 100644 --- a/homeassistant/components/esphome/binary_sensor.py +++ b/homeassistant/components/esphome/binary_sensor.py @@ -3,7 +3,7 @@ from typing import Optional 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 @@ -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.""" @property diff --git a/homeassistant/components/ffmpeg_motion/binary_sensor.py b/homeassistant/components/ffmpeg_motion/binary_sensor.py index e3a9c09b5d97..a8842f9c4018 100644 --- a/homeassistant/components/ffmpeg_motion/binary_sensor.py +++ b/homeassistant/components/ffmpeg_motion/binary_sensor.py @@ -4,7 +4,7 @@ import logging import haffmpeg.sensor as ffmpeg_sensor 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 ( CONF_EXTRA_ARGUMENTS, CONF_INITIAL_STATE, @@ -55,7 +55,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities([entity]) -class FFmpegBinarySensor(FFmpegBase, BinarySensorDevice): +class FFmpegBinarySensor(FFmpegBase, BinarySensorEntity): """A binary sensor which use FFmpeg for noise detection.""" def __init__(self, config): diff --git a/homeassistant/components/fibaro/binary_sensor.py b/homeassistant/components/fibaro/binary_sensor.py index fa2d6ceb3c66..251bd1df6a3e 100644 --- a/homeassistant/components/fibaro/binary_sensor.py +++ b/homeassistant/components/fibaro/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Fibaro binary sensors.""" 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 . 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.""" def __init__(self, fibaro_device): diff --git a/homeassistant/components/flic/binary_sensor.py b/homeassistant/components/flic/binary_sensor.py index 55f92e2e5cea..e81f8f2f5b04 100644 --- a/homeassistant/components/flic/binary_sensor.py +++ b/homeassistant/components/flic/binary_sensor.py @@ -12,7 +12,7 @@ from pyflic import ( ) 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_DISCOVERY, CONF_HOST, @@ -123,7 +123,7 @@ def setup_button(hass, config, add_entities, client, address): add_entities([button]) -class FlicButton(BinarySensorDevice): +class FlicButton(BinarySensorEntity): """Representation of a flic button.""" def __init__(self, hass, client, address, timeout, ignored_click_types): diff --git a/homeassistant/components/fritzbox/binary_sensor.py b/homeassistant/components/fritzbox/binary_sensor.py index c0893b933164..7db216c32e10 100644 --- a/homeassistant/components/fritzbox/binary_sensor.py +++ b/homeassistant/components/fritzbox/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Fritzbox binary sensors.""" import requests -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.const import CONF_DEVICES 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) -class FritzboxBinarySensor(BinarySensorDevice): +class FritzboxBinarySensor(BinarySensorEntity): """Representation of a binary Fritzbox device.""" def __init__(self, device, fritz): diff --git a/homeassistant/components/gc100/binary_sensor.py b/homeassistant/components/gc100/binary_sensor.py index a2f8ba4a0a26..43ceb75e449b 100644 --- a/homeassistant/components/gc100/binary_sensor.py +++ b/homeassistant/components/gc100/binary_sensor.py @@ -1,7 +1,7 @@ """Support for binary sensor using GC100.""" 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 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) -class GC100BinarySensor(BinarySensorDevice): +class GC100BinarySensor(BinarySensorEntity): """Representation of a binary sensor from GC100.""" def __init__(self, name, port_addr, gc100): diff --git a/homeassistant/components/geniushub/binary_sensor.py b/homeassistant/components/geniushub/binary_sensor.py index 33458d049a28..d935192f97d4 100644 --- a/homeassistant/components/geniushub/binary_sensor.py +++ b/homeassistant/components/geniushub/binary_sensor.py @@ -1,5 +1,5 @@ """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 . import DOMAIN, GeniusDevice @@ -25,7 +25,7 @@ async def async_setup_platform( async_add_entities(switches, update_before_add=True) -class GeniusBinarySensor(GeniusDevice, BinarySensorDevice): +class GeniusBinarySensor(GeniusDevice, BinarySensorEntity): """Representation of a Genius Hub binary_sensor.""" def __init__(self, broker, device, state_attr) -> None: diff --git a/homeassistant/components/hikvision/binary_sensor.py b/homeassistant/components/hikvision/binary_sensor.py index 4d2a879bc735..779afa10cca6 100644 --- a/homeassistant/components/hikvision/binary_sensor.py +++ b/homeassistant/components/hikvision/binary_sensor.py @@ -5,7 +5,7 @@ import logging from pyhik.hikvision import HikCamera 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_LAST_TRIP_TIME, CONF_CUSTOMIZE, @@ -183,7 +183,7 @@ class HikvisionData: return self.camdata.fetch_attributes(sensor, channel) -class HikvisionBinarySensor(BinarySensorDevice): +class HikvisionBinarySensor(BinarySensorEntity): """Representation of a Hikvision binary sensor.""" def __init__(self, hass, sensor, channel, cam, delay): diff --git a/homeassistant/components/hive/binary_sensor.py b/homeassistant/components/hive/binary_sensor.py index fa91d6862a21..27c648f554bd 100644 --- a/homeassistant/components/hive/binary_sensor.py +++ b/homeassistant/components/hive/binary_sensor.py @@ -1,5 +1,5 @@ """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 @@ -18,7 +18,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devs) -class HiveBinarySensorEntity(HiveEntity, BinarySensorDevice): +class HiveBinarySensorEntity(HiveEntity, BinarySensorEntity): """Representation of a Hive binary sensor.""" @property diff --git a/homeassistant/components/homekit_controller/binary_sensor.py b/homeassistant/components/homekit_controller/binary_sensor.py index b96e5f651e33..939c6055e10f 100644 --- a/homeassistant/components/homekit_controller/binary_sensor.py +++ b/homeassistant/components/homekit_controller/binary_sensor.py @@ -9,7 +9,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OPENING, DEVICE_CLASS_SMOKE, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.core import callback @@ -18,7 +18,7 @@ from . import KNOWN_DEVICES, HomeKitEntity _LOGGER = logging.getLogger(__name__) -class HomeKitMotionSensor(HomeKitEntity, BinarySensorDevice): +class HomeKitMotionSensor(HomeKitEntity, BinarySensorEntity): """Representation of a Homekit motion sensor.""" def get_characteristic_types(self): @@ -36,7 +36,7 @@ class HomeKitMotionSensor(HomeKitEntity, BinarySensorDevice): return self.service.value(CharacteristicsTypes.MOTION_DETECTED) -class HomeKitContactSensor(HomeKitEntity, BinarySensorDevice): +class HomeKitContactSensor(HomeKitEntity, BinarySensorEntity): """Representation of a Homekit contact sensor.""" def get_characteristic_types(self): @@ -54,7 +54,7 @@ class HomeKitContactSensor(HomeKitEntity, BinarySensorDevice): return self.service.value(CharacteristicsTypes.CONTACT_STATE) == 1 -class HomeKitSmokeSensor(HomeKitEntity, BinarySensorDevice): +class HomeKitSmokeSensor(HomeKitEntity, BinarySensorEntity): """Representation of a Homekit smoke sensor.""" @property @@ -72,7 +72,7 @@ class HomeKitSmokeSensor(HomeKitEntity, BinarySensorDevice): return self.service.value(CharacteristicsTypes.SMOKE_DETECTED) == 1 -class HomeKitOccupancySensor(HomeKitEntity, BinarySensorDevice): +class HomeKitOccupancySensor(HomeKitEntity, BinarySensorEntity): """Representation of a Homekit occupancy sensor.""" @property @@ -90,7 +90,7 @@ class HomeKitOccupancySensor(HomeKitEntity, BinarySensorDevice): return self.service.value(CharacteristicsTypes.OCCUPANCY_DETECTED) == 1 -class HomeKitLeakSensor(HomeKitEntity, BinarySensorDevice): +class HomeKitLeakSensor(HomeKitEntity, BinarySensorEntity): """Representation of a Homekit leak sensor.""" def get_characteristic_types(self): diff --git a/homeassistant/components/homematic/binary_sensor.py b/homeassistant/components/homematic/binary_sensor.py index 731525c84601..041f2f02643f 100644 --- a/homeassistant/components/homematic/binary_sensor.py +++ b/homeassistant/components/homematic/binary_sensor.py @@ -7,7 +7,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_OPENING, DEVICE_CLASS_PRESENCE, DEVICE_CLASS_SMOKE, - BinarySensorDevice, + BinarySensorEntity, ) 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) -class HMBinarySensor(HMDevice, BinarySensorDevice): +class HMBinarySensor(HMDevice, BinarySensorEntity): """Representation of a binary HomeMatic device.""" @property @@ -73,7 +73,7 @@ class HMBinarySensor(HMDevice, BinarySensorDevice): self._data.update({self._state: None}) -class HMBatterySensor(HMDevice, BinarySensorDevice): +class HMBatterySensor(HMDevice, BinarySensorEntity): """Representation of an HomeMatic low battery sensor.""" @property diff --git a/homeassistant/components/homematicip_cloud/binary_sensor.py b/homeassistant/components/homematicip_cloud/binary_sensor.py index 00147e1b7ec0..15c41be24b53 100644 --- a/homeassistant/components/homematicip_cloud/binary_sensor.py +++ b/homeassistant/components/homematicip_cloud/binary_sensor.py @@ -36,7 +36,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_PRESENCE, DEVICE_CLASS_SAFETY, DEVICE_CLASS_SMOKE, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType @@ -131,7 +131,7 @@ async def async_setup_entry( async_add_entities(entities) -class HomematicipAccelerationSensor(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipAccelerationSensor(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud acceleration sensor.""" @property @@ -157,7 +157,7 @@ class HomematicipAccelerationSensor(HomematicipGenericDevice, BinarySensorDevice return state_attr -class HomematicipContactInterface(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipContactInterface(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud contact interface.""" @property @@ -173,7 +173,7 @@ class HomematicipContactInterface(HomematicipGenericDevice, BinarySensorDevice): return self._device.windowState != WindowState.CLOSED -class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud shutter contact.""" @property @@ -189,7 +189,7 @@ class HomematicipShutterContact(HomematicipGenericDevice, BinarySensorDevice): return self._device.windowState != WindowState.CLOSED -class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud motion detector.""" @property @@ -203,7 +203,7 @@ class HomematicipMotionDetector(HomematicipGenericDevice, BinarySensorDevice): return self._device.motionDetected -class HomematicipPresenceDetector(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipPresenceDetector(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud presence detector.""" @property @@ -217,7 +217,7 @@ class HomematicipPresenceDetector(HomematicipGenericDevice, BinarySensorDevice): return self._device.presenceDetected -class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud smoke detector.""" @property @@ -236,7 +236,7 @@ class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorDevice): return False -class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud water detector.""" @property @@ -250,7 +250,7 @@ class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorDevice): return self._device.moistureDetected or self._device.waterlevelDetected -class HomematicipStormSensor(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipStormSensor(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud storm sensor.""" def __init__(self, hap: HomematicipHAP, device) -> None: @@ -268,7 +268,7 @@ class HomematicipStormSensor(HomematicipGenericDevice, BinarySensorDevice): return self._device.storm -class HomematicipRainSensor(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipRainSensor(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud rain sensor.""" def __init__(self, hap: HomematicipHAP, device) -> None: @@ -286,7 +286,7 @@ class HomematicipRainSensor(HomematicipGenericDevice, BinarySensorDevice): return self._device.raining -class HomematicipSunshineSensor(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipSunshineSensor(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud sunshine sensor.""" def __init__(self, hap: HomematicipHAP, device) -> None: @@ -315,7 +315,7 @@ class HomematicipSunshineSensor(HomematicipGenericDevice, BinarySensorDevice): return state_attr -class HomematicipBatterySensor(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipBatterySensor(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud low battery sensor.""" def __init__(self, hap: HomematicipHAP, device) -> None: @@ -334,7 +334,7 @@ class HomematicipBatterySensor(HomematicipGenericDevice, BinarySensorDevice): class HomematicipPluggableMainsFailureSurveillanceSensor( - HomematicipGenericDevice, BinarySensorDevice + HomematicipGenericDevice, BinarySensorEntity ): """Representation of a HomematicIP Cloud pluggable mains failure surveillance sensor.""" @@ -353,7 +353,7 @@ class HomematicipPluggableMainsFailureSurveillanceSensor( return not self._device.powerMainsFailure -class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud security zone group.""" def __init__(self, hap: HomematicipHAP, device, post: str = "SecurityZone") -> None: @@ -409,7 +409,7 @@ class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice, BinarySensorD class HomematicipSecuritySensorGroup( - HomematicipSecurityZoneSensorGroup, BinarySensorDevice + HomematicipSecurityZoneSensorGroup, BinarySensorEntity ): """Representation of a HomematicIP security group.""" diff --git a/homeassistant/components/huawei_lte/binary_sensor.py b/homeassistant/components/huawei_lte/binary_sensor.py index af6ed75d591f..575cc9789ca5 100644 --- a/homeassistant/components/huawei_lte/binary_sensor.py +++ b/homeassistant/components/huawei_lte/binary_sensor.py @@ -8,7 +8,7 @@ from huawei_lte_api.enums.cradle import ConnectionStatusEnum from homeassistant.components.binary_sensor import ( DOMAIN as BINARY_SENSOR_DOMAIN, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_URL @@ -33,7 +33,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): @attr.s -class HuaweiLteBaseBinarySensor(HuaweiLteBaseEntity, BinarySensorDevice): +class HuaweiLteBaseBinarySensor(HuaweiLteBaseEntity, BinarySensorEntity): """Huawei LTE binary sensor device base class.""" key: str diff --git a/homeassistant/components/hue/binary_sensor.py b/homeassistant/components/hue/binary_sensor.py index 8a6b5d203a8e..cfbe041aafe4 100644 --- a/homeassistant/components/hue/binary_sensor.py +++ b/homeassistant/components/hue/binary_sensor.py @@ -4,7 +4,7 @@ from aiohue.sensors import TYPE_ZLL_PRESENCE from homeassistant.components.binary_sensor import ( DEVICE_CLASS_MOTION, - BinarySensorDevice, + BinarySensorEntity, ) 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) -class HuePresence(GenericZLLSensor, BinarySensorDevice): +class HuePresence(GenericZLLSensor, BinarySensorEntity): """The presence sensor entity for a Hue motion sensor device.""" device_class = DEVICE_CLASS_MOTION diff --git a/homeassistant/components/hydrawise/binary_sensor.py b/homeassistant/components/hydrawise/binary_sensor.py index 037c48b029ef..389506c6d5ab 100644 --- a/homeassistant/components/hydrawise/binary_sensor.py +++ b/homeassistant/components/hydrawise/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 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) -class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorDevice): +class HydrawiseBinarySensor(HydrawiseEntity, BinarySensorEntity): """A sensor implementation for Hydrawise device.""" @property diff --git a/homeassistant/components/iaqualink/binary_sensor.py b/homeassistant/components/iaqualink/binary_sensor.py index 30d419c1bce0..669188c473f4 100644 --- a/homeassistant/components/iaqualink/binary_sensor.py +++ b/homeassistant/components/iaqualink/binary_sensor.py @@ -4,7 +4,7 @@ import logging from homeassistant.components.binary_sensor import ( DEVICE_CLASS_COLD, DOMAIN, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType @@ -27,7 +27,7 @@ async def async_setup_entry( async_add_entities(devs, True) -class HassAqualinkBinarySensor(AqualinkEntity, BinarySensorDevice): +class HassAqualinkBinarySensor(AqualinkEntity, BinarySensorEntity): """Representation of a binary sensor.""" @property diff --git a/homeassistant/components/ihc/binary_sensor.py b/homeassistant/components/ihc/binary_sensor.py index 3f59d7981fb0..0c6a685bc93d 100644 --- a/homeassistant/components/ihc/binary_sensor.py +++ b/homeassistant/components/ihc/binary_sensor.py @@ -1,5 +1,5 @@ """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 . import IHC_CONTROLLER, IHC_INFO @@ -35,7 +35,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices) -class IHCBinarySensor(IHCDevice, BinarySensorDevice): +class IHCBinarySensor(IHCDevice, BinarySensorEntity): """IHC Binary Sensor. The associated IHC resource can be any in or output from a IHC product diff --git a/homeassistant/components/incomfort/binary_sensor.py b/homeassistant/components/incomfort/binary_sensor.py index f15c2298b9d7..bf1340fb2354 100644 --- a/homeassistant/components/incomfort/binary_sensor.py +++ b/homeassistant/components/incomfort/binary_sensor.py @@ -3,7 +3,7 @@ from typing import Any, Dict, Optional from homeassistant.components.binary_sensor import ( DOMAIN as BINARY_SENSOR_DOMAIN, - BinarySensorDevice, + BinarySensorEntity, ) 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]) -class IncomfortFailed(IncomfortChild, BinarySensorDevice): +class IncomfortFailed(IncomfortChild, BinarySensorEntity): """Representation of an InComfort Failed sensor.""" def __init__(self, client, heater) -> None: diff --git a/homeassistant/components/insteon/binary_sensor.py b/homeassistant/components/insteon/binary_sensor.py index b96feb218315..81c3c58ef126 100644 --- a/homeassistant/components/insteon/binary_sensor.py +++ b/homeassistant/components/insteon/binary_sensor.py @@ -1,7 +1,7 @@ """Support for INSTEON dimmers via PowerLinc Modem.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity 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]) -class InsteonBinarySensor(InsteonEntity, BinarySensorDevice): +class InsteonBinarySensor(InsteonEntity, BinarySensorEntity): """A Class for an Insteon device entity.""" def __init__(self, device, state_key): diff --git a/homeassistant/components/iss/binary_sensor.py b/homeassistant/components/iss/binary_sensor.py index 3b8e222c9124..e1f0d7a19cec 100644 --- a/homeassistant/components/iss/binary_sensor.py +++ b/homeassistant/components/iss/binary_sensor.py @@ -6,7 +6,7 @@ import pyiss import requests 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_LATITUDE, 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) -class IssBinarySensor(BinarySensorDevice): +class IssBinarySensor(BinarySensorEntity): """Implementation of the ISS binary sensor.""" def __init__(self, iss_data, name, show): diff --git a/homeassistant/components/isy994/binary_sensor.py b/homeassistant/components/isy994/binary_sensor.py index 30b26ea5d242..a96f2f44fdbb 100644 --- a/homeassistant/components/isy994/binary_sensor.py +++ b/homeassistant/components/isy994/binary_sensor.py @@ -3,7 +3,7 @@ from datetime import timedelta import logging 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.core import callback 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]: if node.parent_node is None: - device = ISYBinarySensorDevice(node) + device = ISYBinarySensorEntity(node) devices.append(device) devices_by_nid[node.nid] = device else: @@ -66,7 +66,7 @@ def setup_platform( else: # We don't yet have any special logic for other sensor types, # so add the nodes as individual devices - device = ISYBinarySensorDevice(node) + device = ISYBinarySensorEntity(node) devices.append(device) for name, status, _ in hass.data[ISY994_PROGRAMS][DOMAIN]: @@ -95,7 +95,7 @@ def _is_val_unknown(val): return val == -1 * float("inf") -class ISYBinarySensorDevice(ISYDevice, BinarySensorDevice): +class ISYBinarySensorEntity(ISYDevice, BinarySensorEntity): """Representation of an ISY994 binary sensor device. 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 -class ISYBinarySensorHeartbeat(ISYDevice, BinarySensorDevice): +class ISYBinarySensorHeartbeat(ISYDevice, BinarySensorEntity): """Representation of the battery state of an ISY994 sensor.""" def __init__(self, node, parent_device) -> None: @@ -353,7 +353,7 @@ class ISYBinarySensorHeartbeat(ISYDevice, BinarySensorDevice): return attr -class ISYBinarySensorProgram(ISYDevice, BinarySensorDevice): +class ISYBinarySensorProgram(ISYDevice, BinarySensorEntity): """Representation of an ISY994 binary sensor program. This does not need all of the subnode logic in the device version of binary diff --git a/homeassistant/components/jewish_calendar/binary_sensor.py b/homeassistant/components/jewish_calendar/binary_sensor.py index 7362fce3cd03..22e6a46e0ec4 100644 --- a/homeassistant/components/jewish_calendar/binary_sensor.py +++ b/homeassistant/components/jewish_calendar/binary_sensor.py @@ -3,7 +3,7 @@ import logging import hdate -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity import homeassistant.util.dt as dt_util 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.""" def __init__(self, data, sensor, sensor_info): diff --git a/homeassistant/components/keba/binary_sensor.py b/homeassistant/components/keba/binary_sensor.py index 5cced416bc3a..5c9edfa77937 100644 --- a/homeassistant/components/keba/binary_sensor.py +++ b/homeassistant/components/keba/binary_sensor.py @@ -6,7 +6,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_PLUG, DEVICE_CLASS_POWER, DEVICE_CLASS_SAFETY, - BinarySensorDevice, + BinarySensorEntity, ) from . import DOMAIN @@ -36,7 +36,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(sensors) -class KebaBinarySensor(BinarySensorDevice): +class KebaBinarySensor(BinarySensorEntity): """Representation of a binary sensor of a KEBA charging station.""" def __init__(self, keba, key, name, entity_type, device_class): diff --git a/homeassistant/components/knx/binary_sensor.py b/homeassistant/components/knx/binary_sensor.py index 95e7e2cc400f..9f8c3cc84910 100644 --- a/homeassistant/components/knx/binary_sensor.py +++ b/homeassistant/components/knx/binary_sensor.py @@ -2,7 +2,7 @@ import voluptuous as vol 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.core import callback 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]) -class KNXBinarySensor(BinarySensorDevice): +class KNXBinarySensor(BinarySensorEntity): """Representation of a KNX binary sensor.""" def __init__(self, device): diff --git a/homeassistant/components/konnected/binary_sensor.py b/homeassistant/components/konnected/binary_sensor.py index 5cd270d50083..20494eee4242 100644 --- a/homeassistant/components/konnected/binary_sensor.py +++ b/homeassistant/components/konnected/binary_sensor.py @@ -1,7 +1,7 @@ """Support for wired binary sensors attached to a Konnected device.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_STATE, @@ -31,7 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(sensors) -class KonnectedBinarySensor(BinarySensorDevice): +class KonnectedBinarySensor(BinarySensorEntity): """Representation of a Konnected binary sensor.""" def __init__(self, device_id, zone_num, data): diff --git a/homeassistant/components/lcn/binary_sensor.py b/homeassistant/components/lcn/binary_sensor.py index 249adf04af8f..7b4cedfebad7 100644 --- a/homeassistant/components/lcn/binary_sensor.py +++ b/homeassistant/components/lcn/binary_sensor.py @@ -1,7 +1,7 @@ """Support for LCN binary sensors.""" import pypck -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.const import CONF_ADDRESS from . import LcnDevice @@ -36,7 +36,7 @@ async def async_setup_platform( async_add_entities(devices) -class LcnRegulatorLockSensor(LcnDevice, BinarySensorDevice): +class LcnRegulatorLockSensor(LcnDevice, BinarySensorEntity): """Representation of a LCN binary sensor for regulator locks.""" def __init__(self, config, address_connection): @@ -71,7 +71,7 @@ class LcnRegulatorLockSensor(LcnDevice, BinarySensorDevice): self.async_write_ha_state() -class LcnBinarySensor(LcnDevice, BinarySensorDevice): +class LcnBinarySensor(LcnDevice, BinarySensorEntity): """Representation of a LCN binary sensor for binary sensor ports.""" def __init__(self, config, address_connection): @@ -103,7 +103,7 @@ class LcnBinarySensor(LcnDevice, BinarySensorDevice): self.async_write_ha_state() -class LcnLockKeysSensor(LcnDevice, BinarySensorDevice): +class LcnLockKeysSensor(LcnDevice, BinarySensorEntity): """Representation of a LCN sensor for key locks.""" def __init__(self, config, address_connection): diff --git a/homeassistant/components/linode/binary_sensor.py b/homeassistant/components/linode/binary_sensor.py index 674a97a0f452..c4a14210d32b 100644 --- a/homeassistant/components/linode/binary_sensor.py +++ b/homeassistant/components/linode/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 from . import ( @@ -44,7 +44,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(dev, True) -class LinodeBinarySensor(BinarySensorDevice): +class LinodeBinarySensor(BinarySensorEntity): """Representation of a Linode droplet sensor.""" def __init__(self, li, node_id): diff --git a/homeassistant/components/lupusec/binary_sensor.py b/homeassistant/components/lupusec/binary_sensor.py index b2a332a03e76..30af5743aa0c 100644 --- a/homeassistant/components/lupusec/binary_sensor.py +++ b/homeassistant/components/lupusec/binary_sensor.py @@ -4,7 +4,7 @@ import logging 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 @@ -29,7 +29,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices) -class LupusecBinarySensor(LupusecDevice, BinarySensorDevice): +class LupusecBinarySensor(LupusecDevice, BinarySensorEntity): """A binary sensor implementation for Lupusec device.""" @property diff --git a/homeassistant/components/lutron/binary_sensor.py b/homeassistant/components/lutron/binary_sensor.py index 866c82a7b2ac..e2e143da4352 100644 --- a/homeassistant/components/lutron/binary_sensor.py +++ b/homeassistant/components/lutron/binary_sensor.py @@ -3,7 +3,7 @@ from pylutron import OccupancyGroup from homeassistant.components.binary_sensor import ( DEVICE_CLASS_OCCUPANCY, - BinarySensorDevice, + BinarySensorEntity, ) from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice @@ -21,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devs) -class LutronOccupancySensor(LutronDevice, BinarySensorDevice): +class LutronOccupancySensor(LutronDevice, BinarySensorEntity): """Representation of a Lutron Occupancy Group. The Lutron integration API reports "occupancy groups" rather than diff --git a/homeassistant/components/lutron_caseta/binary_sensor.py b/homeassistant/components/lutron_caseta/binary_sensor.py index 871f3c28664f..15c3d19008a7 100644 --- a/homeassistant/components/lutron_caseta/binary_sensor.py +++ b/homeassistant/components/lutron_caseta/binary_sensor.py @@ -3,7 +3,7 @@ from pylutron_caseta import OCCUPANCY_GROUP_OCCUPIED from homeassistant.components.binary_sensor import ( DEVICE_CLASS_OCCUPANCY, - BinarySensorDevice, + BinarySensorEntity, ) 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) -class LutronOccupancySensor(LutronCasetaDevice, BinarySensorDevice): +class LutronOccupancySensor(LutronCasetaDevice, BinarySensorEntity): """Representation of a Lutron occupancy group.""" @property diff --git a/homeassistant/components/maxcube/binary_sensor.py b/homeassistant/components/maxcube/binary_sensor.py index 2670b61b4569..b42c96f99c2f 100644 --- a/homeassistant/components/maxcube/binary_sensor.py +++ b/homeassistant/components/maxcube/binary_sensor.py @@ -1,7 +1,7 @@ """Support for MAX! binary sensors via MAX! Cube.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import DATA_KEY @@ -24,11 +24,11 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices) -class MaxCubeShutter(BinarySensorDevice): +class MaxCubeShutter(BinarySensorEntity): """Representation of a MAX! Cube Binary Sensor device.""" def __init__(self, handler, name, rf_address): - """Initialize MAX! Cube BinarySensorDevice.""" + """Initialize MAX! Cube BinarySensorEntity.""" self._name = name self._sensor_type = "window" self._rf_address = rf_address @@ -42,7 +42,7 @@ class MaxCubeShutter(BinarySensorDevice): @property def name(self): - """Return the name of the BinarySensorDevice.""" + """Return the name of the BinarySensorEntity.""" return self._name @property diff --git a/homeassistant/components/mcp23017/binary_sensor.py b/homeassistant/components/mcp23017/binary_sensor.py index 59f268e657c0..8cc50fa9dfac 100644 --- a/homeassistant/components/mcp23017/binary_sensor.py +++ b/homeassistant/components/mcp23017/binary_sensor.py @@ -7,7 +7,7 @@ import busio # pylint: disable=import-error import digitalio # pylint: disable=import-error 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 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) -class MCP23017BinarySensor(BinarySensorDevice): +class MCP23017BinarySensor(BinarySensorEntity): """Represent a binary sensor that uses MCP23017.""" def __init__(self, name, pin, pull_mode, invert_logic): diff --git a/homeassistant/components/meteoalarm/binary_sensor.py b/homeassistant/components/meteoalarm/binary_sensor.py index 7d3bea4c9959..ebdeaa7c903d 100644 --- a/homeassistant/components/meteoalarm/binary_sensor.py +++ b/homeassistant/components/meteoalarm/binary_sensor.py @@ -5,7 +5,7 @@ import logging from meteoalertapi import Meteoalert 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 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) -class MeteoAlertBinarySensor(BinarySensorDevice): +class MeteoAlertBinarySensor(BinarySensorEntity): """Representation of a MeteoAlert binary sensor.""" def __init__(self, api, name): diff --git a/homeassistant/components/minecraft_server/binary_sensor.py b/homeassistant/components/minecraft_server/binary_sensor.py index cde2a4149007..aadcba44e857 100644 --- a/homeassistant/components/minecraft_server/binary_sensor.py +++ b/homeassistant/components/minecraft_server/binary_sensor.py @@ -2,7 +2,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_CONNECTIVITY, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType @@ -24,7 +24,7 @@ async def async_setup_entry( async_add_entities(entities, True) -class MinecraftServerStatusBinarySensor(MinecraftServerEntity, BinarySensorDevice): +class MinecraftServerStatusBinarySensor(MinecraftServerEntity, BinarySensorEntity): """Representation of a Minecraft Server status binary sensor.""" def __init__(self, server: MinecraftServer) -> None: diff --git a/homeassistant/components/mobile_app/binary_sensor.py b/homeassistant/components/mobile_app/binary_sensor.py index c04a1af316dc..ae8efc0c1132 100644 --- a/homeassistant/components/mobile_app/binary_sensor.py +++ b/homeassistant/components/mobile_app/binary_sensor.py @@ -1,7 +1,7 @@ """Binary sensor platform for mobile_app.""" 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.core import callback 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.""" @property diff --git a/homeassistant/components/modbus/binary_sensor.py b/homeassistant/components/modbus/binary_sensor.py index 5f80813d108b..ce66b7aecdb4 100644 --- a/homeassistant/components/modbus/binary_sensor.py +++ b/homeassistant/components/modbus/binary_sensor.py @@ -9,7 +9,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME, CONF_SLAVE 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) -class ModbusBinarySensor(BinarySensorDevice): +class ModbusBinarySensor(BinarySensorEntity): """Modbus binary sensor.""" def __init__(self, hub, name, slave, address, device_class, input_type): diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index f07be49b4217..4e335dda9595 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -7,7 +7,7 @@ import voluptuous as vol from homeassistant.components import binary_sensor, mqtt from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import ( CONF_DEVICE, @@ -107,7 +107,7 @@ class MqttBinarySensor( MqttAvailability, MqttDiscoveryUpdate, MqttEntityDeviceInfo, - BinarySensorDevice, + BinarySensorEntity, ): """Representation a binary sensor that is updated by MQTT.""" diff --git a/homeassistant/components/mychevy/binary_sensor.py b/homeassistant/components/mychevy/binary_sensor.py index 702f3146f8e4..b009fe3b3f48 100644 --- a/homeassistant/components/mychevy/binary_sensor.py +++ b/homeassistant/components/mychevy/binary_sensor.py @@ -3,7 +3,7 @@ import logging from homeassistant.components.binary_sensor import ( DOMAIN as BINARY_SENSOR_DOMAIN, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.core import callback 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) -class EVBinarySensor(BinarySensorDevice): +class EVBinarySensor(BinarySensorEntity): """Base EVSensor class. The only real difference between sensors is which units and what diff --git a/homeassistant/components/myq/binary_sensor.py b/homeassistant/components/myq/binary_sensor.py index a54b8e50ecef..8da5b2083e3f 100644 --- a/homeassistant/components/myq/binary_sensor.py +++ b/homeassistant/components/myq/binary_sensor.py @@ -3,7 +3,7 @@ import logging from homeassistant.components.binary_sensor import ( DEVICE_CLASS_CONNECTIVITY, - BinarySensorDevice, + BinarySensorEntity, ) from .const import ( @@ -31,12 +31,12 @@ async def async_setup_entry(hass, config_entry, async_add_entities): for device in myq.devices.values(): 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) -class MyQBinarySensorDevice(BinarySensorDevice): +class MyQBinarySensorEntity(BinarySensorEntity): """Representation of a MyQ gateway.""" def __init__(self, coordinator, device): diff --git a/homeassistant/components/mysensors/binary_sensor.py b/homeassistant/components/mysensors/binary_sensor.py index 0b94e7649373..0bab6ea6eeae 100644 --- a/homeassistant/components/mysensors/binary_sensor.py +++ b/homeassistant/components/mysensors/binary_sensor.py @@ -3,7 +3,7 @@ from homeassistant.components import mysensors from homeassistant.components.binary_sensor import ( DEVICE_CLASSES, DOMAIN, - BinarySensorDevice, + BinarySensorEntity, ) 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.""" @property diff --git a/homeassistant/components/mystrom/binary_sensor.py b/homeassistant/components/mystrom/binary_sensor.py index c584440874a2..87c1a3a26655 100644 --- a/homeassistant/components/mystrom/binary_sensor.py +++ b/homeassistant/components/mystrom/binary_sensor.py @@ -1,7 +1,7 @@ """Support for the myStrom buttons.""" 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.const import HTTP_UNPROCESSABLE_ENTITY from homeassistant.core import callback @@ -59,7 +59,7 @@ class MyStromView(HomeAssistantView): self.buttons[entity_id].async_on_update(new_state) -class MyStromBinarySensor(BinarySensorDevice): +class MyStromBinarySensor(BinarySensorEntity): """Representation of a myStrom button.""" def __init__(self, button_id): diff --git a/homeassistant/components/ness_alarm/binary_sensor.py b/homeassistant/components/ness_alarm/binary_sensor.py index c719febdb58f..d7e7851792eb 100644 --- a/homeassistant/components/ness_alarm/binary_sensor.py +++ b/homeassistant/components/ness_alarm/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Ness D8X/D16X zone states - represented as binary sensors.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback 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) -class NessZoneBinarySensor(BinarySensorDevice): +class NessZoneBinarySensor(BinarySensorEntity): """Representation of an Ness alarm zone as a binary sensor.""" def __init__(self, zone_id, name, zone_type): diff --git a/homeassistant/components/nest/binary_sensor.py b/homeassistant/components/nest/binary_sensor.py index 34dc7b06ade6..dd52e1d665fc 100644 --- a/homeassistant/components/nest/binary_sensor.py +++ b/homeassistant/components/nest/binary_sensor.py @@ -2,7 +2,7 @@ from itertools import chain import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.const import CONF_MONITORED_CONDITIONS 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) -class NestBinarySensor(NestSensorDevice, BinarySensorDevice): +class NestBinarySensor(NestSensorDevice, BinarySensorEntity): """Represents a Nest binary sensor.""" @property diff --git a/homeassistant/components/netgear_lte/binary_sensor.py b/homeassistant/components/netgear_lte/binary_sensor.py index 31eb46925a1c..f18c7a2ff861 100644 --- a/homeassistant/components/netgear_lte/binary_sensor.py +++ b/homeassistant/components/netgear_lte/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Netgear LTE binary sensors.""" import logging -from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDevice +from homeassistant.components.binary_sensor import DOMAIN, BinarySensorEntity from homeassistant.exceptions import PlatformNotReady 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) -class LTEBinarySensor(LTEEntity, BinarySensorDevice): +class LTEBinarySensor(LTEEntity, BinarySensorEntity): """Netgear LTE binary sensor entity.""" @property diff --git a/homeassistant/components/nexia/binary_sensor.py b/homeassistant/components/nexia/binary_sensor.py index 5c33412c6474..9adf47ee2c5e 100644 --- a/homeassistant/components/nexia/binary_sensor.py +++ b/homeassistant/components/nexia/binary_sensor.py @@ -1,6 +1,6 @@ """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 .entity import NexiaThermostatEntity @@ -34,7 +34,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(entities, True) -class NexiaBinarySensor(NexiaThermostatEntity, BinarySensorDevice): +class NexiaBinarySensor(NexiaThermostatEntity, BinarySensorEntity): """Provices Nexia BinarySensor support.""" def __init__(self, coordinator, thermostat, sensor_call, sensor_name): diff --git a/homeassistant/components/nextcloud/binary_sensor.py b/homeassistant/components/nextcloud/binary_sensor.py index 9e4c6f5d9699..67bc580bfdf3 100644 --- a/homeassistant/components/nextcloud/binary_sensor.py +++ b/homeassistant/components/nextcloud/binary_sensor.py @@ -1,7 +1,7 @@ """Summary binary data from Nextcoud.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import BINARY_SENSORS, DOMAIN @@ -19,7 +19,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(binary_sensors, True) -class NextcloudBinarySensor(BinarySensorDevice): +class NextcloudBinarySensor(BinarySensorEntity): """Represents a Nextcloud binary sensor.""" def __init__(self, item): diff --git a/homeassistant/components/nissan_leaf/binary_sensor.py b/homeassistant/components/nissan_leaf/binary_sensor.py index 786d495cc9b7..3d2064dad4c6 100644 --- a/homeassistant/components/nissan_leaf/binary_sensor.py +++ b/homeassistant/components/nissan_leaf/binary_sensor.py @@ -1,7 +1,7 @@ """Plugged In Status Support for the Nissan Leaf.""" 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 @@ -22,7 +22,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class LeafPluggedInSensor(LeafEntity, BinarySensorDevice): +class LeafPluggedInSensor(LeafEntity, BinarySensorEntity): """Plugged In Sensor class.""" @property @@ -43,7 +43,7 @@ class LeafPluggedInSensor(LeafEntity, BinarySensorDevice): return "mdi:power-plug-off" -class LeafChargingSensor(LeafEntity, BinarySensorDevice): +class LeafChargingSensor(LeafEntity, BinarySensorEntity): """Charging Sensor class.""" @property diff --git a/homeassistant/components/notion/binary_sensor.py b/homeassistant/components/notion/binary_sensor.py index 53a982047045..8d60ef0901ae 100644 --- a/homeassistant/components/notion/binary_sensor.py +++ b/homeassistant/components/notion/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Notion binary sensors.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback from . import ( @@ -50,7 +50,7 @@ async def async_setup_entry(hass, entry, async_add_entities): async_add_entities(sensor_list, True) -class NotionBinarySensor(NotionEntity, BinarySensorDevice): +class NotionBinarySensor(NotionEntity, BinarySensorEntity): """Define a Notion sensor.""" @property diff --git a/homeassistant/components/nx584/binary_sensor.py b/homeassistant/components/nx584/binary_sensor.py index f6006ff2de48..d12f337c171e 100644 --- a/homeassistant/components/nx584/binary_sensor.py +++ b/homeassistant/components/nx584/binary_sensor.py @@ -10,7 +10,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_HOST, CONF_PORT import homeassistant.helpers.config_validation as cv @@ -72,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): return True -class NX584ZoneSensor(BinarySensorDevice): +class NX584ZoneSensor(BinarySensorEntity): """Representation of a NX584 zone as a sensor.""" def __init__(self, zone, zone_type): diff --git a/homeassistant/components/octoprint/binary_sensor.py b/homeassistant/components/octoprint/binary_sensor.py index 7ed1170c6a0f..0f740525f84c 100644 --- a/homeassistant/components/octoprint/binary_sensor.py +++ b/homeassistant/components/octoprint/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 @@ -36,7 +36,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class OctoPrintBinarySensor(BinarySensorDevice): +class OctoPrintBinarySensor(BinarySensorEntity): """Representation an OctoPrint binary sensor.""" def __init__( diff --git a/homeassistant/components/opentherm_gw/binary_sensor.py b/homeassistant/components/opentherm_gw/binary_sensor.py index 62c0d3dd2c11..9e3c4d412297 100644 --- a/homeassistant/components/opentherm_gw/binary_sensor.py +++ b/homeassistant/components/opentherm_gw/binary_sensor.py @@ -1,7 +1,7 @@ """Support for OpenTherm Gateway binary sensors.""" 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.core import callback 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) -class OpenThermBinarySensor(BinarySensorDevice): +class OpenThermBinarySensor(BinarySensorEntity): """Represent an OpenTherm Gateway binary sensor.""" def __init__(self, gw_dev, var, device_class, friendly_name_format): diff --git a/homeassistant/components/openuv/binary_sensor.py b/homeassistant/components/openuv/binary_sensor.py index 6e403a59b43e..2d514b33cf3f 100644 --- a/homeassistant/components/openuv/binary_sensor.py +++ b/homeassistant/components/openuv/binary_sensor.py @@ -1,7 +1,7 @@ """Support for OpenUV binary sensors.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback 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) -class OpenUvBinarySensor(OpenUvEntity, BinarySensorDevice): +class OpenUvBinarySensor(OpenUvEntity, BinarySensorEntity): """Define a binary sensor for OpenUV.""" def __init__(self, openuv, sensor_type, name, icon, entry_id): diff --git a/homeassistant/components/orangepi_gpio/binary_sensor.py b/homeassistant/components/orangepi_gpio/binary_sensor.py index b89442a571c3..0c8f8bc69cfd 100644 --- a/homeassistant/components/orangepi_gpio/binary_sensor.py +++ b/homeassistant/components/orangepi_gpio/binary_sensor.py @@ -1,6 +1,6 @@ """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 .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) -class OPiGPIOBinarySensor(BinarySensorDevice): +class OPiGPIOBinarySensor(BinarySensorEntity): """Represent a binary sensor that uses Orange Pi GPIO.""" def __init__(self, hass, name, port, invert_logic): diff --git a/homeassistant/components/pcal9535a/binary_sensor.py b/homeassistant/components/pcal9535a/binary_sensor.py index 236fd47af735..8e14ea8ce690 100644 --- a/homeassistant/components/pcal9535a/binary_sensor.py +++ b/homeassistant/components/pcal9535a/binary_sensor.py @@ -4,7 +4,7 @@ import logging from pcal9535a import PCAL9535A 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 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) -class PCAL9535ABinarySensor(BinarySensorDevice): +class PCAL9535ABinarySensor(BinarySensorEntity): """Represent a binary sensor that uses PCAL9535A.""" def __init__(self, name, pin, pull_mode, invert_logic): diff --git a/homeassistant/components/pi4ioe5v9xxxx/binary_sensor.py b/homeassistant/components/pi4ioe5v9xxxx/binary_sensor.py index 89f293d1e0de..4eb901017103 100644 --- a/homeassistant/components/pi4ioe5v9xxxx/binary_sensor.py +++ b/homeassistant/components/pi4ioe5v9xxxx/binary_sensor.py @@ -4,7 +4,7 @@ import logging from pi4ioe5v9xxxx import pi4ioe5v9xxxx # pylint: disable=import-error 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 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) -class Pi4ioe5v9BinarySensor(BinarySensorDevice): +class Pi4ioe5v9BinarySensor(BinarySensorEntity): """Represent a binary sensor that uses pi4ioe5v9xxxx IO expander in read mode.""" def __init__(self, name, pin, invert_logic): diff --git a/homeassistant/components/pilight/binary_sensor.py b/homeassistant/components/pilight/binary_sensor.py index ae6d562725d6..a53e575b8754 100644 --- a/homeassistant/components/pilight/binary_sensor.py +++ b/homeassistant/components/pilight/binary_sensor.py @@ -5,7 +5,7 @@ import logging import voluptuous as vol 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 ( CONF_DISARM_AFTER_TRIGGER, 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.""" def __init__(self, hass, name, variable, payload, on_value, off_value): @@ -121,7 +121,7 @@ class PilightBinarySensor(BinarySensorDevice): self.schedule_update_ha_state() -class PilightTriggerSensor(BinarySensorDevice): +class PilightTriggerSensor(BinarySensorEntity): """Representation of a binary sensor that can be updated using Pilight.""" def __init__( diff --git a/homeassistant/components/ping/binary_sensor.py b/homeassistant/components/ping/binary_sensor.py index 4d9a99c678e6..a9c69f4ddad1 100644 --- a/homeassistant/components/ping/binary_sensor.py +++ b/homeassistant/components/ping/binary_sensor.py @@ -7,7 +7,7 @@ import sys 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 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) -class PingBinarySensor(BinarySensorDevice): +class PingBinarySensor(BinarySensorEntity): """Representation of a Ping Binary sensor.""" def __init__(self, name, ping): diff --git a/homeassistant/components/point/binary_sensor.py b/homeassistant/components/point/binary_sensor.py index b417c128913d..5a780c2e57a3 100644 --- a/homeassistant/components/point/binary_sensor.py +++ b/homeassistant/components/point/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Minut Point binary sensors.""" 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.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.""" def __init__(self, point_client, device_id, device_class): diff --git a/homeassistant/components/powerwall/binary_sensor.py b/homeassistant/components/powerwall/binary_sensor.py index 877efdd68fa8..160a62a20291 100644 --- a/homeassistant/components/powerwall/binary_sensor.py +++ b/homeassistant/components/powerwall/binary_sensor.py @@ -6,7 +6,7 @@ from tesla_powerwall import GridStatus from homeassistant.components.binary_sensor import ( DEVICE_CLASS_BATTERY_CHARGING, DEVICE_CLASS_CONNECTIVITY, - BinarySensorDevice, + BinarySensorEntity, ) 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) -class PowerWallRunningSensor(PowerWallEntity, BinarySensorDevice): +class PowerWallRunningSensor(PowerWallEntity, BinarySensorEntity): """Representation of an Powerwall running sensor.""" @property @@ -89,7 +89,7 @@ class PowerWallRunningSensor(PowerWallEntity, BinarySensorDevice): } -class PowerWallConnectedSensor(PowerWallEntity, BinarySensorDevice): +class PowerWallConnectedSensor(PowerWallEntity, BinarySensorEntity): """Representation of an Powerwall connected sensor.""" @property @@ -113,7 +113,7 @@ class PowerWallConnectedSensor(PowerWallEntity, BinarySensorDevice): 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.""" @property @@ -137,7 +137,7 @@ class PowerWallGridStatusSensor(PowerWallEntity, BinarySensorDevice): 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.""" @property diff --git a/homeassistant/components/proxmoxve/binary_sensor.py b/homeassistant/components/proxmoxve/binary_sensor.py index 15b1f1483e1f..698a2c35ae19 100644 --- a/homeassistant/components/proxmoxve/binary_sensor.py +++ b/homeassistant/components/proxmoxve/binary_sensor.py @@ -1,7 +1,7 @@ """Binary sensor to read Proxmox VE data.""" 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 . 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) -class ProxmoxBinarySensor(BinarySensorDevice): +class ProxmoxBinarySensor(BinarySensorEntity): """A binary sensor for reading Proxmox VE data.""" def __init__(self, proxmox_client, item_node, item_type, item_id): diff --git a/homeassistant/components/qwikswitch/binary_sensor.py b/homeassistant/components/qwikswitch/binary_sensor.py index b3635dcb1f47..7a4168438617 100644 --- a/homeassistant/components/qwikswitch/binary_sensor.py +++ b/homeassistant/components/qwikswitch/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 . import DOMAIN as QWIKSWITCH, QSEntity @@ -22,7 +22,7 @@ async def async_setup_platform(hass, _, add_entities, discovery_info=None): add_entities(devs) -class QSBinarySensor(QSEntity, BinarySensorDevice): +class QSBinarySensor(QSEntity, BinarySensorEntity): """Sensor based on a Qwikswitch relay/dimmer module.""" _val = False diff --git a/homeassistant/components/rachio/binary_sensor.py b/homeassistant/components/rachio/binary_sensor.py index c3161cae6aba..4976714f0a2d 100644 --- a/homeassistant/components/rachio/binary_sensor.py +++ b/homeassistant/components/rachio/binary_sensor.py @@ -4,7 +4,7 @@ import logging from homeassistant.components.binary_sensor import ( DEVICE_CLASS_CONNECTIVITY, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -38,7 +38,7 @@ def _create_entities(hass, config_entry): return entities -class RachioControllerBinarySensor(RachioDevice, BinarySensorDevice): +class RachioControllerBinarySensor(RachioDevice, BinarySensorEntity): """Represent a binary sensor that reflects a Rachio state.""" def __init__(self, controller, poll=True): diff --git a/homeassistant/components/rainbird/binary_sensor.py b/homeassistant/components/rainbird/binary_sensor.py index 51c5f7a9dbef..62c6824f5e00 100644 --- a/homeassistant/components/rainbird/binary_sensor.py +++ b/homeassistant/components/rainbird/binary_sensor.py @@ -3,7 +3,7 @@ import logging from pyrainbird import RainbirdController -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import ( 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.""" def __init__(self, controller: RainbirdController, sensor_type): diff --git a/homeassistant/components/raincloud/binary_sensor.py b/homeassistant/components/raincloud/binary_sensor.py index 2074a57df984..d2659e133b0b 100644 --- a/homeassistant/components/raincloud/binary_sensor.py +++ b/homeassistant/components/raincloud/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 import homeassistant.helpers.config_validation as cv @@ -41,7 +41,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): return True -class RainCloudBinarySensor(RainCloudEntity, BinarySensorDevice): +class RainCloudBinarySensor(RainCloudEntity, BinarySensorEntity): """A sensor implementation for raincloud device.""" @property diff --git a/homeassistant/components/rainmachine/binary_sensor.py b/homeassistant/components/rainmachine/binary_sensor.py index e5fdc8d6b46f..b3f7ffb7d6bf 100644 --- a/homeassistant/components/rainmachine/binary_sensor.py +++ b/homeassistant/components/rainmachine/binary_sensor.py @@ -1,7 +1,7 @@ """This platform provides binary sensors for key RainMachine data.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback 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.""" def __init__( diff --git a/homeassistant/components/random/binary_sensor.py b/homeassistant/components/random/binary_sensor.py index e502439b28c3..baec29c59373 100644 --- a/homeassistant/components/random/binary_sensor.py +++ b/homeassistant/components/random/binary_sensor.py @@ -7,7 +7,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME 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) -class RandomSensor(BinarySensorDevice): +class RandomSensor(BinarySensorEntity): """Representation of a Random binary sensor.""" def __init__(self, name, device_class): diff --git a/homeassistant/components/raspihats/binary_sensor.py b/homeassistant/components/raspihats/binary_sensor.py index 6a88318706d0..ea3130da4ba4 100644 --- a/homeassistant/components/raspihats/binary_sensor.py +++ b/homeassistant/components/raspihats/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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_ADDRESS, CONF_DEVICE_CLASS, @@ -81,7 +81,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(binary_sensors) -class I2CHatBinarySensor(BinarySensorDevice): +class I2CHatBinarySensor(BinarySensorEntity): """Representation of a binary sensor that uses a I2C-HAT digital input.""" I2C_HATS_MANAGER = None diff --git a/homeassistant/components/remote_rpi_gpio/binary_sensor.py b/homeassistant/components/remote_rpi_gpio/binary_sensor.py index 862bd30ae432..d97183de86eb 100644 --- a/homeassistant/components/remote_rpi_gpio/binary_sensor.py +++ b/homeassistant/components/remote_rpi_gpio/binary_sensor.py @@ -4,7 +4,7 @@ import logging import requests 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 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) -class RemoteRPiGPIOBinarySensor(BinarySensorDevice): +class RemoteRPiGPIOBinarySensor(BinarySensorEntity): """Represent a binary sensor that uses a Remote Raspberry Pi GPIO.""" def __init__(self, name, button, invert_logic): diff --git a/homeassistant/components/rest/binary_sensor.py b/homeassistant/components/rest/binary_sensor.py index 1bbde2407891..6d797dfd834e 100644 --- a/homeassistant/components/rest/binary_sensor.py +++ b/homeassistant/components/rest/binary_sensor.py @@ -7,7 +7,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import ( 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)]) -class RestBinarySensor(BinarySensorDevice): +class RestBinarySensor(BinarySensorEntity): """Representation of a REST binary sensor.""" def __init__(self, hass, rest, name, device_class, value_template): diff --git a/homeassistant/components/rflink/binary_sensor.py b/homeassistant/components/rflink/binary_sensor.py index c3600da40517..8962af3c0d43 100644 --- a/homeassistant/components/rflink/binary_sensor.py +++ b/homeassistant/components/rflink/binary_sensor.py @@ -6,7 +6,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_DEVICE_CLASS, CONF_FORCE_UPDATE, CONF_NAME 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)) -class RflinkBinarySensor(RflinkDevice, BinarySensorDevice): +class RflinkBinarySensor(RflinkDevice, BinarySensorEntity): """Representation of an Rflink binary sensor.""" def __init__( diff --git a/homeassistant/components/rfxtrx/binary_sensor.py b/homeassistant/components/rfxtrx/binary_sensor.py index a88594dcceaa..5e610128ea66 100644 --- a/homeassistant/components/rfxtrx/binary_sensor.py +++ b/homeassistant/components/rfxtrx/binary_sensor.py @@ -7,7 +7,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import ( CONF_COMMAND_OFF, @@ -171,7 +171,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): RECEIVED_EVT_SUBSCRIBERS.append(binary_sensor_update) -class RfxtrxBinarySensor(BinarySensorDevice): +class RfxtrxBinarySensor(BinarySensorEntity): """A representation of a RFXtrx binary sensor.""" def __init__( diff --git a/homeassistant/components/ring/binary_sensor.py b/homeassistant/components/ring/binary_sensor.py index 385d8a4f9558..fa303b943788 100644 --- a/homeassistant/components/ring/binary_sensor.py +++ b/homeassistant/components/ring/binary_sensor.py @@ -2,7 +2,7 @@ from datetime import datetime import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback from . import DOMAIN @@ -37,7 +37,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities(sensors) -class RingBinarySensor(RingEntityMixin, BinarySensorDevice): +class RingBinarySensor(RingEntityMixin, BinarySensorEntity): """A binary sensor implementation for Ring device.""" _active_alert = None diff --git a/homeassistant/components/roomba/binary_sensor.py b/homeassistant/components/roomba/binary_sensor.py index 47212563b5be..fb11a0f9d4ca 100644 --- a/homeassistant/components/roomba/binary_sensor.py +++ b/homeassistant/components/roomba/binary_sensor.py @@ -1,7 +1,7 @@ """Roomba binary sensor entities.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import roomba_reported_state from .const import BLID, DOMAIN, ROOMBA_SESSION @@ -21,7 +21,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async_add_entities([roomba_vac], True) -class RoombaBinStatus(IRobotEntity, BinarySensorDevice): +class RoombaBinStatus(IRobotEntity, BinarySensorEntity): """Class to hold Roomba Sensor basic info.""" ICON = "mdi:delete-variant" diff --git a/homeassistant/components/rpi_gpio/binary_sensor.py b/homeassistant/components/rpi_gpio/binary_sensor.py index 3e38da47eedd..a7ecaa3d36c9 100644 --- a/homeassistant/components/rpi_gpio/binary_sensor.py +++ b/homeassistant/components/rpi_gpio/binary_sensor.py @@ -4,7 +4,7 @@ import logging import voluptuous as vol from homeassistant.components import rpi_gpio -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 import homeassistant.helpers.config_validation as cv @@ -48,7 +48,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(binary_sensors, True) -class RPiGPIOBinarySensor(BinarySensorDevice): +class RPiGPIOBinarySensor(BinarySensorEntity): """Represent a binary sensor that uses Raspberry Pi GPIO.""" def __init__(self, name, port, pull_mode, bouncetime, invert_logic): diff --git a/homeassistant/components/rpi_pfio/binary_sensor.py b/homeassistant/components/rpi_pfio/binary_sensor.py index 89d44a0e8db3..e77ceea3eb7d 100644 --- a/homeassistant/components/rpi_pfio/binary_sensor.py +++ b/homeassistant/components/rpi_pfio/binary_sensor.py @@ -4,7 +4,7 @@ import logging import voluptuous as vol from homeassistant.components import rpi_pfio -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 import homeassistant.helpers.config_validation as cv @@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): rpi_pfio.activate_listener(hass) -class RPiPFIOBinarySensor(BinarySensorDevice): +class RPiPFIOBinarySensor(BinarySensorEntity): """Represent a binary sensor that a PiFace Digital Input.""" def __init__(self, hass, port, name, settle_time, invert_logic): diff --git a/homeassistant/components/satel_integra/binary_sensor.py b/homeassistant/components/satel_integra/binary_sensor.py index 4a9be339a1cd..19763903f278 100644 --- a/homeassistant/components/satel_integra/binary_sensor.py +++ b/homeassistant/components/satel_integra/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Satel Integra zone states- represented as binary sensors.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -49,7 +49,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(devices) -class SatelIntegraBinarySensor(BinarySensorDevice): +class SatelIntegraBinarySensor(BinarySensorEntity): """Representation of an Satel Integra binary sensor.""" def __init__( diff --git a/homeassistant/components/sense/binary_sensor.py b/homeassistant/components/sense/binary_sensor.py index 384bc3d074ff..62fe0d01d4ee 100644 --- a/homeassistant/components/sense/binary_sensor.py +++ b/homeassistant/components/sense/binary_sensor.py @@ -1,7 +1,7 @@ """Support for monitoring a Sense energy sensor device.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.const import ATTR_ATTRIBUTION, DEVICE_CLASS_POWER from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -61,7 +61,7 @@ def sense_to_mdi(sense_icon): return "mdi:{}".format(MDI_ICONS.get(sense_icon, "power-plug")) -class SenseDevice(BinarySensorDevice): +class SenseDevice(BinarySensorEntity): """Implementation of a Sense energy device binary sensor.""" def __init__(self, sense_devices_data, device, sense_monitor_id): diff --git a/homeassistant/components/skybell/binary_sensor.py b/homeassistant/components/skybell/binary_sensor.py index f0df663eba37..a5c6681eb2bf 100644 --- a/homeassistant/components/skybell/binary_sensor.py +++ b/homeassistant/components/skybell/binary_sensor.py @@ -4,7 +4,7 @@ import logging 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_ENTITY_NAMESPACE, CONF_MONITORED_CONDITIONS import homeassistant.helpers.config_validation as cv @@ -44,7 +44,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(sensors, True) -class SkybellBinarySensor(SkybellDevice, BinarySensorDevice): +class SkybellBinarySensor(SkybellDevice, BinarySensorEntity): """A binary sensor implementation for Skybell devices.""" def __init__(self, device, sensor_type): diff --git a/homeassistant/components/sleepiq/binary_sensor.py b/homeassistant/components/sleepiq/binary_sensor.py index 3ba39a38764b..39ae3e7c6584 100644 --- a/homeassistant/components/sleepiq/binary_sensor.py +++ b/homeassistant/components/sleepiq/binary_sensor.py @@ -1,5 +1,5 @@ """Support for SleepIQ sensors.""" -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import SleepIQSensor from .const import DOMAIN, IS_IN_BED, SENSOR_TYPES, SIDES @@ -21,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(dev) -class IsInBedBinarySensor(SleepIQSensor, BinarySensorDevice): +class IsInBedBinarySensor(SleepIQSensor, BinarySensorEntity): """Implementation of a SleepIQ presence sensor.""" def __init__(self, sleepiq_data, bed_id, side): diff --git a/homeassistant/components/smartthings/binary_sensor.py b/homeassistant/components/smartthings/binary_sensor.py index 78d2c73ca734..825cf1499521 100644 --- a/homeassistant/components/smartthings/binary_sensor.py +++ b/homeassistant/components/smartthings/binary_sensor.py @@ -3,7 +3,7 @@ from typing import Optional, Sequence from pysmartthings import Attribute, Capability -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import SmartThingsEntity from .const import DATA_BROKERS, DOMAIN @@ -50,7 +50,7 @@ def get_capabilities(capabilities: Sequence[str]) -> Optional[Sequence[str]]: ] -class SmartThingsBinarySensor(SmartThingsEntity, BinarySensorDevice): +class SmartThingsBinarySensor(SmartThingsEntity, BinarySensorEntity): """Define a SmartThings Binary Sensor.""" def __init__(self, device, attribute): diff --git a/homeassistant/components/smarty/binary_sensor.py b/homeassistant/components/smarty/binary_sensor.py index a86b3548e959..f8b9114ae0ee 100644 --- a/homeassistant/components/smarty/binary_sensor.py +++ b/homeassistant/components/smarty/binary_sensor.py @@ -2,7 +2,7 @@ import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -25,7 +25,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(sensors, True) -class SmartyBinarySensor(BinarySensorDevice): +class SmartyBinarySensor(BinarySensorEntity): """Representation of a Smarty Binary Sensor.""" def __init__(self, name, device_class, smarty): diff --git a/homeassistant/components/spc/binary_sensor.py b/homeassistant/components/spc/binary_sensor.py index 626e30849df4..75256b60cfbd 100644 --- a/homeassistant/components/spc/binary_sensor.py +++ b/homeassistant/components/spc/binary_sensor.py @@ -3,7 +3,7 @@ import logging from pyspcwebgw.const import ZoneInput, ZoneType -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -35,7 +35,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= ) -class SpcBinarySensor(BinarySensorDevice): +class SpcBinarySensor(BinarySensorEntity): """Representation of a sensor based on a SPC zone.""" def __init__(self, zone): diff --git a/homeassistant/components/starline/binary_sensor.py b/homeassistant/components/starline/binary_sensor.py index f2288e9363bf..df9bd348b8d4 100644 --- a/homeassistant/components/starline/binary_sensor.py +++ b/homeassistant/components/starline/binary_sensor.py @@ -4,7 +4,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_LOCK, DEVICE_CLASS_POWER, DEVICE_CLASS_PROBLEM, - BinarySensorDevice, + BinarySensorEntity, ) from .account import StarlineAccount, StarlineDevice @@ -33,7 +33,7 @@ async def async_setup_entry(hass, entry, async_add_entities): async_add_entities(entities) -class StarlineSensor(StarlineEntity, BinarySensorDevice): +class StarlineSensor(StarlineEntity, BinarySensorEntity): """Representation of a StarLine binary sensor.""" def __init__( diff --git a/homeassistant/components/stookalert/binary_sensor.py b/homeassistant/components/stookalert/binary_sensor.py index c8515f401da3..a07f208ac9df 100644 --- a/homeassistant/components/stookalert/binary_sensor.py +++ b/homeassistant/components/stookalert/binary_sensor.py @@ -5,7 +5,7 @@ import logging import stookalert 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.helpers import config_validation as cv @@ -46,7 +46,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities([StookalertBinarySensor(name, api_handler)], update_before_add=True) -class StookalertBinarySensor(BinarySensorDevice): +class StookalertBinarySensor(BinarySensorEntity): """An implementation of RIVM Stookalert.""" def __init__(self, name, api_handler): diff --git a/homeassistant/components/streamlabswater/binary_sensor.py b/homeassistant/components/streamlabswater/binary_sensor.py index 78b2ceb40441..a25f5e124e67 100644 --- a/homeassistant/components/streamlabswater/binary_sensor.py +++ b/homeassistant/components/streamlabswater/binary_sensor.py @@ -2,7 +2,7 @@ from datetime import timedelta -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.streamlabswater import DOMAIN as STREAMLABSWATER_DOMAIN from homeassistant.util import Throttle @@ -46,7 +46,7 @@ class StreamlabsLocationData: return self._is_away -class StreamlabsAwayMode(BinarySensorDevice): +class StreamlabsAwayMode(BinarySensorEntity): """Monitor the away mode state.""" def __init__(self, location_name, streamlabs_location_data): diff --git a/homeassistant/components/surepetcare/binary_sensor.py b/homeassistant/components/surepetcare/binary_sensor.py index 5b3ac492137d..26f498d43fe2 100644 --- a/homeassistant/components/surepetcare/binary_sensor.py +++ b/homeassistant/components/surepetcare/binary_sensor.py @@ -8,7 +8,7 @@ from surepy import SureLocationID, SureProductID from homeassistant.components.binary_sensor import ( DEVICE_CLASS_CONNECTIVITY, DEVICE_CLASS_PRESENCE, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_ID, CONF_TYPE from homeassistant.core import callback @@ -55,7 +55,7 @@ async def async_setup_platform( async_add_entities(entities, True) -class SurePetcareBinarySensor(BinarySensorDevice): +class SurePetcareBinarySensor(BinarySensorEntity): """A binary sensor implementation for Sure Petcare Entities.""" def __init__( @@ -105,7 +105,7 @@ class SurePetcareBinarySensor(BinarySensorDevice): return None if not self._device_class else self._device_class @property - def unique_id(self: BinarySensorDevice) -> str: + def unique_id(self: BinarySensorEntity) -> str: """Return an unique ID.""" return f"{self._spc_data['household_id']}-{self._id}" @@ -214,7 +214,7 @@ class DeviceConnectivity(SurePetcareBinarySensor): return f"{self._name}_connectivity" @property - def unique_id(self: BinarySensorDevice) -> str: + def unique_id(self: BinarySensorEntity) -> str: """Return an unique ID.""" return f"{self._spc_data['household_id']}-{self._id}-connectivity" diff --git a/homeassistant/components/tahoma/binary_sensor.py b/homeassistant/components/tahoma/binary_sensor.py index 7621a542838b..39e492601bd8 100644 --- a/homeassistant/components/tahoma/binary_sensor.py +++ b/homeassistant/components/tahoma/binary_sensor.py @@ -2,7 +2,7 @@ from datetime import timedelta import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.const import ATTR_BATTERY_LEVEL, STATE_OFF, STATE_ON from . import DOMAIN as TAHOMA_DOMAIN, TahomaDevice @@ -24,7 +24,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class TahomaBinarySensor(TahomaDevice, BinarySensorDevice): +class TahomaBinarySensor(TahomaDevice, BinarySensorEntity): """Representation of a Tahoma Binary Sensor.""" def __init__(self, tahoma_device, controller): diff --git a/homeassistant/components/tapsaff/binary_sensor.py b/homeassistant/components/tapsaff/binary_sensor.py index e54bc7298b0a..912dd27c887e 100644 --- a/homeassistant/components/tapsaff/binary_sensor.py +++ b/homeassistant/components/tapsaff/binary_sensor.py @@ -5,7 +5,7 @@ import logging from tapsaff import TapsAff 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 import homeassistant.helpers.config_validation as cv @@ -35,7 +35,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities([TapsAffSensor(taps_aff_data, name)], True) -class TapsAffSensor(BinarySensorDevice): +class TapsAffSensor(BinarySensorEntity): """Implementation of a Taps Aff binary sensor.""" def __init__(self, taps_aff_data, name): diff --git a/homeassistant/components/tcp/binary_sensor.py b/homeassistant/components/tcp/binary_sensor.py index 4d26d819ede2..1648ab5e247a 100644 --- a/homeassistant/components/tcp/binary_sensor.py +++ b/homeassistant/components/tcp/binary_sensor.py @@ -1,7 +1,7 @@ """Provides a binary sensor which gets its values from a TCP socket.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from .sensor import CONF_VALUE_ON, PLATFORM_SCHEMA, TcpSensor @@ -15,7 +15,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities([TcpBinarySensor(hass, config)]) -class TcpBinarySensor(BinarySensorDevice, TcpSensor): +class TcpBinarySensor(BinarySensorEntity, TcpSensor): """A binary sensor which is on when its state == CONF_VALUE_ON.""" required = (CONF_VALUE_ON,) diff --git a/homeassistant/components/tellduslive/binary_sensor.py b/homeassistant/components/tellduslive/binary_sensor.py index 09541a120fd4..3f8293656891 100644 --- a/homeassistant/components/tellduslive/binary_sensor.py +++ b/homeassistant/components/tellduslive/binary_sensor.py @@ -2,7 +2,7 @@ import logging from homeassistant.components import binary_sensor, tellduslive -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.helpers.dispatcher import async_dispatcher_connect from .entry import TelldusLiveEntity @@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) -class TelldusLiveSensor(TelldusLiveEntity, BinarySensorDevice): +class TelldusLiveSensor(TelldusLiveEntity, BinarySensorEntity): """Representation of a Tellstick sensor.""" @property diff --git a/homeassistant/components/template/binary_sensor.py b/homeassistant/components/template/binary_sensor.py index df918d3dd776..94d0f9d597bc 100644 --- a/homeassistant/components/template/binary_sensor.py +++ b/homeassistant/components/template/binary_sensor.py @@ -7,7 +7,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, ENTITY_ID_FORMAT, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import ( ATTR_ENTITY_ID, @@ -107,7 +107,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities(sensors) -class BinarySensorTemplate(BinarySensorDevice): +class BinarySensorTemplate(BinarySensorEntity): """A virtual binary sensor that triggers from another sensor.""" def __init__( diff --git a/homeassistant/components/tesla/binary_sensor.py b/homeassistant/components/tesla/binary_sensor.py index 8b60cd001637..c1f6fe18b998 100644 --- a/homeassistant/components/tesla/binary_sensor.py +++ b/homeassistant/components/tesla/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Tesla binary sensor.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import DOMAIN as TESLA_DOMAIN, TeslaDevice @@ -26,7 +26,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) -class TeslaBinarySensor(TeslaDevice, BinarySensorDevice): +class TeslaBinarySensor(TeslaDevice, BinarySensorEntity): """Implement an Tesla binary sensor for parking and charger.""" def __init__(self, tesla_device, controller, sensor_type, config_entry): diff --git a/homeassistant/components/threshold/binary_sensor.py b/homeassistant/components/threshold/binary_sensor.py index 509d8cfd4d35..98d426cb660c 100644 --- a/homeassistant/components/threshold/binary_sensor.py +++ b/homeassistant/components/threshold/binary_sensor.py @@ -6,7 +6,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import ( ATTR_ENTITY_ID, @@ -75,7 +75,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= ) -class ThresholdSensor(BinarySensorDevice): +class ThresholdSensor(BinarySensorEntity): """Representation of a Threshold sensor.""" def __init__(self, hass, entity_id, name, lower, upper, hysteresis, device_class): diff --git a/homeassistant/components/tod/binary_sensor.py b/homeassistant/components/tod/binary_sensor.py index ee9969c9974a..8a5bbf16c6cf 100644 --- a/homeassistant/components/tod/binary_sensor.py +++ b/homeassistant/components/tod/binary_sensor.py @@ -5,7 +5,7 @@ import logging import pytz 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_AFTER, CONF_BEFORE, @@ -60,7 +60,7 @@ def is_sun_event(event): return event in (SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET) -class TodSensor(BinarySensorDevice): +class TodSensor(BinarySensorEntity): """Time of the Day Sensor.""" def __init__(self, name, after, after_offset, before, before_offset): diff --git a/homeassistant/components/toon/binary_sensor.py b/homeassistant/components/toon/binary_sensor.py index e6ef780ec8ef..500cbec15261 100644 --- a/homeassistant/components/toon/binary_sensor.py +++ b/homeassistant/components/toon/binary_sensor.py @@ -3,7 +3,7 @@ import logging from typing import Any -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType @@ -110,7 +110,7 @@ async def async_setup_entry( async_add_entities(sensors, True) -class ToonBinarySensor(ToonEntity, BinarySensorDevice): +class ToonBinarySensor(ToonEntity, BinarySensorEntity): """Defines an Toon binary sensor.""" def __init__( diff --git a/homeassistant/components/totalconnect/binary_sensor.py b/homeassistant/components/totalconnect/binary_sensor.py index 48d9a96a4838..e296b12fa59d 100644 --- a/homeassistant/components/totalconnect/binary_sensor.py +++ b/homeassistant/components/totalconnect/binary_sensor.py @@ -5,7 +5,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_DOOR, DEVICE_CLASS_GAS, DEVICE_CLASS_SMOKE, - BinarySensorDevice, + BinarySensorEntity, ) from .const import DOMAIN @@ -26,7 +26,7 @@ async def async_setup_entry(hass, entry, async_add_entities) -> None: async_add_entities(sensors, True) -class TotalConnectBinarySensor(BinarySensorDevice): +class TotalConnectBinarySensor(BinarySensorEntity): """Represent an TotalConnect zone.""" def __init__(self, zone_id, location_id, zone): diff --git a/homeassistant/components/trend/binary_sensor.py b/homeassistant/components/trend/binary_sensor.py index 7c4a2dc4067a..1490efd7a864 100644 --- a/homeassistant/components/trend/binary_sensor.py +++ b/homeassistant/components/trend/binary_sensor.py @@ -10,7 +10,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, ENTITY_ID_FORMAT, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import ( ATTR_ENTITY_ID, @@ -95,7 +95,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(sensors) -class SensorTrend(BinarySensorDevice): +class SensorTrend(BinarySensorEntity): """Representation of a trend Sensor.""" def __init__( diff --git a/homeassistant/components/upcloud/binary_sensor.py b/homeassistant/components/upcloud/binary_sensor.py index 12324599958d..2b29aa0e24fb 100644 --- a/homeassistant/components/upcloud/binary_sensor.py +++ b/homeassistant/components/upcloud/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 from . import CONF_SERVERS, DATA_UPCLOUD, UpCloudServerEntity @@ -26,5 +26,5 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class UpCloudBinarySensor(UpCloudServerEntity, BinarySensorDevice): +class UpCloudBinarySensor(UpCloudServerEntity, BinarySensorEntity): """Representation of an UpCloud server sensor.""" diff --git a/homeassistant/components/updater/binary_sensor.py b/homeassistant/components/updater/binary_sensor.py index 7abab616d5c5..5088856ce6d6 100644 --- a/homeassistant/components/updater/binary_sensor.py +++ b/homeassistant/components/updater/binary_sensor.py @@ -1,6 +1,6 @@ """Support for Home Assistant Updater binary sensors.""" -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import ATTR_NEWEST_VERSION, ATTR_RELEASE_NOTES, DOMAIN as UPDATER_DOMAIN @@ -13,7 +13,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities([UpdaterBinary(hass.data[UPDATER_DOMAIN])]) -class UpdaterBinary(BinarySensorDevice): +class UpdaterBinary(BinarySensorEntity): """Representation of an updater binary sensor.""" def __init__(self, coordinator): diff --git a/homeassistant/components/uptimerobot/binary_sensor.py b/homeassistant/components/uptimerobot/binary_sensor.py index 401da496d2f8..231dce9a402e 100644 --- a/homeassistant/components/uptimerobot/binary_sensor.py +++ b/homeassistant/components/uptimerobot/binary_sensor.py @@ -4,7 +4,7 @@ import logging from pyuptimerobot import UptimeRobot 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_API_KEY import homeassistant.helpers.config_validation as cv @@ -43,7 +43,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices, True) -class UptimeRobotBinarySensor(BinarySensorDevice): +class UptimeRobotBinarySensor(BinarySensorEntity): """Representation of a Uptime Robot binary sensor.""" def __init__(self, api_key, up_robot, monitor_id, name, target): diff --git a/homeassistant/components/velbus/binary_sensor.py b/homeassistant/components/velbus/binary_sensor.py index 86f4e7a7cd8a..8c4cc5a4043a 100644 --- a/homeassistant/components/velbus/binary_sensor.py +++ b/homeassistant/components/velbus/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Velbus Binary Sensors.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import VelbusEntity from .const import DOMAIN @@ -20,7 +20,7 @@ async def async_setup_entry(hass, entry, async_add_entities): async_add_entities(entities) -class VelbusBinarySensor(VelbusEntity, BinarySensorDevice): +class VelbusBinarySensor(VelbusEntity, BinarySensorEntity): """Representation of a Velbus Binary Sensor.""" @property diff --git a/homeassistant/components/vera/binary_sensor.py b/homeassistant/components/vera/binary_sensor.py index 621dc09930d9..557874f846a4 100644 --- a/homeassistant/components/vera/binary_sensor.py +++ b/homeassistant/components/vera/binary_sensor.py @@ -5,7 +5,7 @@ from typing import Callable, List from homeassistant.components.binary_sensor import ( DOMAIN as PLATFORM_DOMAIN, ENTITY_ID_FORMAT, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant @@ -32,7 +32,7 @@ async def async_setup_entry( ) -class VeraBinarySensor(VeraDevice, BinarySensorDevice): +class VeraBinarySensor(VeraDevice, BinarySensorEntity): """Representation of a Vera Binary Sensor.""" def __init__(self, vera_device, controller): diff --git a/homeassistant/components/verisure/binary_sensor.py b/homeassistant/components/verisure/binary_sensor.py index bbdd9f54e834..206a4072acea 100644 --- a/homeassistant/components/verisure/binary_sensor.py +++ b/homeassistant/components/verisure/binary_sensor.py @@ -3,7 +3,7 @@ import logging from homeassistant.components.binary_sensor import ( DEVICE_CLASS_CONNECTIVITY, - BinarySensorDevice, + BinarySensorEntity, ) from . import CONF_DOOR_WINDOW, HUB as hub @@ -30,7 +30,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(sensors) -class VerisureDoorWindowSensor(BinarySensorDevice): +class VerisureDoorWindowSensor(BinarySensorEntity): """Representation of a Verisure door window sensor.""" def __init__(self, device_label): @@ -73,7 +73,7 @@ class VerisureDoorWindowSensor(BinarySensorDevice): hub.update_overview() -class VerisureEthernetStatus(BinarySensorDevice): +class VerisureEthernetStatus(BinarySensorEntity): """Representation of a Verisure VBOX internet status.""" @property diff --git a/homeassistant/components/volvooncall/binary_sensor.py b/homeassistant/components/volvooncall/binary_sensor.py index 20b07bba9404..0dba6186ef94 100644 --- a/homeassistant/components/volvooncall/binary_sensor.py +++ b/homeassistant/components/volvooncall/binary_sensor.py @@ -1,7 +1,7 @@ """Support for VOC.""" import logging -from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorDevice +from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity from . import DATA_KEY, VolvoEntity @@ -15,7 +15,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= async_add_entities([VolvoSensor(hass.data[DATA_KEY], *discovery_info)]) -class VolvoSensor(VolvoEntity, BinarySensorDevice): +class VolvoSensor(VolvoEntity, BinarySensorEntity): """Representation of a Volvo sensor.""" @property diff --git a/homeassistant/components/vultr/binary_sensor.py b/homeassistant/components/vultr/binary_sensor.py index 6b5b9bbd0f8d..c1b60479e7af 100644 --- a/homeassistant/components/vultr/binary_sensor.py +++ b/homeassistant/components/vultr/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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 import homeassistant.helpers.config_validation as cv @@ -51,7 +51,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities([VultrBinarySensor(vultr, subscription, name)], True) -class VultrBinarySensor(BinarySensorDevice): +class VultrBinarySensor(BinarySensorEntity): """Representation of a Vultr subscription sensor.""" def __init__(self, vultr, subscription, name): diff --git a/homeassistant/components/w800rf32/binary_sensor.py b/homeassistant/components/w800rf32/binary_sensor.py index 16239e0c98ca..35b52a1932de 100644 --- a/homeassistant/components/w800rf32/binary_sensor.py +++ b/homeassistant/components/w800rf32/binary_sensor.py @@ -7,7 +7,7 @@ import voluptuous as vol from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import CONF_DEVICE_CLASS, CONF_DEVICES, CONF_NAME from homeassistant.core import callback @@ -64,7 +64,7 @@ async def async_setup_platform(hass, config, add_entities, discovery_info=None): add_entities(binary_sensors) -class W800rf32BinarySensor(BinarySensorDevice): +class W800rf32BinarySensor(BinarySensorEntity): """A representation of a w800rf32 binary sensor.""" def __init__(self, device_id, name, device_class=None, off_delay=None): diff --git a/homeassistant/components/wemo/binary_sensor.py b/homeassistant/components/wemo/binary_sensor.py index 0ca1f950448f..805a730e3d9c 100644 --- a/homeassistant/components/wemo/binary_sensor.py +++ b/homeassistant/components/wemo/binary_sensor.py @@ -4,7 +4,7 @@ import logging import async_timeout -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.helpers.dispatcher import async_dispatcher_connect from .const import DOMAIN as WEMO_DOMAIN @@ -29,7 +29,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): ) -class WemoBinarySensor(BinarySensorDevice): +class WemoBinarySensor(BinarySensorEntity): """Representation a WeMo binary sensor.""" def __init__(self, device): diff --git a/homeassistant/components/wink/binary_sensor.py b/homeassistant/components/wink/binary_sensor.py index 6dd22a3f7b8f..d8967dd064dc 100644 --- a/homeassistant/components/wink/binary_sensor.py +++ b/homeassistant/components/wink/binary_sensor.py @@ -3,7 +3,7 @@ import logging import pywink -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import DOMAIN, WinkDevice @@ -33,12 +33,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None): _id = sensor.object_id() + sensor.name() if _id not in hass.data[DOMAIN]["unique_ids"]: if sensor.capability() in SENSOR_TYPES: - add_entities([WinkBinarySensorDevice(sensor, hass)]) + add_entities([WinkBinarySensorEntity(sensor, hass)]) for key in pywink.get_keys(): _id = key.object_id() + key.name() if _id not in hass.data[DOMAIN]["unique_ids"]: - add_entities([WinkBinarySensorDevice(key, hass)]) + add_entities([WinkBinarySensorEntity(key, hass)]) for sensor in pywink.get_smoke_and_co_detectors(): _id = sensor.object_id() + sensor.name() @@ -68,19 +68,19 @@ def setup_platform(hass, config, add_entities, discovery_info=None): for door_bell_sensor in pywink.get_door_bells(): _id = door_bell_sensor.object_id() + door_bell_sensor.name() if _id not in hass.data[DOMAIN]["unique_ids"]: - add_entities([WinkBinarySensorDevice(door_bell_sensor, hass)]) + add_entities([WinkBinarySensorEntity(door_bell_sensor, hass)]) for camera_sensor in pywink.get_cameras(): _id = camera_sensor.object_id() + camera_sensor.name() if _id not in hass.data[DOMAIN]["unique_ids"]: try: if camera_sensor.capability() in SENSOR_TYPES: - add_entities([WinkBinarySensorDevice(camera_sensor, hass)]) + add_entities([WinkBinarySensorEntity(camera_sensor, hass)]) except AttributeError: _LOGGER.info("Device isn't a sensor, skipping") -class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice): +class WinkBinarySensorEntity(WinkDevice, BinarySensorEntity): """Representation of a Wink binary sensor.""" def __init__(self, wink, hass): @@ -115,7 +115,7 @@ class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice): return super().device_state_attributes -class WinkSmokeDetector(WinkBinarySensorDevice): +class WinkSmokeDetector(WinkBinarySensorEntity): """Representation of a Wink Smoke detector.""" @property @@ -126,7 +126,7 @@ class WinkSmokeDetector(WinkBinarySensorDevice): return _attributes -class WinkHub(WinkBinarySensorDevice): +class WinkHub(WinkBinarySensorEntity): """Representation of a Wink Hub.""" @property @@ -146,7 +146,7 @@ class WinkHub(WinkBinarySensorDevice): return _attributes -class WinkRemote(WinkBinarySensorDevice): +class WinkRemote(WinkBinarySensorEntity): """Representation of a Wink Lutron Connected bulb remote.""" @property @@ -165,7 +165,7 @@ class WinkRemote(WinkBinarySensorDevice): return None -class WinkButton(WinkBinarySensorDevice): +class WinkButton(WinkBinarySensorEntity): """Representation of a Wink Relay button.""" @property @@ -177,7 +177,7 @@ class WinkButton(WinkBinarySensorDevice): return _attributes -class WinkGang(WinkBinarySensorDevice): +class WinkGang(WinkBinarySensorEntity): """Representation of a Wink Relay gang.""" @property diff --git a/homeassistant/components/wirelesstag/binary_sensor.py b/homeassistant/components/wirelesstag/binary_sensor.py index eae8c17edcd3..b92cdeb0bca7 100644 --- a/homeassistant/components/wirelesstag/binary_sensor.py +++ b/homeassistant/components/wirelesstag/binary_sensor.py @@ -3,7 +3,7 @@ import logging 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, STATE_OFF, STATE_ON from homeassistant.core import callback import homeassistant.helpers.config_validation as cv @@ -88,7 +88,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): hass.add_job(platform.install_push_notifications, sensors) -class WirelessTagBinarySensor(WirelessTagBaseSensor, BinarySensorDevice): +class WirelessTagBinarySensor(WirelessTagBaseSensor, BinarySensorEntity): """A binary sensor implementation for WirelessTags.""" def __init__(self, api, tag, sensor_type): diff --git a/homeassistant/components/workday/binary_sensor.py b/homeassistant/components/workday/binary_sensor.py index 0aa1f5bfc428..1613f10d66ac 100644 --- a/homeassistant/components/workday/binary_sensor.py +++ b/homeassistant/components/workday/binary_sensor.py @@ -6,7 +6,7 @@ from typing import Any import holidays 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, WEEKDAYS import homeassistant.helpers.config_validation as cv @@ -119,7 +119,7 @@ def get_date(date): return date -class IsWorkdaySensor(BinarySensorDevice): +class IsWorkdaySensor(BinarySensorEntity): """Implementation of a Workday sensor.""" def __init__(self, obj_holidays, workdays, excludes, days_offset, name): diff --git a/homeassistant/components/xiaomi_aqara/binary_sensor.py b/homeassistant/components/xiaomi_aqara/binary_sensor.py index 2c95198f3486..01caddb7eb53 100644 --- a/homeassistant/components/xiaomi_aqara/binary_sensor.py +++ b/homeassistant/components/xiaomi_aqara/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Xiaomi aqara binary sensors.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback from homeassistant.helpers.event import async_call_later @@ -99,7 +99,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities(devices) -class XiaomiBinarySensor(XiaomiDevice, BinarySensorDevice): +class XiaomiBinarySensor(XiaomiDevice, BinarySensorEntity): """Representation of a base XiaomiBinarySensor.""" def __init__(self, device, name, xiaomi_hub, data_key, device_class): diff --git a/homeassistant/components/yeelight/binary_sensor.py b/homeassistant/components/yeelight/binary_sensor.py index f5f3e03b7650..78a20ab01042 100644 --- a/homeassistant/components/yeelight/binary_sensor.py +++ b/homeassistant/components/yeelight/binary_sensor.py @@ -1,7 +1,7 @@ """Sensor platform support for yeelight.""" import logging -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.helpers.dispatcher import async_dispatcher_connect from . import DATA_UPDATED, DATA_YEELIGHT @@ -21,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): add_entities([YeelightNightlightModeSensor(device)]) -class YeelightNightlightModeSensor(BinarySensorDevice): +class YeelightNightlightModeSensor(BinarySensorEntity): """Representation of a Yeelight nightlight mode sensor.""" def __init__(self, device): diff --git a/homeassistant/components/zha/binary_sensor.py b/homeassistant/components/zha/binary_sensor.py index 044d32890da2..0ed931e92da3 100644 --- a/homeassistant/components/zha/binary_sensor.py +++ b/homeassistant/components/zha/binary_sensor.py @@ -12,7 +12,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_SMOKE, DEVICE_CLASS_VIBRATION, DOMAIN, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import STATE_ON from homeassistant.core import callback @@ -61,7 +61,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): hass.data[DATA_ZHA][DATA_ZHA_DISPATCHERS].append(unsub) -class BinarySensor(ZhaEntity, BinarySensorDevice): +class BinarySensor(ZhaEntity, BinarySensorEntity): """ZHA BinarySensor.""" SENSOR_ATTR = None diff --git a/homeassistant/components/zigbee/binary_sensor.py b/homeassistant/components/zigbee/binary_sensor.py index d32554e5744b..fe35b54a88f8 100644 --- a/homeassistant/components/zigbee/binary_sensor.py +++ b/homeassistant/components/zigbee/binary_sensor.py @@ -1,7 +1,7 @@ """Support for Zigbee binary sensors.""" import voluptuous as vol -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import DOMAIN, PLATFORM_SCHEMA, ZigBeeDigitalIn, ZigBeeDigitalInConfig @@ -21,5 +21,5 @@ def setup_platform(hass, config, add_entities, discovery_info=None): ) -class ZigBeeBinarySensor(ZigBeeDigitalIn, BinarySensorDevice): +class ZigBeeBinarySensor(ZigBeeDigitalIn, BinarySensorEntity): """Use ZigBeeDigitalIn as binary sensor.""" diff --git a/homeassistant/components/zoneminder/binary_sensor.py b/homeassistant/components/zoneminder/binary_sensor.py index 16c22cb48e78..739864fdea80 100644 --- a/homeassistant/components/zoneminder/binary_sensor.py +++ b/homeassistant/components/zoneminder/binary_sensor.py @@ -1,5 +1,5 @@ """Support for ZoneMinder binary sensors.""" -from homeassistant.components.binary_sensor import BinarySensorDevice +from homeassistant.components.binary_sensor import BinarySensorEntity from . import DOMAIN as ZONEMINDER_DOMAIN @@ -13,7 +13,7 @@ async def async_setup_platform(hass, config, add_entities, discovery_info=None): return True -class ZMAvailabilitySensor(BinarySensorDevice): +class ZMAvailabilitySensor(BinarySensorEntity): """Representation of the availability of ZoneMinder as a binary sensor.""" def __init__(self, host_name, client): diff --git a/homeassistant/components/zwave/binary_sensor.py b/homeassistant/components/zwave/binary_sensor.py index e4bafc44bee2..094279c4e7af 100644 --- a/homeassistant/components/zwave/binary_sensor.py +++ b/homeassistant/components/zwave/binary_sensor.py @@ -2,7 +2,7 @@ import datetime 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.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.event import track_point_in_time @@ -39,7 +39,7 @@ def get_device(values, **kwargs): return None -class ZWaveBinarySensor(BinarySensorDevice, ZWaveDeviceEntity): +class ZWaveBinarySensor(BinarySensorEntity, ZWaveDeviceEntity): """Representation of a binary sensor within Z-Wave.""" def __init__(self, values, device_class): diff --git a/tests/components/binary_sensor/test_init.py b/tests/components/binary_sensor/test_init.py index 2299ba4c9a25..a40df84b8991 100644 --- a/tests/components/binary_sensor/test_init.py +++ b/tests/components/binary_sensor/test_init.py @@ -1,24 +1,29 @@ """The tests for the Binary sensor component.""" -import unittest from unittest import mock from homeassistant.components import binary_sensor from homeassistant.const import STATE_OFF, STATE_ON -class TestBinarySensor(unittest.TestCase): - """Test the binary_sensor base class.""" +def test_state(): + """Test binary sensor state.""" + sensor = binary_sensor.BinarySensorEntity() + assert STATE_OFF == sensor.state + with mock.patch( + "homeassistant.components.binary_sensor.BinarySensorEntity.is_on", new=False, + ): + assert STATE_OFF == binary_sensor.BinarySensorEntity().state + with mock.patch( + "homeassistant.components.binary_sensor.BinarySensorEntity.is_on", new=True, + ): + assert STATE_ON == binary_sensor.BinarySensorEntity().state - def test_state(self): - """Test binary sensor state.""" - sensor = binary_sensor.BinarySensorDevice() - assert STATE_OFF == sensor.state - with mock.patch( - "homeassistant.components.binary_sensor.BinarySensorDevice.is_on", - new=False, - ): - assert STATE_OFF == binary_sensor.BinarySensorDevice().state - with mock.patch( - "homeassistant.components.binary_sensor.BinarySensorDevice.is_on", new=True, - ): - assert STATE_ON == binary_sensor.BinarySensorDevice().state + +def test_deprecated_base_class(caplog): + """Test deprecated base class.""" + + class CustomBinarySensor(binary_sensor.BinarySensorDevice): + pass + + CustomBinarySensor() + assert "BinarySensorDevice is deprecated, modify CustomBinarySensor" in caplog.text diff --git a/tests/testing_config/custom_components/test/binary_sensor.py b/tests/testing_config/custom_components/test/binary_sensor.py index bcff0adb4e48..13a877f7e8c0 100644 --- a/tests/testing_config/custom_components/test/binary_sensor.py +++ b/tests/testing_config/custom_components/test/binary_sensor.py @@ -3,7 +3,7 @@ Provide a mock binary sensor platform. Call init before using it in your tests to ensure clean test data. """ -from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorDevice +from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity from tests.common import MockEntity @@ -36,7 +36,7 @@ async def async_setup_platform( async_add_entities_callback(list(ENTITIES.values())) -class MockBinarySensor(MockEntity, BinarySensorDevice): +class MockBinarySensor(MockEntity, BinarySensorEntity): """Mock Binary Sensor class.""" @property