Use _attr_should_poll in components [h-i] (#77270)

This commit is contained in:
epenet 2022-08-26 10:20:38 +02:00 committed by GitHub
parent a46c25d2c8
commit 2a8109304f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 38 additions and 120 deletions

View file

@ -56,6 +56,7 @@ class IcloudDeviceBatterySensor(SensorEntity):
_attr_device_class = SensorDeviceClass.BATTERY
_attr_native_unit_of_measurement = PERCENTAGE
_attr_should_poll = False
def __init__(self, account: IcloudAccount, device: IcloudDevice) -> None:
"""Initialize the battery sensor."""
@ -102,11 +103,6 @@ class IcloudDeviceBatterySensor(SensorEntity):
name=self._device.name,
)
@property
def should_poll(self) -> bool:
"""No polling needed."""
return False
async def async_added_to_hass(self):
"""Register state update callback."""
self._unsub_dispatcher = async_dispatcher_connect(