diff --git a/homeassistant/components/opentherm_gw/binary_sensor.py b/homeassistant/components/opentherm_gw/binary_sensor.py index e4880ed26e9..083fb103481 100644 --- a/homeassistant/components/opentherm_gw/binary_sensor.py +++ b/homeassistant/components/opentherm_gw/binary_sensor.py @@ -83,6 +83,8 @@ async def async_setup_entry( class OpenThermBinarySensor(BinarySensorEntity): """Represent an OpenTherm Gateway binary sensor.""" + _attr_should_poll = False + def __init__(self, gw_dev, var, source, device_class, friendly_name_format): """Initialize the binary sensor.""" self.entity_id = async_generate_entity_id( @@ -162,11 +164,6 @@ class OpenThermBinarySensor(BinarySensorEntity): """Return the class of this device.""" return self._device_class - @property - def should_poll(self): - """Return False because entity pushes its state.""" - return False - class DeprecatedOpenThermBinarySensor(OpenThermBinarySensor): """Represent a deprecated OpenTherm Gateway Binary Sensor.""" diff --git a/homeassistant/components/opentherm_gw/climate.py b/homeassistant/components/opentherm_gw/climate.py index 0350c446a3f..fecc99a4cca 100644 --- a/homeassistant/components/opentherm_gw/climate.py +++ b/homeassistant/components/opentherm_gw/climate.py @@ -62,6 +62,7 @@ async def async_setup_entry( class OpenThermClimate(ClimateEntity): """Representation of a climate device.""" + _attr_should_poll = False _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ) @@ -201,11 +202,6 @@ class OpenThermClimate(ClimateEntity): return PRECISION_HALVES return PRECISION_WHOLE - @property - def should_poll(self): - """Disable polling for this entity.""" - return False - @property def temperature_unit(self): """Return the unit of measurement used by the platform.""" diff --git a/homeassistant/components/opentherm_gw/sensor.py b/homeassistant/components/opentherm_gw/sensor.py index 7fb518b0e6d..5eea4fca099 100644 --- a/homeassistant/components/opentherm_gw/sensor.py +++ b/homeassistant/components/opentherm_gw/sensor.py @@ -86,6 +86,8 @@ async def async_setup_entry( class OpenThermSensor(SensorEntity): """Representation of an OpenTherm Gateway sensor.""" + _attr_should_poll = False + def __init__(self, gw_dev, var, source, device_class, unit, friendly_name_format): """Initialize the OpenTherm Gateway sensor.""" self.entity_id = async_generate_entity_id( @@ -171,11 +173,6 @@ class OpenThermSensor(SensorEntity): """Return the unit of measurement.""" return self._unit - @property - def should_poll(self): - """Return False because entity pushes its state.""" - return False - class DeprecatedOpenThermSensor(OpenThermSensor): """Represent a deprecated OpenTherm Gateway Sensor.""" diff --git a/homeassistant/components/otp/sensor.py b/homeassistant/components/otp/sensor.py index 726e9ed9e42..ff5a2965795 100644 --- a/homeassistant/components/otp/sensor.py +++ b/homeassistant/components/otp/sensor.py @@ -44,6 +44,8 @@ async def async_setup_platform( class TOTPSensor(SensorEntity): """Representation of a TOTP sensor.""" + _attr_should_poll = False + def __init__(self, name, token): """Initialize the sensor.""" self._name = name @@ -75,11 +77,6 @@ class TOTPSensor(SensorEntity): """Return the state of the sensor.""" return self._state - @property - def should_poll(self): - """No polling needed.""" - return False - @property def icon(self): """Return the icon to use in the frontend.""" diff --git a/homeassistant/components/person/__init__.py b/homeassistant/components/person/__init__.py index 85a6cf6135e..2eb80ed69cc 100644 --- a/homeassistant/components/person/__init__.py +++ b/homeassistant/components/person/__init__.py @@ -356,6 +356,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: class Person(RestoreEntity): """Represent a tracked person.""" + _attr_should_poll = False + def __init__(self, config): """Set up person.""" self._config = config @@ -384,14 +386,6 @@ class Person(RestoreEntity): """Return entity picture.""" return self._config.get(CONF_PICTURE) - @property - def should_poll(self): - """Return True if entity has to be polled for state. - - False if entity pushes its state to HA. - """ - return False - @property def state(self): """Return the state of the person.""" diff --git a/homeassistant/components/pilight/base_class.py b/homeassistant/components/pilight/base_class.py index 517beab850f..cb96d89e6a2 100644 --- a/homeassistant/components/pilight/base_class.py +++ b/homeassistant/components/pilight/base_class.py @@ -56,6 +56,8 @@ SWITCHES_SCHEMA = vol.Schema( class PilightBaseDevice(RestoreEntity): """Base class for pilight switches and lights.""" + _attr_should_poll = False + def __init__(self, hass, name, config): """Initialize a device.""" self._hass = hass @@ -95,11 +97,6 @@ class PilightBaseDevice(RestoreEntity): """Get the name of the switch.""" return self._name - @property - def should_poll(self): - """No polling needed, state set when correct code is received.""" - return False - @property def assumed_state(self): """Return True if unable to access real state of the entity.""" diff --git a/homeassistant/components/pilight/sensor.py b/homeassistant/components/pilight/sensor.py index 131fd22a780..0f707489e9a 100644 --- a/homeassistant/components/pilight/sensor.py +++ b/homeassistant/components/pilight/sensor.py @@ -51,6 +51,8 @@ def setup_platform( class PilightSensor(SensorEntity): """Representation of a sensor that can be updated using Pilight.""" + _attr_should_poll = False + def __init__(self, hass, name, variable, payload, unit_of_measurement): """Initialize the sensor.""" self._state = None @@ -62,11 +64,6 @@ class PilightSensor(SensorEntity): hass.bus.listen(pilight.EVENT, self._handle_code) - @property - def should_poll(self): - """No polling needed.""" - return False - @property def name(self): """Return the name of the sensor.""" diff --git a/homeassistant/components/plaato/entity.py b/homeassistant/components/plaato/entity.py index 33ac5d910aa..8bdb7848bb1 100644 --- a/homeassistant/components/plaato/entity.py +++ b/homeassistant/components/plaato/entity.py @@ -19,6 +19,8 @@ from .const import ( class PlaatoEntity(entity.Entity): """Representation of a Plaato Entity.""" + _attr_should_poll = False + def __init__(self, data, sensor_type, coordinator=None): """Initialize the sensor.""" self._coordinator = coordinator @@ -83,11 +85,6 @@ class PlaatoEntity(entity.Entity): return self._coordinator.last_update_success return True - @property - def should_poll(self): - """Return the polling state.""" - return False - async def async_added_to_hass(self): """When entity is added to hass.""" if self._coordinator is not None: diff --git a/homeassistant/components/plant/__init__.py b/homeassistant/components/plant/__init__.py index 75d412f7f5f..0d95ccbc300 100644 --- a/homeassistant/components/plant/__init__.py +++ b/homeassistant/components/plant/__init__.py @@ -130,6 +130,8 @@ class Plant(Entity): configurable min and max values. """ + _attr_should_poll = False + READINGS = { READING_BATTERY: { ATTR_UNIT_OF_MEASUREMENT: PERCENTAGE, @@ -323,11 +325,6 @@ class Plant(Entity): _LOGGER.debug("Initializing from database completed") - @property - def should_poll(self): - """No polling needed.""" - return False - @property def name(self): """Return the name of the sensor.""" diff --git a/homeassistant/components/plum_lightpad/light.py b/homeassistant/components/plum_lightpad/light.py index 4b7f34f942f..f990efc3fcc 100644 --- a/homeassistant/components/plum_lightpad/light.py +++ b/homeassistant/components/plum_lightpad/light.py @@ -65,6 +65,8 @@ async def async_setup_entry( class PlumLight(LightEntity): """Representation of a Plum Lightpad dimmer.""" + _attr_should_poll = False + def __init__(self, load): """Initialize the light.""" self._load = load @@ -79,11 +81,6 @@ class PlumLight(LightEntity): self._brightness = event["level"] self.schedule_update_ha_state() - @property - def should_poll(self): - """No polling needed.""" - return False - @property def unique_id(self): """Combine logical load ID with .light to guarantee it is unique.""" @@ -142,6 +139,7 @@ class GlowRing(LightEntity): """Representation of a Plum Lightpad dimmer glow ring.""" _attr_color_mode = ColorMode.HS + _attr_should_poll = False _attr_supported_color_modes = {ColorMode.HS} def __init__(self, lightpad): @@ -178,11 +176,6 @@ class GlowRing(LightEntity): """Return the hue and saturation color value [float, float].""" return color_util.color_RGB_to_hs(self._red, self._green, self._blue) - @property - def should_poll(self): - """No polling needed.""" - return False - @property def unique_id(self): """Combine LightPad ID with .glow to guarantee it is unique.""" diff --git a/homeassistant/components/point/__init__.py b/homeassistant/components/point/__init__.py index 99108323187..d4b83772300 100644 --- a/homeassistant/components/point/__init__.py +++ b/homeassistant/components/point/__init__.py @@ -256,6 +256,8 @@ class MinutPointClient: class MinutPointEntity(Entity): """Base Entity used by the sensors.""" + _attr_should_poll = False + def __init__(self, point_client, device_id, device_class): """Initialize the entity.""" self._async_unsub_dispatcher_connect = None @@ -347,11 +349,6 @@ class MinutPointEntity(Entity): last_update = parse_datetime(self.device.last_update) return last_update - @property - def should_poll(self): - """No polling needed for point.""" - return False - @property def unique_id(self): """Return the unique id of the sensor.""" diff --git a/homeassistant/components/qwikswitch/__init__.py b/homeassistant/components/qwikswitch/__init__.py index 2df4a2ab73e..d11b71a6dd4 100644 --- a/homeassistant/components/qwikswitch/__init__.py +++ b/homeassistant/components/qwikswitch/__init__.py @@ -72,6 +72,8 @@ CONFIG_SCHEMA = vol.Schema( class QSEntity(Entity): """Qwikswitch Entity base.""" + _attr_should_poll = False + def __init__(self, qsid, name): """Initialize the QSEntity.""" self._name = name @@ -82,11 +84,6 @@ class QSEntity(Entity): """Return the name of the sensor.""" return self._name - @property - def should_poll(self): - """QS sensors gets packets in update_packet.""" - return False - @property def unique_id(self): """Return a unique identifier for this sensor.""" diff --git a/homeassistant/components/raspyrfm/switch.py b/homeassistant/components/raspyrfm/switch.py index 695a8415cc7..6d4e09a96c8 100644 --- a/homeassistant/components/raspyrfm/switch.py +++ b/homeassistant/components/raspyrfm/switch.py @@ -96,6 +96,8 @@ def setup_platform( class RaspyRFMSwitch(SwitchEntity): """Representation of a RaspyRFM switch.""" + _attr_should_poll = False + def __init__(self, raspyrfm_client, name: str, gateway, controlunit): """Initialize the switch.""" self._raspyrfm_client = raspyrfm_client @@ -111,11 +113,6 @@ class RaspyRFMSwitch(SwitchEntity): """Return the name of the device if any.""" return self._name - @property - def should_poll(self): - """Return True if polling should be used.""" - return False - @property def assumed_state(self): """Return True when the current state can not be queried.""" diff --git a/homeassistant/components/remote_rpi_gpio/binary_sensor.py b/homeassistant/components/remote_rpi_gpio/binary_sensor.py index 78272384748..9af1a83b2e9 100644 --- a/homeassistant/components/remote_rpi_gpio/binary_sensor.py +++ b/homeassistant/components/remote_rpi_gpio/binary_sensor.py @@ -66,6 +66,8 @@ def setup_platform( class RemoteRPiGPIOBinarySensor(BinarySensorEntity): """Represent a binary sensor that uses a Remote Raspberry Pi GPIO.""" + _attr_should_poll = False + def __init__(self, name, sensor, invert_logic): """Initialize the RPi binary sensor.""" self._name = name @@ -84,11 +86,6 @@ class RemoteRPiGPIOBinarySensor(BinarySensorEntity): self._sensor.when_deactivated = read_gpio self._sensor.when_activated = read_gpio - @property - def should_poll(self): - """No polling needed.""" - return False - @property def name(self): """Return the name of the sensor.""" diff --git a/homeassistant/components/remote_rpi_gpio/switch.py b/homeassistant/components/remote_rpi_gpio/switch.py index 5479b035556..9e7aca37663 100644 --- a/homeassistant/components/remote_rpi_gpio/switch.py +++ b/homeassistant/components/remote_rpi_gpio/switch.py @@ -52,6 +52,8 @@ def setup_platform( class RemoteRPiGPIOSwitch(SwitchEntity): """Representation of a Remote Raspberry Pi GPIO.""" + _attr_should_poll = False + def __init__(self, name, led): """Initialize the pin.""" self._name = name or DEVICE_DEFAULT_NAME @@ -63,11 +65,6 @@ class RemoteRPiGPIOSwitch(SwitchEntity): """Return the name of the switch.""" return self._name - @property - def should_poll(self): - """No polling needed.""" - return False - @property def assumed_state(self): """If unable to access real state of the entity.""" diff --git a/homeassistant/components/roomba/irobot_base.py b/homeassistant/components/roomba/irobot_base.py index dd076f6fb63..f443f72279f 100644 --- a/homeassistant/components/roomba/irobot_base.py +++ b/homeassistant/components/roomba/irobot_base.py @@ -60,6 +60,8 @@ STATE_MAP = { class IRobotEntity(Entity): """Base class for iRobot Entities.""" + _attr_should_poll = False + def __init__(self, roomba, blid): """Initialize the iRobot handler.""" self.vacuum = roomba @@ -69,11 +71,6 @@ class IRobotEntity(Entity): self._version = self.vacuum_state.get("softwareVer") self._sku = self.vacuum_state.get("sku") - @property - def should_poll(self): - """Disable polling.""" - return False - @property def robot_unique_id(self): """Return the uniqueid of the vacuum cleaner.""" diff --git a/homeassistant/components/roon/media_player.py b/homeassistant/components/roon/media_player.py index 3651bd9ec05..673316f64a3 100644 --- a/homeassistant/components/roon/media_player.py +++ b/homeassistant/components/roon/media_player.py @@ -76,6 +76,7 @@ async def async_setup_entry( class RoonDevice(MediaPlayerEntity): """Representation of an Roon device.""" + _attr_should_poll = False _attr_supported_features = ( MediaPlayerEntityFeature.BROWSE_MEDIA | MediaPlayerEntityFeature.GROUPING @@ -295,11 +296,6 @@ class RoonDevice(MediaPlayerEntity): """Return the id of this roon client.""" return self._unique_id - @property - def should_poll(self): - """Return True if entity has to be polled for state.""" - return False - @property def zone_id(self): """Return current session Id.""" diff --git a/homeassistant/components/russound_rio/media_player.py b/homeassistant/components/russound_rio/media_player.py index 054448cd9ad..e905ab0c726 100644 --- a/homeassistant/components/russound_rio/media_player.py +++ b/homeassistant/components/russound_rio/media_player.py @@ -70,6 +70,7 @@ async def async_setup_platform( class RussoundZoneDevice(MediaPlayerEntity): """Representation of a Russound Zone.""" + _attr_should_poll = False _attr_supported_features = ( MediaPlayerEntityFeature.VOLUME_MUTE | MediaPlayerEntityFeature.VOLUME_SET @@ -119,11 +120,6 @@ class RussoundZoneDevice(MediaPlayerEntity): self._russ.add_zone_callback(self._zone_callback_handler) self._russ.add_source_callback(self._source_callback_handler) - @property - def should_poll(self): - """No polling needed.""" - return False - @property def name(self): """Return the name of the zone."""