diff --git a/homeassistant/components/unifi/unifi_entity_base.py b/homeassistant/components/unifi/unifi_entity_base.py index 466764714cf..11b5eac2d3c 100644 --- a/homeassistant/components/unifi/unifi_entity_base.py +++ b/homeassistant/components/unifi/unifi_entity_base.py @@ -19,6 +19,8 @@ _LOGGER = logging.getLogger(__name__) class UniFiBase(Entity): """UniFi entity base class.""" + _attr_should_poll = False + DOMAIN = "" TYPE = "" @@ -93,8 +95,3 @@ class UniFiBase(Entity): er.async_get(self.hass).async_remove(self.entity_id) else: await self.async_remove(force_remove=True) - - @property - def should_poll(self) -> bool: - """No polling needed.""" - return False diff --git a/homeassistant/components/universal/media_player.py b/homeassistant/components/universal/media_player.py index 352703f8f9b..099d786b901 100644 --- a/homeassistant/components/universal/media_player.py +++ b/homeassistant/components/universal/media_player.py @@ -152,6 +152,8 @@ async def async_setup_platform( class UniversalMediaPlayer(MediaPlayerEntity): """Representation of an universal media player.""" + _attr_should_poll = False + def __init__( self, hass, @@ -274,11 +276,6 @@ class UniversalMediaPlayer(MediaPlayerEntity): DOMAIN, service_name, service_data, blocking=True, context=self._context ) - @property - def should_poll(self): - """No polling needed.""" - return False - @property def device_class(self) -> str | None: """Return the class of this device.""" diff --git a/homeassistant/components/upb/__init__.py b/homeassistant/components/upb/__init__.py index 5e03df71750..0b3926f813f 100644 --- a/homeassistant/components/upb/__init__.py +++ b/homeassistant/components/upb/__init__.py @@ -68,6 +68,8 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> class UpbEntity(Entity): """Base class for all UPB entities.""" + _attr_should_poll = False + def __init__(self, element, unique_id, upb): """Initialize the base of all UPB devices.""" self._upb = upb @@ -80,11 +82,6 @@ class UpbEntity(Entity): """Return unique id of the element.""" return self._unique_id - @property - def should_poll(self) -> bool: - """Don't poll this device.""" - return False - @property def extra_state_attributes(self): """Return the default attributes of the element.""" diff --git a/homeassistant/components/utility_meter/sensor.py b/homeassistant/components/utility_meter/sensor.py index d2a2d2ba8ca..e1f5ef052e0 100644 --- a/homeassistant/components/utility_meter/sensor.py +++ b/homeassistant/components/utility_meter/sensor.py @@ -304,6 +304,8 @@ class UtilitySensorExtraStoredData(SensorExtraStoredData): class UtilityMeterSensor(RestoreSensor): """Representation of an utility meter sensor.""" + _attr_should_poll = False + def __init__( self, *, @@ -581,11 +583,6 @@ class UtilityMeterSensor(RestoreSensor): """Return the unit the value is expressed in.""" return self._unit_of_measurement - @property - def should_poll(self): - """No polling needed.""" - return False - @property def extra_state_attributes(self): """Return the state attributes of the sensor.""" diff --git a/homeassistant/components/velux/__init__.py b/homeassistant/components/velux/__init__.py index 789eb25273c..90045358136 100644 --- a/homeassistant/components/velux/__init__.py +++ b/homeassistant/components/velux/__init__.py @@ -88,6 +88,8 @@ class VeluxModule: class VeluxEntity(Entity): """Abstraction for al Velux entities.""" + _attr_should_poll = False + def __init__(self, node): """Initialize the Velux device.""" self.node = node @@ -117,8 +119,3 @@ class VeluxEntity(Entity): if not self.node.name: return "#" + str(self.node.node_id) return self.node.name - - @property - def should_poll(self): - """No polling needed within Velux.""" - return False diff --git a/homeassistant/components/w800rf32/binary_sensor.py b/homeassistant/components/w800rf32/binary_sensor.py index eb7a1492930..2473d193197 100644 --- a/homeassistant/components/w800rf32/binary_sensor.py +++ b/homeassistant/components/w800rf32/binary_sensor.py @@ -76,6 +76,8 @@ async def async_setup_platform( class W800rf32BinarySensor(BinarySensorEntity): """A representation of a w800rf32 binary sensor.""" + _attr_should_poll = False + def __init__(self, device_id, name, device_class=None, off_delay=None): """Initialize the w800rf32 sensor.""" self._signal = W800RF32_DEVICE.format(device_id) @@ -96,11 +98,6 @@ class W800rf32BinarySensor(BinarySensorEntity): """Return the device name.""" return self._name - @property - def should_poll(self): - """No polling needed.""" - return False - @property def device_class(self): """Return the sensor class.""" diff --git a/homeassistant/components/waterfurnace/sensor.py b/homeassistant/components/waterfurnace/sensor.py index 8418992ac5d..c6ef9610bca 100644 --- a/homeassistant/components/waterfurnace/sensor.py +++ b/homeassistant/components/waterfurnace/sensor.py @@ -96,6 +96,8 @@ def setup_platform( class WaterFurnaceSensor(SensorEntity): """Implementing the Waterfurnace sensor.""" + _attr_should_poll = False + def __init__(self, client, config): """Initialize the sensor.""" self.client = client @@ -131,11 +133,6 @@ class WaterFurnaceSensor(SensorEntity): """Return the units of measurement.""" return self._unit_of_measurement - @property - def should_poll(self): - """Return the polling state.""" - return False - async def async_added_to_hass(self): """Register callbacks.""" self.async_on_remove( diff --git a/homeassistant/components/wiffi/__init__.py b/homeassistant/components/wiffi/__init__.py index 0472a0bc3b3..d44c3aaefb7 100644 --- a/homeassistant/components/wiffi/__init__.py +++ b/homeassistant/components/wiffi/__init__.py @@ -138,6 +138,8 @@ class WiffiIntegrationApi: class WiffiEntity(Entity): """Common functionality for all wiffi entities.""" + _attr_should_poll = False + def __init__(self, device, metric, options): """Initialize the base elements of a wiffi entity.""" self._id = generate_unique_id(device, metric) @@ -170,11 +172,6 @@ class WiffiEntity(Entity): ) ) - @property - def should_poll(self): - """Disable polling because data driven .""" - return False - @property def device_info(self): """Return wiffi device info which is shared between all entities of a device.""" diff --git a/homeassistant/components/withings/common.py b/homeassistant/components/withings/common.py index 11badca8d8c..68238791f48 100644 --- a/homeassistant/components/withings/common.py +++ b/homeassistant/components/withings/common.py @@ -912,6 +912,8 @@ async def async_get_entity_id( class BaseWithingsSensor(Entity): """Base class for withings sensors.""" + _attr_should_poll = False + def __init__(self, data_manager: DataManager, attribute: WithingsAttribute) -> None: """Initialize the Withings sensor.""" self._data_manager = data_manager @@ -922,11 +924,6 @@ class BaseWithingsSensor(Entity): self._unique_id = get_attribute_unique_id(self._attribute, self._user_id) self._state_data: Any | None = None - @property - def should_poll(self) -> bool: - """Return False to indicate HA should not poll for changes.""" - return False - @property def name(self) -> str: """Return the name of the sensor.""" diff --git a/homeassistant/components/xbox_live/sensor.py b/homeassistant/components/xbox_live/sensor.py index f9283b459e9..b1500e6cedc 100644 --- a/homeassistant/components/xbox_live/sensor.py +++ b/homeassistant/components/xbox_live/sensor.py @@ -83,6 +83,8 @@ def get_user_gamercard(api, xuid): class XboxSensor(SensorEntity): """A class for the Xbox account.""" + _attr_should_poll = False + def __init__(self, api, xuid, gamercard, interval): """Initialize the sensor.""" self._state = None @@ -100,11 +102,6 @@ class XboxSensor(SensorEntity): """Return the name of the sensor.""" return self._gamertag - @property - def should_poll(self): - """Return False as this entity has custom polling.""" - return False - @property def native_value(self): """Return the state of the sensor.""" diff --git a/homeassistant/components/xiaomi_miio/remote.py b/homeassistant/components/xiaomi_miio/remote.py index 199f5dd6c5d..39a9c984a8c 100644 --- a/homeassistant/components/xiaomi_miio/remote.py +++ b/homeassistant/components/xiaomi_miio/remote.py @@ -181,6 +181,8 @@ async def async_setup_platform( class XiaomiMiioRemote(RemoteEntity): """Representation of a Xiaomi Miio Remote device.""" + _attr_should_poll = False + def __init__(self, friendly_name, device, unique_id, slot, timeout, commands): """Initialize the remote.""" self._name = friendly_name @@ -225,11 +227,6 @@ class XiaomiMiioRemote(RemoteEntity): except DeviceException: return False - @property - def should_poll(self): - """We should not be polled for device up state.""" - return False - async def async_turn_on(self, **kwargs): """Turn the device on.""" _LOGGER.error( diff --git a/homeassistant/components/yamaha_musiccast/media_player.py b/homeassistant/components/yamaha_musiccast/media_player.py index cee6253531b..123e62ab3a2 100644 --- a/homeassistant/components/yamaha_musiccast/media_player.py +++ b/homeassistant/components/yamaha_musiccast/media_player.py @@ -79,6 +79,8 @@ async def async_setup_entry( class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity): """The musiccast media player.""" + _attr_should_poll = False + def __init__(self, zone_id, name, entry_id, coordinator): """Initialize the musiccast device.""" self._player_state = STATE_PLAYING @@ -119,11 +121,6 @@ class MusicCastMediaPlayer(MusicCastDeviceEntity, MediaPlayerEntity): self.update_all_mc_entities ) - @property - def should_poll(self): - """Push an update after each command.""" - return False - @property def ip_address(self): """Return the ip address of the musiccast device.""" diff --git a/homeassistant/components/zhong_hong/climate.py b/homeassistant/components/zhong_hong/climate.py index 633dc50bcb7..9ceae1fea72 100644 --- a/homeassistant/components/zhong_hong/climate.py +++ b/homeassistant/components/zhong_hong/climate.py @@ -124,6 +124,7 @@ class ZhongHongClimate(ClimateEntity): HVACMode.FAN_ONLY, HVACMode.OFF, ] + _attr_should_poll = False _attr_supported_features = ( ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE ) @@ -160,11 +161,6 @@ class ZhongHongClimate(ClimateEntity): self._target_temperature = self._device.target_temperature self.schedule_update_ha_state() - @property - def should_poll(self): - """Return the polling state.""" - return False - @property def name(self): """Return the name of the thermostat, if any."""