diff --git a/homeassistant/components/saj/sensor.py b/homeassistant/components/saj/sensor.py index 818ce7ea57a..eec6755e015 100644 --- a/homeassistant/components/saj/sensor.py +++ b/homeassistant/components/saj/sensor.py @@ -176,6 +176,8 @@ def async_track_time_interval_backoff(hass, action) -> CALLBACK_TYPE: class SAJsensor(SensorEntity): """Representation of a SAJ sensor.""" + _attr_should_poll = False + def __init__(self, serialnumber, pysaj_sensor, inverter_name=None): """Initialize the SAJ sensor.""" self._sensor = pysaj_sensor @@ -216,11 +218,6 @@ class SAJsensor(SensorEntity): if self.native_unit_of_measurement in (TEMP_CELSIUS, TEMP_FAHRENHEIT): return SensorDeviceClass.TEMPERATURE - @property - def should_poll(self) -> bool: - """SAJ sensors are updated & don't poll.""" - return False - @property def per_day_basis(self) -> bool: """Return if the sensors value is on daily basis or not.""" diff --git a/homeassistant/components/satel_integra/binary_sensor.py b/homeassistant/components/satel_integra/binary_sensor.py index 2206b88a7cd..f55545239fb 100644 --- a/homeassistant/components/satel_integra/binary_sensor.py +++ b/homeassistant/components/satel_integra/binary_sensor.py @@ -60,6 +60,8 @@ async def async_setup_platform( class SatelIntegraBinarySensor(BinarySensorEntity): """Representation of an Satel Integra binary sensor.""" + _attr_should_poll = False + def __init__( self, controller, device_number, device_name, zone_type, react_to_signal ): @@ -100,11 +102,6 @@ class SatelIntegraBinarySensor(BinarySensorEntity): if self._zone_type is BinarySensorDeviceClass.SMOKE: return "mdi:fire" - @property - def should_poll(self): - """No polling needed.""" - return False - @property def is_on(self): """Return true if sensor is on.""" diff --git a/homeassistant/components/satel_integra/switch.py b/homeassistant/components/satel_integra/switch.py index f465ef1c62c..7c7b91c4ac6 100644 --- a/homeassistant/components/satel_integra/switch.py +++ b/homeassistant/components/satel_integra/switch.py @@ -51,6 +51,8 @@ async def async_setup_platform( class SatelIntegraSwitch(SwitchEntity): """Representation of an Satel switch.""" + _attr_should_poll = False + def __init__(self, controller, device_number, device_name, code): """Initialize the binary_sensor.""" self._device_number = device_number @@ -104,8 +106,3 @@ class SatelIntegraSwitch(SwitchEntity): def name(self): """Return the name of the switch.""" return self._name - - @property - def should_poll(self): - """Don't poll.""" - return False diff --git a/homeassistant/components/scsgate/cover.py b/homeassistant/components/scsgate/cover.py index 4aa08cae3bd..f68b089e2d7 100644 --- a/homeassistant/components/scsgate/cover.py +++ b/homeassistant/components/scsgate/cover.py @@ -59,6 +59,8 @@ def setup_platform( class SCSGateCover(CoverEntity): """Representation of SCSGate cover.""" + _attr_should_poll = False + def __init__(self, scs_id, name, logger, scsgate): """Initialize the cover.""" self._scs_id = scs_id @@ -71,11 +73,6 @@ class SCSGateCover(CoverEntity): """Return the SCSGate ID.""" return self._scs_id - @property - def should_poll(self) -> bool: - """No polling needed.""" - return False - @property def name(self) -> str: """Return the name of the cover.""" diff --git a/homeassistant/components/scsgate/switch.py b/homeassistant/components/scsgate/switch.py index 0520f352186..b9c25207745 100644 --- a/homeassistant/components/scsgate/switch.py +++ b/homeassistant/components/scsgate/switch.py @@ -91,6 +91,8 @@ def _setup_scenario_switches(logger, config, scsgate, hass): class SCSGateSwitch(SwitchEntity): """Representation of a SCSGate switch.""" + _attr_should_poll = False + def __init__(self, scs_id, name, logger, scsgate): """Initialize the switch.""" self._name = name @@ -104,11 +106,6 @@ class SCSGateSwitch(SwitchEntity): """Return the SCS ID.""" return self._scs_id - @property - def should_poll(self): - """No polling needed.""" - return False - @property def name(self): """Return the name of the device if any.""" diff --git a/homeassistant/components/sense/binary_sensor.py b/homeassistant/components/sense/binary_sensor.py index 10399fa8e2b..b9c1a3cb9eb 100644 --- a/homeassistant/components/sense/binary_sensor.py +++ b/homeassistant/components/sense/binary_sensor.py @@ -73,6 +73,8 @@ def sense_to_mdi(sense_icon): class SenseDevice(BinarySensorEntity): """Implementation of a Sense energy device binary sensor.""" + _attr_should_poll = False + def __init__(self, sense_devices_data, device, sense_monitor_id): """Initialize the Sense binary sensor.""" self._name = device["name"] @@ -124,11 +126,6 @@ class SenseDevice(BinarySensorEntity): """Return the device class of the binary sensor.""" return BinarySensorDeviceClass.POWER - @property - def should_poll(self): - """Return the deviceshould not poll for updates.""" - return False - async def async_added_to_hass(self): """Register callbacks.""" self.async_on_remove( diff --git a/homeassistant/components/serial/sensor.py b/homeassistant/components/serial/sensor.py index 7e5f0bf0fd5..9f1e04f1373 100644 --- a/homeassistant/components/serial/sensor.py +++ b/homeassistant/components/serial/sensor.py @@ -113,6 +113,8 @@ async def async_setup_platform( class SerialSensor(SensorEntity): """Representation of a Serial sensor.""" + _attr_should_poll = False + def __init__( self, name, @@ -242,11 +244,6 @@ class SerialSensor(SensorEntity): """Return the name of the sensor.""" return self._name - @property - def should_poll(self): - """No polling needed.""" - return False - @property def extra_state_attributes(self): """Return the attributes of the entity (if any JSON present).""" diff --git a/homeassistant/components/sighthound/image_processing.py b/homeassistant/components/sighthound/image_processing.py index 605c6c63344..69776f4e2ac 100644 --- a/homeassistant/components/sighthound/image_processing.py +++ b/homeassistant/components/sighthound/image_processing.py @@ -86,6 +86,7 @@ def setup_platform( class SighthoundEntity(ImageProcessingEntity): """Create a sighthound entity.""" + _attr_should_poll = False _attr_unit_of_measurement = ATTR_PEOPLE def __init__( @@ -167,11 +168,6 @@ class SighthoundEntity(ImageProcessingEntity): """Return the name of the sensor.""" return self._name - @property - def should_poll(self): - """Return the polling state.""" - return False - @property def state(self): """Return the state of the entity.""" diff --git a/homeassistant/components/smartthings/__init__.py b/homeassistant/components/smartthings/__init__.py index c45702773b2..f5b462e9642 100644 --- a/homeassistant/components/smartthings/__init__.py +++ b/homeassistant/components/smartthings/__init__.py @@ -405,6 +405,8 @@ class DeviceBroker: class SmartThingsEntity(Entity): """Defines a SmartThings entity.""" + _attr_should_poll = False + def __init__(self, device: DeviceEntity) -> None: """Initialize the instance.""" self._device = device @@ -443,11 +445,6 @@ class SmartThingsEntity(Entity): """Return the name of the device.""" return self._device.label - @property - def should_poll(self) -> bool: - """No polling needed for this device.""" - return False - @property def unique_id(self) -> str: """Return a unique ID.""" diff --git a/homeassistant/components/snapcast/media_player.py b/homeassistant/components/snapcast/media_player.py index ad71266d65c..703cb41a38f 100644 --- a/homeassistant/components/snapcast/media_player.py +++ b/homeassistant/components/snapcast/media_player.py @@ -116,6 +116,7 @@ async def handle_set_latency(entity, service_call): class SnapcastGroupDevice(MediaPlayerEntity): """Representation of a Snapcast group device.""" + _attr_should_poll = False _attr_supported_features = ( MediaPlayerEntityFeature.VOLUME_MUTE | MediaPlayerEntityFeature.VOLUME_SET @@ -173,11 +174,6 @@ class SnapcastGroupDevice(MediaPlayerEntity): name = f"{self._group.friendly_name} {GROUP_SUFFIX}" return {"friendly_name": name} - @property - def should_poll(self): - """Do not poll for state.""" - return False - async def async_select_source(self, source): """Set input source.""" streams = self._group.streams_by_name() @@ -208,6 +204,7 @@ class SnapcastGroupDevice(MediaPlayerEntity): class SnapcastClientDevice(MediaPlayerEntity): """Representation of a Snapcast client device.""" + _attr_should_poll = False _attr_supported_features = ( MediaPlayerEntityFeature.VOLUME_MUTE | MediaPlayerEntityFeature.VOLUME_SET @@ -276,11 +273,6 @@ class SnapcastClientDevice(MediaPlayerEntity): state_attrs["friendly_name"] = name return state_attrs - @property - def should_poll(self): - """Do not poll for state.""" - return False - @property def latency(self): """Latency for Client.""" diff --git a/homeassistant/components/songpal/media_player.py b/homeassistant/components/songpal/media_player.py index fed1762bb44..973c57adbbb 100644 --- a/homeassistant/components/songpal/media_player.py +++ b/homeassistant/components/songpal/media_player.py @@ -89,6 +89,7 @@ async def async_setup_entry( class SongpalEntity(MediaPlayerEntity): """Class representing a Songpal device.""" + _attr_should_poll = False _attr_supported_features = ( MediaPlayerEntityFeature.VOLUME_SET | MediaPlayerEntityFeature.VOLUME_STEP @@ -118,11 +119,6 @@ class SongpalEntity(MediaPlayerEntity): self._active_source = None self._sources = {} - @property - def should_poll(self): - """Return True if the device should be polled.""" - return False - async def async_added_to_hass(self): """Run when entity is added to hass.""" await self.async_activate_websocket() diff --git a/homeassistant/components/srp_energy/sensor.py b/homeassistant/components/srp_energy/sensor.py index 683616a5e56..f1a97af9820 100644 --- a/homeassistant/components/srp_energy/sensor.py +++ b/homeassistant/components/srp_energy/sensor.py @@ -83,6 +83,8 @@ async def async_setup_entry( class SrpEntity(SensorEntity): """Implementation of a Srp Energy Usage sensor.""" + _attr_should_poll = False + def __init__(self, coordinator): """Initialize the SrpEntity class.""" self._name = SENSOR_NAME @@ -125,11 +127,6 @@ class SrpEntity(SensorEntity): return f"{self.coordinator.data:.2f}" return None - @property - def should_poll(self): - """No need to poll. Coordinator notifies entity of updates.""" - return False - @property def extra_state_attributes(self): """Return the state attributes.""" diff --git a/homeassistant/components/starline/entity.py b/homeassistant/components/starline/entity.py index 727960e5f46..20e5eaed07e 100644 --- a/homeassistant/components/starline/entity.py +++ b/homeassistant/components/starline/entity.py @@ -11,6 +11,8 @@ from .account import StarlineAccount, StarlineDevice class StarlineEntity(Entity): """StarLine base entity class.""" + _attr_should_poll = False + def __init__( self, account: StarlineAccount, device: StarlineDevice, key: str, name: str ) -> None: @@ -21,11 +23,6 @@ class StarlineEntity(Entity): self._name = name self._unsubscribe_api: Callable | None = None - @property - def should_poll(self): - """No polling needed.""" - return False - @property def available(self): """Return True if entity is available.""" diff --git a/homeassistant/components/syncthing/sensor.py b/homeassistant/components/syncthing/sensor.py index fea01eb22af..f6e090075a9 100644 --- a/homeassistant/components/syncthing/sensor.py +++ b/homeassistant/components/syncthing/sensor.py @@ -57,6 +57,8 @@ async def async_setup_entry( class FolderSensor(SensorEntity): """A Syncthing folder sensor.""" + _attr_should_poll = False + STATE_ATTRIBUTES = { "errors": "errors", "globalBytes": "global_bytes", @@ -131,11 +133,6 @@ class FolderSensor(SensorEntity): """Return the state attributes.""" return self._state - @property - def should_poll(self): - """Return the polling requirement for this sensor.""" - return False - @property def device_info(self) -> DeviceInfo: """Return device information.""" diff --git a/homeassistant/components/tado/entity.py b/homeassistant/components/tado/entity.py index e208335033d..40e06313fa8 100644 --- a/homeassistant/components/tado/entity.py +++ b/homeassistant/components/tado/entity.py @@ -7,6 +7,8 @@ from .const import DEFAULT_NAME, DOMAIN, TADO_HOME, TADO_ZONE class TadoDeviceEntity(Entity): """Base implementation for Tado device.""" + _attr_should_poll = False + def __init__(self, device_info): """Initialize a Tado device.""" super().__init__() @@ -27,11 +29,6 @@ class TadoDeviceEntity(Entity): via_device=(DOMAIN, self._device_info["serialNo"]), ) - @property - def should_poll(self): - """Do not poll.""" - return False - class TadoHomeEntity(Entity): """Base implementation for Tado home.""" @@ -57,6 +54,8 @@ class TadoHomeEntity(Entity): class TadoZoneEntity(Entity): """Base implementation for Tado zone.""" + _attr_should_poll = False + def __init__(self, zone_name, home_id, zone_id): """Initialize a Tado zone.""" super().__init__() @@ -75,8 +74,3 @@ class TadoZoneEntity(Entity): model=TADO_ZONE, suggested_area=self.zone_name, ) - - @property - def should_poll(self): - """Do not poll.""" - return False diff --git a/homeassistant/components/tellduslive/entry.py b/homeassistant/components/tellduslive/entry.py index 9e0bf7e9693..db32d41cede 100644 --- a/homeassistant/components/tellduslive/entry.py +++ b/homeassistant/components/tellduslive/entry.py @@ -25,6 +25,8 @@ ATTR_LAST_UPDATED = "time_last_updated" class TelldusLiveEntity(Entity): """Base class for all Telldus Live entities.""" + _attr_should_poll = False + def __init__(self, client, device_id): """Initialize the entity.""" self._id = device_id @@ -66,11 +68,6 @@ class TelldusLiveEntity(Entity): """Return the state of the device.""" return self.device.state - @property - def should_poll(self): - """Return the polling state.""" - return False - @property def assumed_state(self): """Return true if unable to access real state of entity.""" diff --git a/homeassistant/components/threshold/binary_sensor.py b/homeassistant/components/threshold/binary_sensor.py index 802aa22d759..8cec85bf20d 100644 --- a/homeassistant/components/threshold/binary_sensor.py +++ b/homeassistant/components/threshold/binary_sensor.py @@ -112,6 +112,8 @@ async def async_setup_platform( class ThresholdSensor(BinarySensorEntity): """Representation of a Threshold sensor.""" + _attr_should_poll = False + def __init__( self, hass, entity_id, name, lower, upper, hysteresis, device_class, unique_id ): @@ -168,11 +170,6 @@ class ThresholdSensor(BinarySensorEntity): """Return true if sensor is on.""" return self._state - @property - def should_poll(self): - """No polling needed.""" - return False - @property def device_class(self): """Return the sensor class of the sensor.""" diff --git a/homeassistant/components/tod/binary_sensor.py b/homeassistant/components/tod/binary_sensor.py index 1100892b876..d287431d712 100644 --- a/homeassistant/components/tod/binary_sensor.py +++ b/homeassistant/components/tod/binary_sensor.py @@ -98,6 +98,8 @@ def _is_sun_event(sun_event): class TodSensor(BinarySensorEntity): """Time of the Day Sensor.""" + _attr_should_poll = False + def __init__(self, name, after, after_offset, before, before_offset, unique_id): """Init the ToD Sensor...""" self._attr_unique_id = unique_id @@ -109,11 +111,6 @@ class TodSensor(BinarySensorEntity): self._after = after self._unsub_update: Callable[[], None] = None - @property - def should_poll(self): - """Sensor does not need to be polled.""" - return False - @property def name(self): """Return the name of the sensor.""" diff --git a/homeassistant/components/touchline/climate.py b/homeassistant/components/touchline/climate.py index 584f23b1ded..8c5eca09d3d 100644 --- a/homeassistant/components/touchline/climate.py +++ b/homeassistant/components/touchline/climate.py @@ -84,11 +84,6 @@ class Touchline(ClimateEntity): (self.unit.get_operation_mode(), self.unit.get_week_program()) ) - @property - def should_poll(self): - """Return the polling state.""" - return True - @property def name(self): """Return the name of the climate device.""" diff --git a/homeassistant/components/transmission/sensor.py b/homeassistant/components/transmission/sensor.py index 0c6899e6b3e..c3f160cb040 100644 --- a/homeassistant/components/transmission/sensor.py +++ b/homeassistant/components/transmission/sensor.py @@ -49,6 +49,8 @@ async def async_setup_entry( class TransmissionSensor(SensorEntity): """A base class for all Transmission sensors.""" + _attr_should_poll = False + def __init__(self, tm_client, client_name, sensor_name, sub_type=None): """Initialize the sensor.""" self._tm_client: TransmissionClient = tm_client @@ -72,11 +74,6 @@ class TransmissionSensor(SensorEntity): """Return the state of the sensor.""" return self._state - @property - def should_poll(self): - """Return the polling requirement for this sensor.""" - return False - @property def available(self): """Could the device be accessed during the last update call.""" diff --git a/homeassistant/components/transmission/switch.py b/homeassistant/components/transmission/switch.py index a646286e34f..63477eecf48 100644 --- a/homeassistant/components/transmission/switch.py +++ b/homeassistant/components/transmission/switch.py @@ -33,6 +33,8 @@ async def async_setup_entry( class TransmissionSwitch(SwitchEntity): """Representation of a Transmission switch.""" + _attr_should_poll = False + def __init__(self, switch_type, switch_name, tm_client, name): """Initialize the Transmission switch.""" self._name = switch_name @@ -53,11 +55,6 @@ class TransmissionSwitch(SwitchEntity): """Return the unique id of the entity.""" return f"{self._tm_client.api.host}-{self.name}" - @property - def should_poll(self): - """Poll for status regularly.""" - return False - @property def is_on(self): """Return true if device is on.""" diff --git a/homeassistant/components/trend/binary_sensor.py b/homeassistant/components/trend/binary_sensor.py index 87aadc78415..e3bd4816f44 100644 --- a/homeassistant/components/trend/binary_sensor.py +++ b/homeassistant/components/trend/binary_sensor.py @@ -112,6 +112,8 @@ def setup_platform( class SensorTrend(BinarySensorEntity): """Representation of a trend Sensor.""" + _attr_should_poll = False + def __init__( self, hass, @@ -167,11 +169,6 @@ class SensorTrend(BinarySensorEntity): ATTR_SAMPLE_DURATION: self._sample_duration, } - @property - def should_poll(self): - """No polling needed.""" - return False - async def async_added_to_hass(self): """Complete device setup after being added to hass."""