From 325891447b7c31204105b79e79f6509de3c67796 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 20 Apr 2020 11:56:11 +0200 Subject: [PATCH 1/5] Rename BinarySensorDevice to BinarySensorEntity --- .../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 | 8 ++--- .../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 | 10 +++---- .../custom_components/test/binary_sensor.py | 4 +-- 147 files changed, 354 insertions(+), 340 deletions(-) diff --git a/homeassistant/components/abode/binary_sensor.py b/homeassistant/components/abode/binary_sensor.py index 916ed2e2613943..7175fbc550a956 100644 --- a/homeassistant/components/abode/binary_sensor.py +++ b/homeassistant/components/abode/binary_sensor.py @@ -3,7 +3,7 @@ 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 9e2f7b0cc4a497..df8a74dc1d5584 100644 --- a/homeassistant/components/ads/binary_sensor.py +++ b/homeassistant/components/ads/binary_sensor.py @@ -6,7 +6,7 @@ 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 b34c90bc35add4..cec1b8356b0234 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 d1b1f9b8f1deb3..5aba9d637d42c4 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 40cb755bd98895..a3057211f2a47a 100644 --- a/homeassistant/components/amcrest/binary_sensor.py +++ b/homeassistant/components/amcrest/binary_sensor.py @@ -7,7 +7,7 @@ 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 0e9cca46afbfd2..14384565718480 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 000e738052d7df..daf9592f3e6e93 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 1b914f80aa7f38..3cd9038f1a89b8 100644 --- a/homeassistant/components/arest/binary_sensor.py +++ b/homeassistant/components/arest/binary_sensor.py @@ -8,7 +8,7 @@ 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 e61de7303026c5..6602cfe866130a 100644 --- a/homeassistant/components/august/binary_sensor.py +++ b/homeassistant/components/august/binary_sensor.py @@ -11,7 +11,7 @@ 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 @@ def unique_id(self) -> str: 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 e2f07276c6cebc..1d5a6e83ec1973 100644 --- a/homeassistant/components/aurora/binary_sensor.py +++ b/homeassistant/components/aurora/binary_sensor.py @@ -7,7 +7,7 @@ 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 d992c28746c3da..4709d706ad0760 100644 --- a/homeassistant/components/axis/binary_sensor.py +++ b/homeassistant/components/axis/binary_sensor.py @@ -4,7 +4,7 @@ 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 @@ def async_add_sensor(event_id): ) -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 d3994c3c421073..f5ee4c4e1e49dc 100644 --- a/homeassistant/components/bayesian/binary_sensor.py +++ b/homeassistant/components/bayesian/binary_sensor.py @@ -3,7 +3,7 @@ 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 b1245aeabde2d3..229f7a6c61e04e 100644 --- a/homeassistant/components/bbb_gpio/binary_sensor.py +++ b/homeassistant/components/bbb_gpio/binary_sensor.py @@ -4,7 +4,7 @@ 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 7dc5d958537b7a..f7a38c55772994 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -15,6 +15,8 @@ # 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 @@ def state(self): 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__(self, *args, **kwargs): + """Print deprecation warning.""" + _LOGGER.warning( + "BinarySensorDevice is deprecated, change to BinarySensorEntity in %s", + self.__class__.__name__, + ) + BinarySensorEntity.__init__(*args, **kwargs) diff --git a/homeassistant/components/blink/binary_sensor.py b/homeassistant/components/blink/binary_sensor.py index e8c01953bffd62..219b9fb8cd36de 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 140d7e638a740e..b98bb688ca38e0 100644 --- a/homeassistant/components/bloomsky/binary_sensor.py +++ b/homeassistant/components/bloomsky/binary_sensor.py @@ -3,7 +3,7 @@ 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 fc3069f284cd37..ee89873e8feff0 100644 --- a/homeassistant/components/bmw_connected_drive/binary_sensor.py +++ b/homeassistant/components/bmw_connected_drive/binary_sensor.py @@ -3,7 +3,7 @@ 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 c2974678faae7f..baa63679d42c1b 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 eaa371be1a3045..dc62d8daa9d734 100644 --- a/homeassistant/components/command_line/binary_sensor.py +++ b/homeassistant/components/command_line/binary_sensor.py @@ -7,7 +7,7 @@ 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 326ac799f06981..3077056c397df0 100644 --- a/homeassistant/components/concord232/binary_sensor.py +++ b/homeassistant/components/concord232/binary_sensor.py @@ -9,7 +9,7 @@ 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 caac12c1b204bc..7f6876a709be48 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 d16722525f92ed..95fa223c6979ef 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 @@ def async_add_sensor(sensors, new=True): ) -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 0f6dfa9f357707..04d8e72f9a8005 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 c351517753538b..d076dae9210f2d 100644 --- a/homeassistant/components/digital_ocean/binary_sensor.py +++ b/homeassistant/components/digital_ocean/binary_sensor.py @@ -3,7 +3,7 @@ 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 2f422007ff4550..64c4b07ed1f0a1 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 4f02d6fdde00f6..4be443a36f44bf 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 7b801578ccd4bf..803b20383b6f21 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 4ff1b4611292e8..7fb8ea5e3f2fa6 100644 --- a/homeassistant/components/enocean/binary_sensor.py +++ b/homeassistant/components/enocean/binary_sensor.py @@ -7,7 +7,7 @@ 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 f698a9d27d92dd..54445660484540 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 fe41bb2f7bb6fa..d605a48410b89f 100644 --- a/homeassistant/components/esphome/binary_sensor.py +++ b/homeassistant/components/esphome/binary_sensor.py @@ -3,7 +3,7 @@ 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 e3a9c09b5d97b5..a8842f9c40183c 100644 --- a/homeassistant/components/ffmpeg_motion/binary_sensor.py +++ b/homeassistant/components/ffmpeg_motion/binary_sensor.py @@ -4,7 +4,7 @@ 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 fa2d6ceb3c6624..251bd1df6a3ed6 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 55f92e2e5ceabd..e81f8f2f5b048d 100644 --- a/homeassistant/components/flic/binary_sensor.py +++ b/homeassistant/components/flic/binary_sensor.py @@ -12,7 +12,7 @@ ) 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 c0893b9331642f..7db216c32e107e 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 a2f8ba4a0a26c2..43ceb75e449be1 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 33458d049a2841..d935192f97d4ad 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 4d2a879bc735bb..779afa10cca643 100644 --- a/homeassistant/components/hikvision/binary_sensor.py +++ b/homeassistant/components/hikvision/binary_sensor.py @@ -5,7 +5,7 @@ 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 @@ def get_attributes(self, sensor, channel): 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 fa91d6862a21a0..27c648f554bdd4 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 b96e5f651e3388..939c6055e10f1d 100644 --- a/homeassistant/components/homekit_controller/binary_sensor.py +++ b/homeassistant/components/homekit_controller/binary_sensor.py @@ -9,7 +9,7 @@ DEVICE_CLASS_OCCUPANCY, DEVICE_CLASS_OPENING, DEVICE_CLASS_SMOKE, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.core import callback @@ -18,7 +18,7 @@ _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 @@ def is_on(self): 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 @@ def is_on(self): 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 @@ def is_on(self): 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 @@ def is_on(self): 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 731525c846010a..041f2f02643f88 100644 --- a/homeassistant/components/homematic/binary_sensor.py +++ b/homeassistant/components/homematic/binary_sensor.py @@ -7,7 +7,7 @@ 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 @@ def _init_data_struct(self): 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 00147e1b7ec09a..15c41be24b53d7 100644 --- a/homeassistant/components/homematicip_cloud/binary_sensor.py +++ b/homeassistant/components/homematicip_cloud/binary_sensor.py @@ -36,7 +36,7 @@ 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 @@ def device_state_attributes(self) -> Dict[str, Any]: return state_attr -class HomematicipContactInterface(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipContactInterface(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud contact interface.""" @property @@ -173,7 +173,7 @@ def is_on(self) -> bool: 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 @@ def is_on(self) -> bool: 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 @@ def is_on(self) -> bool: return self._device.motionDetected -class HomematicipPresenceDetector(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipPresenceDetector(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud presence detector.""" @property @@ -217,7 +217,7 @@ def is_on(self) -> bool: return self._device.presenceDetected -class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipSmokeDetector(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud smoke detector.""" @property @@ -236,7 +236,7 @@ def is_on(self) -> bool: return False -class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorDevice): +class HomematicipWaterDetector(HomematicipGenericDevice, BinarySensorEntity): """Representation of a HomematicIP Cloud water detector.""" @property @@ -250,7 +250,7 @@ def is_on(self) -> bool: 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 @@ def is_on(self) -> bool: 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 @@ def is_on(self) -> bool: 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 @@ def device_state_attributes(self) -> Dict[str, Any]: 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 @@ def is_on(self) -> bool: class HomematicipPluggableMainsFailureSurveillanceSensor( - HomematicipGenericDevice, BinarySensorDevice + HomematicipGenericDevice, BinarySensorEntity ): """Representation of a HomematicIP Cloud pluggable mains failure surveillance sensor.""" @@ -353,7 +353,7 @@ def is_on(self) -> bool: 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 @@ def is_on(self) -> bool: 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 af6ed75d591f4d..575cc9789ca50d 100644 --- a/homeassistant/components/huawei_lte/binary_sensor.py +++ b/homeassistant/components/huawei_lte/binary_sensor.py @@ -8,7 +8,7 @@ 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 8a6b5d203a8e3f..cfbe041aafe4e6 100644 --- a/homeassistant/components/hue/binary_sensor.py +++ b/homeassistant/components/hue/binary_sensor.py @@ -4,7 +4,7 @@ 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 037c48b029ef0c..389506c6d5ab8e 100644 --- a/homeassistant/components/hydrawise/binary_sensor.py +++ b/homeassistant/components/hydrawise/binary_sensor.py @@ -3,7 +3,7 @@ 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 30d419c1bce058..669188c473f49e 100644 --- a/homeassistant/components/iaqualink/binary_sensor.py +++ b/homeassistant/components/iaqualink/binary_sensor.py @@ -4,7 +4,7 @@ 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 3f59d7981fb0df..0c6a685bc93dec 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 f15c2298b9d713..bf1340fb235496 100644 --- a/homeassistant/components/incomfort/binary_sensor.py +++ b/homeassistant/components/incomfort/binary_sensor.py @@ -3,7 +3,7 @@ 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 b96feb21831520..81c3c58ef12602 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 3b8e222c912401..e1f0d7a19ceca5 100644 --- a/homeassistant/components/iss/binary_sensor.py +++ b/homeassistant/components/iss/binary_sensor.py @@ -6,7 +6,7 @@ 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 30b26ea5d2421e..a96f2f44fdbb9b 100644 --- a/homeassistant/components/isy994/binary_sensor.py +++ b/homeassistant/components/isy994/binary_sensor.py @@ -3,7 +3,7 @@ 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 @@ def device_class(self) -> str: 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 @@ def device_state_attributes(self): 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 7362fce3cd0301..22e6a46e0ec49d 100644 --- a/homeassistant/components/jewish_calendar/binary_sensor.py +++ b/homeassistant/components/jewish_calendar/binary_sensor.py @@ -3,7 +3,7 @@ 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 5cced416bc3a6a..5c9edfa7793726 100644 --- a/homeassistant/components/keba/binary_sensor.py +++ b/homeassistant/components/keba/binary_sensor.py @@ -6,7 +6,7 @@ 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 95e7e2cc400f7a..9f8c3cc8491011 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 5cd270d500833e..20494eee4242f5 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 249adf04af8f34..7b4cedfebad786 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 @@ def input_received(self, input_obj): 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 @@ def input_received(self, input_obj): 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 674a97a0f4525b..c4a14210d32b2e 100644 --- a/homeassistant/components/linode/binary_sensor.py +++ b/homeassistant/components/linode/binary_sensor.py @@ -3,7 +3,7 @@ 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 b2a332a03e766f..30af5743aa0c88 100644 --- a/homeassistant/components/lupusec/binary_sensor.py +++ b/homeassistant/components/lupusec/binary_sensor.py @@ -4,7 +4,7 @@ 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 866c82a7b2acf1..e2e143da4352ee 100644 --- a/homeassistant/components/lutron/binary_sensor.py +++ b/homeassistant/components/lutron/binary_sensor.py @@ -3,7 +3,7 @@ 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 871f3c28664fc1..15c3d19008a7ef 100644 --- a/homeassistant/components/lutron_caseta/binary_sensor.py +++ b/homeassistant/components/lutron_caseta/binary_sensor.py @@ -3,7 +3,7 @@ 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 2670b61b456965..b42c96f99c2fec 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 @@ def should_poll(self): @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 59f268e657c05b..8cc50fa9dfacd2 100644 --- a/homeassistant/components/mcp23017/binary_sensor.py +++ b/homeassistant/components/mcp23017/binary_sensor.py @@ -7,7 +7,7 @@ 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 7d3bea4c995997..ebdeaa7c903d69 100644 --- a/homeassistant/components/meteoalarm/binary_sensor.py +++ b/homeassistant/components/meteoalarm/binary_sensor.py @@ -5,7 +5,7 @@ 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 cde2a4149007d8..aadcba44e85714 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 c04a1af316dc96..ae8efc0c11325e 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 @@ def handle_sensor_registration(webhook_id, data): ) -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 5f80813d108b06..ce66b7aecdb4bd 100644 --- a/homeassistant/components/modbus/binary_sensor.py +++ b/homeassistant/components/modbus/binary_sensor.py @@ -9,7 +9,7 @@ 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 c7595de0eebbd5..482628e08aa0a1 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -7,7 +7,7 @@ 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 702f3146f8e407..b009fe3b3f4839 100644 --- a/homeassistant/components/mychevy/binary_sensor.py +++ b/homeassistant/components/mychevy/binary_sensor.py @@ -3,7 +3,7 @@ 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 7ce303e5d19a71..a583bc22197e5e 100644 --- a/homeassistant/components/myq/binary_sensor.py +++ b/homeassistant/components/myq/binary_sensor.py @@ -3,7 +3,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_CONNECTIVITY, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.core import callback @@ -32,12 +32,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 0b94e764937391..0bab6ea6eeae0f 100644 --- a/homeassistant/components/mysensors/binary_sensor.py +++ b/homeassistant/components/mysensors/binary_sensor.py @@ -3,7 +3,7 @@ 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 c584440874a273..87c1a3a266552f 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 @@ async def _handle(self, hass, data): 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 c719febdb58f07..d7e7851792eb3a 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 34dc7b06ade620..dd52e1d665fc2b 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 @@ def get_binary_sensors(): 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 31eb46925a1c59..f18c7a2ff86140 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 5c33412c647421..9adf47ee2c5ef4 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 9e4c6f5d969935..67bc580bfdf3a1 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 786d495cc9b746..3d2064dad4c611 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 @@ def icon(self): 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 53a98204704597..8d60ef0901aeb6 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 f6006ff2de486c..d12f337c171ec7 100644 --- a/homeassistant/components/nx584/binary_sensor.py +++ b/homeassistant/components/nx584/binary_sensor.py @@ -10,7 +10,7 @@ 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 7ed1170c6a0f22..0f740525f84cd7 100644 --- a/homeassistant/components/octoprint/binary_sensor.py +++ b/homeassistant/components/octoprint/binary_sensor.py @@ -3,7 +3,7 @@ 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 62c0d3dd2c11ee..9e3c4d4122972b 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 6e403a59b43e5e..2d514b33cf3fec 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 b89442a571c39d..0c8f8bc69cfd73 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 236fd47af73543..8e14ea8ce69065 100644 --- a/homeassistant/components/pcal9535a/binary_sensor.py +++ b/homeassistant/components/pcal9535a/binary_sensor.py @@ -4,7 +4,7 @@ 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 89f293d1e0de66..4eb901017103a3 100644 --- a/homeassistant/components/pi4ioe5v9xxxx/binary_sensor.py +++ b/homeassistant/components/pi4ioe5v9xxxx/binary_sensor.py @@ -4,7 +4,7 @@ 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 ae6d562725d612..a53e575b8754bc 100644 --- a/homeassistant/components/pilight/binary_sensor.py +++ b/homeassistant/components/pilight/binary_sensor.py @@ -5,7 +5,7 @@ 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 @@ def _handle_code(self, call): 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 4d9a99c678e6c3..a9c69f4ddad11f 100644 --- a/homeassistant/components/ping/binary_sensor.py +++ b/homeassistant/components/ping/binary_sensor.py @@ -7,7 +7,7 @@ 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 b417c128913dcc..5a780c2e57a359 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_discover_sensor(device_id): ) -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 889e6c192ef154..fe25afb1fd8d14 100644 --- a/homeassistant/components/powerwall/binary_sensor.py +++ b/homeassistant/components/powerwall/binary_sensor.py @@ -6,7 +6,7 @@ from homeassistant.components.binary_sensor import ( DEVICE_CLASS_BATTERY_CHARGING, DEVICE_CLASS_CONNECTIVITY, - BinarySensorDevice, + BinarySensorEntity, ) from homeassistant.const import DEVICE_CLASS_POWER @@ -57,7 +57,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 @@ -90,7 +90,7 @@ def device_state_attributes(self): } -class PowerWallConnectedSensor(PowerWallEntity, BinarySensorDevice): +class PowerWallConnectedSensor(PowerWallEntity, BinarySensorEntity): """Representation of an Powerwall connected sensor.""" @property @@ -114,7 +114,7 @@ def is_on(self): 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 diff --git a/homeassistant/components/proxmoxve/binary_sensor.py b/homeassistant/components/proxmoxve/binary_sensor.py index 15b1f1483e1f47..698a2c35ae196e 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 b3635dcb1f47cc..7a4168438617e2 100644 --- a/homeassistant/components/qwikswitch/binary_sensor.py +++ b/homeassistant/components/qwikswitch/binary_sensor.py @@ -3,7 +3,7 @@ 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 c3161cae6abad9..4976714f0a2d0b 100644 --- a/homeassistant/components/rachio/binary_sensor.py +++ b/homeassistant/components/rachio/binary_sensor.py @@ -4,7 +4,7 @@ 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 51c5f7a9dbefe7..62c6824f5e0006 100644 --- a/homeassistant/components/rainbird/binary_sensor.py +++ b/homeassistant/components/rainbird/binary_sensor.py @@ -3,7 +3,7 @@ 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 2074a57df984ae..d2659e133b0bf2 100644 --- a/homeassistant/components/raincloud/binary_sensor.py +++ b/homeassistant/components/raincloud/binary_sensor.py @@ -3,7 +3,7 @@ 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 e5fdc8d6b46f3e..b3f7ffb7d6bf24 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 e502439b28c32d..baec29c5937391 100644 --- a/homeassistant/components/random/binary_sensor.py +++ b/homeassistant/components/random/binary_sensor.py @@ -7,7 +7,7 @@ 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 6a88318706d0a1..ea3130da4ba4d4 100644 --- a/homeassistant/components/raspihats/binary_sensor.py +++ b/homeassistant/components/raspihats/binary_sensor.py @@ -3,7 +3,7 @@ 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 862bd30ae432da..d97183de86ebc7 100644 --- a/homeassistant/components/remote_rpi_gpio/binary_sensor.py +++ b/homeassistant/components/remote_rpi_gpio/binary_sensor.py @@ -4,7 +4,7 @@ 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 1bbde240789109..6d797dfd834efb 100644 --- a/homeassistant/components/rest/binary_sensor.py +++ b/homeassistant/components/rest/binary_sensor.py @@ -7,7 +7,7 @@ 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 c3600da40517b0..8962af3c0d43c2 100644 --- a/homeassistant/components/rflink/binary_sensor.py +++ b/homeassistant/components/rflink/binary_sensor.py @@ -6,7 +6,7 @@ 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 a88594dcceaa0b..5e610128ea665e 100644 --- a/homeassistant/components/rfxtrx/binary_sensor.py +++ b/homeassistant/components/rfxtrx/binary_sensor.py @@ -7,7 +7,7 @@ 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 off_delay_listener(now): 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 385d8a4f95586d..fa303b9437888a 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 47212563b5be76..fb11a0f9d4caaf 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 3e38da47eedd8f..a7ecaa3d36c9b1 100644 --- a/homeassistant/components/rpi_gpio/binary_sensor.py +++ b/homeassistant/components/rpi_gpio/binary_sensor.py @@ -4,7 +4,7 @@ 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 89d44a0e8db301..e77ceea3eb7d3f 100644 --- a/homeassistant/components/rpi_pfio/binary_sensor.py +++ b/homeassistant/components/rpi_pfio/binary_sensor.py @@ -4,7 +4,7 @@ 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 4a9be339a1cdd1..19763903f27845 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 384bc3d074ffc1..62fe0d01d4ee59 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 f0df663eba3760..a5c6681eb2bf62 100644 --- a/homeassistant/components/skybell/binary_sensor.py +++ b/homeassistant/components/skybell/binary_sensor.py @@ -4,7 +4,7 @@ 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 3ba39a38764b01..39ae3e7c6584b7 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 78d2c73ca734bb..825cf14995216f 100644 --- a/homeassistant/components/smartthings/binary_sensor.py +++ b/homeassistant/components/smartthings/binary_sensor.py @@ -3,7 +3,7 @@ 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 a86b3548e959a9..f8b9114ae0ee76 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 626e30849df497..75256b60cfbdcb 100644 --- a/homeassistant/components/spc/binary_sensor.py +++ b/homeassistant/components/spc/binary_sensor.py @@ -3,7 +3,7 @@ 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 f2288e9363bf69..df9bd348b8d486 100644 --- a/homeassistant/components/starline/binary_sensor.py +++ b/homeassistant/components/starline/binary_sensor.py @@ -4,7 +4,7 @@ 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 c8515f401da376..a07f208ac9df1c 100644 --- a/homeassistant/components/stookalert/binary_sensor.py +++ b/homeassistant/components/stookalert/binary_sensor.py @@ -5,7 +5,7 @@ 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 78b2ceb40441d0..a25f5e124e678a 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 @@ def is_away(self): 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 5b3ac492137d3a..26f498d43fe203 100644 --- a/homeassistant/components/surepetcare/binary_sensor.py +++ b/homeassistant/components/surepetcare/binary_sensor.py @@ -8,7 +8,7 @@ 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 @@ def device_class(self) -> str: 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 @@ def name(self) -> str: 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 7621a542838b4d..39e492601bd83e 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 e54bc7298b0a79..912dd27c887ed4 100644 --- a/homeassistant/components/tapsaff/binary_sensor.py +++ b/homeassistant/components/tapsaff/binary_sensor.py @@ -5,7 +5,7 @@ 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 4d26d819ede2df..1648ab5e247ae8 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 09541a120fd486..3f82936568912d 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_discover_binary_sensor(device_id): ) -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 df918d3dd776de..94d0f9d597bcb4 100644 --- a/homeassistant/components/template/binary_sensor.py +++ b/homeassistant/components/template/binary_sensor.py @@ -7,7 +7,7 @@ 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 8b60cd001637f0..c1f6fe18b9980e 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 509d8cfd4d3526..98d426cb660c73 100644 --- a/homeassistant/components/threshold/binary_sensor.py +++ b/homeassistant/components/threshold/binary_sensor.py @@ -6,7 +6,7 @@ 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 ee9969c9974a93..8a5bbf16c6cfa0 100644 --- a/homeassistant/components/tod/binary_sensor.py +++ b/homeassistant/components/tod/binary_sensor.py @@ -5,7 +5,7 @@ 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 e6ef780ec8ef42..500cbec1526183 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 48d9a96a483838..e296b12fa59d4d 100644 --- a/homeassistant/components/totalconnect/binary_sensor.py +++ b/homeassistant/components/totalconnect/binary_sensor.py @@ -5,7 +5,7 @@ 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 7c4a2dc4067a05..1490efd7a86453 100644 --- a/homeassistant/components/trend/binary_sensor.py +++ b/homeassistant/components/trend/binary_sensor.py @@ -10,7 +10,7 @@ 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 12324599958d9e..2b29aa0e24fbd4 100644 --- a/homeassistant/components/upcloud/binary_sensor.py +++ b/homeassistant/components/upcloud/binary_sensor.py @@ -3,7 +3,7 @@ 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 7abab616d5c513..5088856ce6d632 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 401da496d2f89f..231dce9a402ef1 100644 --- a/homeassistant/components/uptimerobot/binary_sensor.py +++ b/homeassistant/components/uptimerobot/binary_sensor.py @@ -4,7 +4,7 @@ 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 86f4e7a7cd8aba..8c4cc5a4043a13 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 621dc09930d99f..557874f846a4bb 100644 --- a/homeassistant/components/vera/binary_sensor.py +++ b/homeassistant/components/vera/binary_sensor.py @@ -5,7 +5,7 @@ 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 bbdd9f54e834fb..206a4072aceae8 100644 --- a/homeassistant/components/verisure/binary_sensor.py +++ b/homeassistant/components/verisure/binary_sensor.py @@ -3,7 +3,7 @@ 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 @@ def update(self): 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 20b07bba9404d7..0dba6186ef94a6 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 6b5b9bbd0f8d22..c1b60479e7af8c 100644 --- a/homeassistant/components/vultr/binary_sensor.py +++ b/homeassistant/components/vultr/binary_sensor.py @@ -3,7 +3,7 @@ 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 16239e0c98ca5b..35b52a1932de0f 100644 --- a/homeassistant/components/w800rf32/binary_sensor.py +++ b/homeassistant/components/w800rf32/binary_sensor.py @@ -7,7 +7,7 @@ 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 0ca1f950448fd0..805a730e3d9c91 100644 --- a/homeassistant/components/wemo/binary_sensor.py +++ b/homeassistant/components/wemo/binary_sensor.py @@ -4,7 +4,7 @@ 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 _discovered_wemo(device): ) -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 6dd22a3f7b8fd8..d8967dd064dc89 100644 --- a/homeassistant/components/wink/binary_sensor.py +++ b/homeassistant/components/wink/binary_sensor.py @@ -3,7 +3,7 @@ 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 @@ def device_state_attributes(self): return super().device_state_attributes -class WinkSmokeDetector(WinkBinarySensorDevice): +class WinkSmokeDetector(WinkBinarySensorEntity): """Representation of a Wink Smoke detector.""" @property @@ -126,7 +126,7 @@ def device_state_attributes(self): return _attributes -class WinkHub(WinkBinarySensorDevice): +class WinkHub(WinkBinarySensorEntity): """Representation of a Wink Hub.""" @property @@ -146,7 +146,7 @@ def device_state_attributes(self): return _attributes -class WinkRemote(WinkBinarySensorDevice): +class WinkRemote(WinkBinarySensorEntity): """Representation of a Wink Lutron Connected bulb remote.""" @property @@ -165,7 +165,7 @@ def device_class(self): return None -class WinkButton(WinkBinarySensorDevice): +class WinkButton(WinkBinarySensorEntity): """Representation of a Wink Relay button.""" @property @@ -177,7 +177,7 @@ def device_state_attributes(self): 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 eae8c17edcd32e..b92cdeb0bca7f9 100644 --- a/homeassistant/components/wirelesstag/binary_sensor.py +++ b/homeassistant/components/wirelesstag/binary_sensor.py @@ -3,7 +3,7 @@ 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 0aa1f5bfc42838..1613f10d66ac9d 100644 --- a/homeassistant/components/workday/binary_sensor.py +++ b/homeassistant/components/workday/binary_sensor.py @@ -6,7 +6,7 @@ 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 2c95198f348686..01caddb7eb53c9 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 f5f3e03b7650ee..78a20ab0104267 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 044d32890da2c6..0ed931e92da3eb 100644 --- a/homeassistant/components/zha/binary_sensor.py +++ b/homeassistant/components/zha/binary_sensor.py @@ -12,7 +12,7 @@ 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 d32554e5744bfb..fe35b54a88f8b4 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 16c22cb48e784b..739864fdea8054 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 e4bafc44bee246..094279c4e7af5a 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 2299ba4c9a25fd..e41f02c72f49f3 100644 --- a/tests/components/binary_sensor/test_init.py +++ b/tests/components/binary_sensor/test_init.py @@ -11,14 +11,14 @@ class TestBinarySensor(unittest.TestCase): def test_state(self): """Test binary sensor state.""" - sensor = binary_sensor.BinarySensorDevice() + sensor = binary_sensor.BinarySensorEntity() assert STATE_OFF == sensor.state with mock.patch( - "homeassistant.components.binary_sensor.BinarySensorDevice.is_on", + "homeassistant.components.binary_sensor.BinarySensorEntity.is_on", new=False, ): - assert STATE_OFF == binary_sensor.BinarySensorDevice().state + assert STATE_OFF == binary_sensor.BinarySensorEntity().state with mock.patch( - "homeassistant.components.binary_sensor.BinarySensorDevice.is_on", new=True, + "homeassistant.components.binary_sensor.BinarySensorEntity.is_on", new=True, ): - assert STATE_ON == binary_sensor.BinarySensorDevice().state + assert STATE_ON == binary_sensor.BinarySensorEntity().state diff --git a/tests/testing_config/custom_components/test/binary_sensor.py b/tests/testing_config/custom_components/test/binary_sensor.py index bcff0adb4e4856..13a877f7e8c044 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 @@ 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 From d5b537c9608c180561d95103c67bd85917872f25 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 20 Apr 2020 17:26:50 +0200 Subject: [PATCH 2/5] Tweak --- homeassistant/components/powerwall/binary_sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/powerwall/binary_sensor.py b/homeassistant/components/powerwall/binary_sensor.py index fe25afb1fd8d14..2a4b26a5ab6f81 100644 --- a/homeassistant/components/powerwall/binary_sensor.py +++ b/homeassistant/components/powerwall/binary_sensor.py @@ -138,7 +138,7 @@ def is_on(self): return self._coordinator.data[POWERWALL_API_GRID_STATUS] == GridStatus.CONNECTED -class PowerWallChargingStatusSensor(PowerWallEntity, BinarySensorDevice): +class PowerWallChargingStatusSensor(PowerWallEntity, BinarySensorEntity): """Representation of an Powerwall grid status sensor.""" @property From 2d524d975f2ca609b9d43adfd8964f96fa6f1037 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 21 Apr 2020 17:28:20 +0200 Subject: [PATCH 3/5] Move deprecation warning to __new__, add test --- .../components/binary_sensor/__init__.py | 9 +++-- tests/components/binary_sensor/test_init.py | 38 +++++++++++-------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index f7a38c55772994..7ec332cab638ac 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -166,10 +166,11 @@ def device_class(self): class BinarySensorDevice(BinarySensorEntity): """Represent a binary sensor (for backwards compatibility).""" - def __init__(self, *args, **kwargs): + def __new__(cls, *args, **kwargs): """Print deprecation warning.""" + instance = BinarySensorEntity.__new__(cls) _LOGGER.warning( - "BinarySensorDevice is deprecated, change to BinarySensorEntity in %s", - self.__class__.__name__, + "BinarySensorDevice is deprecated, modify %s to extend BinarySensorEntity", + instance.__class__.__name__, ) - BinarySensorEntity.__init__(*args, **kwargs) + return instance diff --git a/tests/components/binary_sensor/test_init.py b/tests/components/binary_sensor/test_init.py index e41f02c72f49f3..9223550f3f2c25 100644 --- a/tests/components/binary_sensor/test_init.py +++ b/tests/components/binary_sensor/test_init.py @@ -1,24 +1,30 @@ """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.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_deprecated_base_class(caplog): + """Test deprecated base class.""" + + class CustomBinarySensor(binary_sensor.BinarySensorDevice): + def __init__(self): + pass + + CustomBinarySensor() + assert "BinarySensorDevice is deprecated, modify CustomBinarySensor" in caplog.text From c6f0da0c309beb7b50d8eeedd0087f500ad7003e Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 22 Apr 2020 21:07:21 +0200 Subject: [PATCH 4/5] Move deprecation warning back to __init__ --- homeassistant/components/binary_sensor/__init__.py | 6 ++---- tests/components/binary_sensor/test_init.py | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index 7ec332cab638ac..2bfa4c0d852c32 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -166,11 +166,9 @@ def device_class(self): class BinarySensorDevice(BinarySensorEntity): """Represent a binary sensor (for backwards compatibility).""" - def __new__(cls, *args, **kwargs): + def __init__(self, *args, **kwargs): """Print deprecation warning.""" - instance = BinarySensorEntity.__new__(cls) _LOGGER.warning( "BinarySensorDevice is deprecated, modify %s to extend BinarySensorEntity", - instance.__class__.__name__, + self.__class__.__name__, ) - return instance diff --git a/tests/components/binary_sensor/test_init.py b/tests/components/binary_sensor/test_init.py index 9223550f3f2c25..a40df84b89916e 100644 --- a/tests/components/binary_sensor/test_init.py +++ b/tests/components/binary_sensor/test_init.py @@ -23,8 +23,7 @@ def test_deprecated_base_class(caplog): """Test deprecated base class.""" class CustomBinarySensor(binary_sensor.BinarySensorDevice): - def __init__(self): - pass + pass CustomBinarySensor() assert "BinarySensorDevice is deprecated, modify CustomBinarySensor" in caplog.text From 9d3d038a432432931d711cd72eca064430ac0e42 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 23 Apr 2020 16:24:12 +0200 Subject: [PATCH 5/5] Move deprecation warning to __init_subclass --- homeassistant/components/binary_sensor/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index 2bfa4c0d852c32..f022509f9dea52 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -166,9 +166,10 @@ def device_class(self): class BinarySensorDevice(BinarySensorEntity): """Represent a binary sensor (for backwards compatibility).""" - def __init__(self, *args, **kwargs): + def __init_subclass__(cls, **kwargs): """Print deprecation warning.""" + super().__init_subclass__(**kwargs) _LOGGER.warning( "BinarySensorDevice is deprecated, modify %s to extend BinarySensorEntity", - self.__class__.__name__, + cls.__name__, )