diff --git a/homeassistant/components/kaiterra/air_quality.py b/homeassistant/components/kaiterra/air_quality.py index 4d3e8bf70f3..edbddb361c9 100644 --- a/homeassistant/components/kaiterra/air_quality.py +++ b/homeassistant/components/kaiterra/air_quality.py @@ -37,6 +37,8 @@ async def async_setup_platform( class KaiterraAirQuality(AirQualityEntity): """Implementation of a Kaittera air quality sensor.""" + _attr_should_poll = False + def __init__(self, api, name, device_id): """Initialize the sensor.""" self._api = api @@ -50,11 +52,6 @@ class KaiterraAirQuality(AirQualityEntity): def _device(self): return self._api.data.get(self._device_id, {}) - @property - def should_poll(self): - """Return that the sensor should not be polled.""" - return False - @property def available(self): """Return the availability of the sensor.""" diff --git a/homeassistant/components/keenetic_ndms2/device_tracker.py b/homeassistant/components/keenetic_ndms2/device_tracker.py index 397d1888a9e..116f82afe3a 100644 --- a/homeassistant/components/keenetic_ndms2/device_tracker.py +++ b/homeassistant/components/keenetic_ndms2/device_tracker.py @@ -86,6 +86,8 @@ def update_items(router: KeeneticRouter, async_add_entities, tracked: set[str]): class KeeneticTracker(ScannerEntity): """Representation of network device.""" + _attr_should_poll = False + def __init__(self, device: Device, router: KeeneticRouter) -> None: """Initialize the tracked device.""" self._device = device @@ -94,11 +96,6 @@ class KeeneticTracker(ScannerEntity): dt_util.utcnow() if device.mac in router.last_devices else None ) - @property - def should_poll(self) -> bool: - """Return False since entity pushes its state to HA.""" - return False - @property def is_connected(self): """Return true if the device is connected to the network.""" diff --git a/homeassistant/components/kira/sensor.py b/homeassistant/components/kira/sensor.py index f5824d806f9..d4488781849 100644 --- a/homeassistant/components/kira/sensor.py +++ b/homeassistant/components/kira/sensor.py @@ -34,6 +34,8 @@ def setup_platform( class KiraReceiver(SensorEntity): """Implementation of a Kira Receiver.""" + _attr_should_poll = False + def __init__(self, name, kira): """Initialize the sensor.""" self._name = name @@ -69,11 +71,6 @@ class KiraReceiver(SensorEntity): """Return the state attributes of the device.""" return {CONF_DEVICE: self._device} - @property - def should_poll(self) -> bool: - """Entity should not be polled.""" - return False - @property def force_update(self) -> bool: """Kira should force updates. Repeated states have meaning.""" diff --git a/homeassistant/components/konnected/binary_sensor.py b/homeassistant/components/konnected/binary_sensor.py index 307c8bc24a7..e1823c1c7d9 100644 --- a/homeassistant/components/konnected/binary_sensor.py +++ b/homeassistant/components/konnected/binary_sensor.py @@ -37,6 +37,8 @@ async def async_setup_entry( class KonnectedBinarySensor(BinarySensorEntity): """Representation of a Konnected binary sensor.""" + _attr_should_poll = False + def __init__(self, device_id, zone_num, data): """Initialize the Konnected binary sensor.""" self._data = data @@ -62,11 +64,6 @@ class KonnectedBinarySensor(BinarySensorEntity): """Return the state of the sensor.""" return self._state - @property - def should_poll(self): - """No polling needed.""" - return False - @property def device_class(self): """Return the device class.""" diff --git a/homeassistant/components/lcn/__init__.py b/homeassistant/components/lcn/__init__.py index 8df579fddd7..d4a20c4d849 100644 --- a/homeassistant/components/lcn/__init__.py +++ b/homeassistant/components/lcn/__init__.py @@ -237,6 +237,8 @@ def _async_fire_send_keys_event( class LcnEntity(Entity): """Parent class for all entities associated with the LCN component.""" + _attr_should_poll = False + def __init__( self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType ) -> None: @@ -280,11 +282,6 @@ class LcnEntity(Entity): ), } - @property - def should_poll(self) -> bool: - """Lcn device entity pushes its state to HA.""" - return False - async def async_added_to_hass(self) -> None: """Run when entity about to be added to hass.""" if not self.device_connection.is_group: diff --git a/homeassistant/components/litejet/switch.py b/homeassistant/components/litejet/switch.py index 0204c05335a..66b68a345f2 100644 --- a/homeassistant/components/litejet/switch.py +++ b/homeassistant/components/litejet/switch.py @@ -35,6 +35,8 @@ async def async_setup_entry( class LiteJetSwitch(SwitchEntity): """Representation of a single LiteJet switch.""" + _attr_should_poll = False + def __init__(self, entry_id, lj, i, name): # pylint: disable=invalid-name """Initialize a LiteJet switch.""" self._entry_id = entry_id @@ -78,11 +80,6 @@ class LiteJetSwitch(SwitchEntity): """Return if the switch is pressed.""" return self._state - @property - def should_poll(self): - """Return that polling is not necessary.""" - return False - @property def extra_state_attributes(self): """Return the device-specific state attributes.""" diff --git a/homeassistant/components/lutron/__init__.py b/homeassistant/components/lutron/__init__.py index 1583d8b74eb..75561dd275b 100644 --- a/homeassistant/components/lutron/__init__.py +++ b/homeassistant/components/lutron/__init__.py @@ -116,6 +116,8 @@ def setup(hass: HomeAssistant, base_config: ConfigType) -> bool: class LutronDevice(Entity): """Representation of a Lutron device entity.""" + _attr_should_poll = False + def __init__(self, area_name, lutron_device, controller): """Initialize the device.""" self._lutron_device = lutron_device @@ -135,11 +137,6 @@ class LutronDevice(Entity): """Return the name of the device.""" return f"{self._area_name} {self._lutron_device.name}" - @property - def should_poll(self): - """No polling needed.""" - return False - @property def unique_id(self): """Return a unique ID.""" diff --git a/homeassistant/components/lw12wifi/light.py b/homeassistant/components/lw12wifi/light.py index de23436a560..7814475b41f 100644 --- a/homeassistant/components/lw12wifi/light.py +++ b/homeassistant/components/lw12wifi/light.py @@ -59,6 +59,7 @@ class LW12WiFi(LightEntity): """LW-12 WiFi LED Controller.""" _attr_color_mode = ColorMode.HS + _attr_should_poll = False _attr_supported_color_modes = {ColorMode.HS} _attr_supported_features = LightEntityFeature.EFFECT | LightEntityFeature.TRANSITION @@ -115,11 +116,6 @@ class LW12WiFi(LightEntity): """Return True if unable to access real state of the entity.""" return True - @property - def should_poll(self) -> bool: - """Return False to not poll the state of this entity.""" - return False - def turn_on(self, **kwargs): """Instruct the light to turn on.""" self._light.light_on() diff --git a/homeassistant/components/mediaroom/media_player.py b/homeassistant/components/mediaroom/media_player.py index 31c8d634912..b3a800c489e 100644 --- a/homeassistant/components/mediaroom/media_player.py +++ b/homeassistant/components/mediaroom/media_player.py @@ -117,6 +117,7 @@ async def async_setup_platform( class MediaroomDevice(MediaPlayerEntity): """Representation of a Mediaroom set-up-box on the network.""" + _attr_should_poll = False _attr_supported_features = ( MediaPlayerEntityFeature.PAUSE | MediaPlayerEntityFeature.TURN_ON @@ -163,11 +164,6 @@ class MediaroomDevice(MediaPlayerEntity): else: self._unique_id = 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/microsoft_face/__init__.py b/homeassistant/components/microsoft_face/__init__.py index 6b8fcde63f1..82a9accac59 100644 --- a/homeassistant/components/microsoft_face/__init__.py +++ b/homeassistant/components/microsoft_face/__init__.py @@ -207,6 +207,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: class MicrosoftFaceGroupEntity(Entity): """Person-Group state/data Entity.""" + _attr_should_poll = False + def __init__(self, hass, api, g_id, name): """Initialize person/group entity.""" self.hass = hass @@ -229,11 +231,6 @@ class MicrosoftFaceGroupEntity(Entity): """Return the state of the entity.""" return len(self._api.store[self._id]) - @property - def should_poll(self): - """Return True if entity has to be polled for state.""" - return False - @property def extra_state_attributes(self): """Return device specific state attributes.""" diff --git a/homeassistant/components/mold_indicator/sensor.py b/homeassistant/components/mold_indicator/sensor.py index bbd609f5fb8..db4f8d069ab 100644 --- a/homeassistant/components/mold_indicator/sensor.py +++ b/homeassistant/components/mold_indicator/sensor.py @@ -80,6 +80,8 @@ async def async_setup_platform( class MoldIndicator(SensorEntity): """Represents a MoldIndication sensor.""" + _attr_should_poll = False + def __init__( self, name, @@ -353,11 +355,6 @@ class MoldIndicator(SensorEntity): _LOGGER.debug("Mold indicator humidity: %s", self._state) - @property - def should_poll(self): - """Return the polling state.""" - return False - @property def name(self): """Return the name.""" diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index e4a24c0f5ad..faef154dd84 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -950,6 +950,7 @@ class MqttEntity( ): """Representation of an MQTT entity.""" + _attr_should_poll = False _entity_id_format: str def __init__(self, hass, config, config_entry, discovery_data): @@ -1076,11 +1077,6 @@ class MqttEntity( """Return the name of the device if any.""" return self._config.get(CONF_NAME) - @property - def should_poll(self): - """No polling needed.""" - return False - @property def unique_id(self): """Return a unique ID.""" diff --git a/homeassistant/components/mysensors/device.py b/homeassistant/components/mysensors/device.py index b1e562e878c..d9f95fa391f 100644 --- a/homeassistant/components/mysensors/device.py +++ b/homeassistant/components/mysensors/device.py @@ -217,10 +217,7 @@ def get_mysensors_devices( class MySensorsEntity(MySensorsDevice, Entity): """Representation of a MySensors entity.""" - @property - def should_poll(self) -> bool: - """Return the polling state. The gateway pushes its states.""" - return False + _attr_should_poll = False @property def available(self) -> bool: diff --git a/homeassistant/components/mystrom/binary_sensor.py b/homeassistant/components/mystrom/binary_sensor.py index e86c4745ad5..91a7814df2d 100644 --- a/homeassistant/components/mystrom/binary_sensor.py +++ b/homeassistant/components/mystrom/binary_sensor.py @@ -72,6 +72,8 @@ class MyStromView(HomeAssistantView): class MyStromBinarySensor(BinarySensorEntity): """Representation of a myStrom button.""" + _attr_should_poll = False + def __init__(self, button_id): """Initialize the myStrom Binary sensor.""" self._button_id = button_id @@ -82,11 +84,6 @@ class MyStromBinarySensor(BinarySensorEntity): """Return the name of the sensor.""" return self._button_id - @property - def should_poll(self): - """No polling needed.""" - return False - @property def is_on(self): """Return true if the binary sensor is on.""" diff --git a/homeassistant/components/ness_alarm/binary_sensor.py b/homeassistant/components/ness_alarm/binary_sensor.py index 5bf2a4ee3c2..4855ce28b72 100644 --- a/homeassistant/components/ness_alarm/binary_sensor.py +++ b/homeassistant/components/ness_alarm/binary_sensor.py @@ -46,6 +46,8 @@ async def async_setup_platform( class NessZoneBinarySensor(BinarySensorEntity): """Representation of an Ness alarm zone as a binary sensor.""" + _attr_should_poll = False + def __init__(self, zone_id, name, zone_type): """Initialize the binary_sensor.""" self._zone_id = zone_id @@ -66,11 +68,6 @@ class NessZoneBinarySensor(BinarySensorEntity): """Return the name of the entity.""" return self._name - @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/nest/climate_sdm.py b/homeassistant/components/nest/climate_sdm.py index c13370776ad..87cbf2331f4 100644 --- a/homeassistant/components/nest/climate_sdm.py +++ b/homeassistant/components/nest/climate_sdm.py @@ -98,6 +98,7 @@ class ThermostatEntity(ClimateEntity): _attr_min_temp = MIN_TEMP _attr_max_temp = MAX_TEMP _attr_has_entity_name = True + _attr_should_poll = False def __init__(self, device: Device) -> None: """Initialize ThermostatEntity.""" @@ -105,11 +106,6 @@ class ThermostatEntity(ClimateEntity): self._device_info = NestDeviceInfo(device) self._attr_supported_features = 0 - @property - def should_poll(self) -> bool: - """Disable polling since entities have state pushed via pubsub.""" - return False - @property def unique_id(self) -> str | None: """Return a unique ID.""" diff --git a/homeassistant/components/nest/legacy/__init__.py b/homeassistant/components/nest/legacy/__init__.py index 79579a1c3df..b244dea182e 100644 --- a/homeassistant/components/nest/legacy/__init__.py +++ b/homeassistant/components/nest/legacy/__init__.py @@ -348,6 +348,8 @@ class NestLegacyDevice: class NestSensorDevice(Entity): """Representation of a Nest sensor.""" + _attr_should_poll = False + def __init__(self, structure, device, variable): """Initialize the sensor.""" self.structure = structure @@ -370,11 +372,6 @@ class NestSensorDevice(Entity): """Return the name of the nest, if any.""" return self._name - @property - def should_poll(self): - """Do not need poll thanks using Nest streaming API.""" - return False - @property def unique_id(self): """Return unique id based on device serial and variable.""" diff --git a/homeassistant/components/nest/legacy/climate.py b/homeassistant/components/nest/legacy/climate.py index 07238a46ea9..3a735fe44c3 100644 --- a/homeassistant/components/nest/legacy/climate.py +++ b/homeassistant/components/nest/legacy/climate.py @@ -86,6 +86,8 @@ async def async_setup_legacy_entry(hass, entry, async_add_entities) -> None: class NestThermostat(ClimateEntity): """Representation of a Nest thermostat.""" + _attr_should_poll = False + def __init__(self, structure, device, temp_unit): """Initialize the thermostat.""" self._unit = temp_unit @@ -136,11 +138,6 @@ class NestThermostat(ClimateEntity): self._min_temperature = None self._max_temperature = None - @property - def should_poll(self): - """Do not need poll thanks using Nest streaming API.""" - return False - async def async_added_to_hass(self): """Register update signal handler.""" diff --git a/homeassistant/components/nmap_tracker/device_tracker.py b/homeassistant/components/nmap_tracker/device_tracker.py index afb931b82dd..9203288f03a 100644 --- a/homeassistant/components/nmap_tracker/device_tracker.py +++ b/homeassistant/components/nmap_tracker/device_tracker.py @@ -46,6 +46,8 @@ async def async_setup_entry( class NmapTrackerEntity(ScannerEntity): """An Nmap Tracker entity.""" + _attr_should_poll = False + def __init__( self, nmap_tracker: NmapDeviceScanner, mac_address: str, active: bool ) -> None: @@ -97,11 +99,6 @@ class NmapTrackerEntity(ScannerEntity): """Return tracker source type.""" return SourceType.ROUTER - @property - def should_poll(self) -> bool: - """No polling needed.""" - return False - @property def icon(self) -> str: """Return device icon.""" diff --git a/homeassistant/components/numato/binary_sensor.py b/homeassistant/components/numato/binary_sensor.py index 095ad811422..b3881cc0493 100644 --- a/homeassistant/components/numato/binary_sensor.py +++ b/homeassistant/components/numato/binary_sensor.py @@ -81,6 +81,8 @@ def setup_platform( class NumatoGpioBinarySensor(BinarySensorEntity): """Represents a binary sensor (input) port of a Numato GPIO expander.""" + _attr_should_poll = False + def __init__(self, name, device_id, port, invert_logic, api): """Initialize the Numato GPIO based binary sensor object.""" self._name = name or DEVICE_DEFAULT_NAME @@ -106,11 +108,6 @@ class NumatoGpioBinarySensor(BinarySensorEntity): self._state = level self.async_write_ha_state() - @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/numato/switch.py b/homeassistant/components/numato/switch.py index 312ad4c02a5..fb18866ae93 100644 --- a/homeassistant/components/numato/switch.py +++ b/homeassistant/components/numato/switch.py @@ -67,6 +67,8 @@ def setup_platform( class NumatoGpioSwitch(SwitchEntity): """Representation of a Numato USB GPIO switch port.""" + _attr_should_poll = False + def __init__(self, name, device_id, port, invert_logic, api): """Initialize the port.""" self._name = name or DEVICE_DEFAULT_NAME @@ -81,11 +83,6 @@ class NumatoGpioSwitch(SwitchEntity): """Return the name of the switch.""" return self._name - @property - def should_poll(self): - """No polling needed.""" - return False - @property def is_on(self): """Return true if port is turned on.""" diff --git a/homeassistant/components/nws/weather.py b/homeassistant/components/nws/weather.py index 5bb1bb0bf6c..60f93f20177 100644 --- a/homeassistant/components/nws/weather.py +++ b/homeassistant/components/nws/weather.py @@ -94,6 +94,8 @@ async def async_setup_entry( class NWSWeather(WeatherEntity): """Representation of a weather condition.""" + _attr_should_poll = False + def __init__(self, entry_data, hass_data, mode, units): """Initialise the platform with a data instance and station name.""" self.nws = hass_data[NWS_DATA] @@ -133,11 +135,6 @@ class NWSWeather(WeatherEntity): self.async_write_ha_state() - @property - def should_poll(self) -> bool: - """Entities do not individually poll.""" - return False - @property def attribution(self): """Return the attribution.""" diff --git a/homeassistant/components/nx584/binary_sensor.py b/homeassistant/components/nx584/binary_sensor.py index 6fdea44f836..853f5686831 100644 --- a/homeassistant/components/nx584/binary_sensor.py +++ b/homeassistant/components/nx584/binary_sensor.py @@ -87,6 +87,8 @@ def setup_platform( class NX584ZoneSensor(BinarySensorEntity): """Representation of a NX584 zone as a sensor.""" + _attr_should_poll = False + def __init__(self, zone, zone_type): """Initialize the nx594 binary sensor.""" self._zone = zone @@ -97,11 +99,6 @@ class NX584ZoneSensor(BinarySensorEntity): """Return the class of this sensor, from DEVICE_CLASSES.""" return self._zone_type - @property - def should_poll(self): - """No polling needed.""" - return False - @property def name(self): """Return the name of the binary sensor."""