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

@ -126,6 +126,8 @@ def _return_on_connection_error(ret=None):
class ControllerDevice(ClimateEntity):
"""Representation of iZone Controller."""
_attr_should_poll = False
def __init__(self, controller: Controller) -> None:
"""Initialise ControllerDevice."""
self._controller = controller
@ -250,14 +252,6 @@ class ControllerDevice(ClimateEntity):
"""Return the name of the entity."""
return f"iZone Controller {self._controller.device_uid}"
@property
def should_poll(self) -> bool:
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False
@property
def temperature_unit(self) -> str:
"""Return the unit of measurement which this thermostat uses."""
@ -448,6 +442,8 @@ class ControllerDevice(ClimateEntity):
class ZoneDevice(ClimateEntity):
"""Representation of iZone Zone."""
_attr_should_poll = False
def __init__(self, controller: ControllerDevice, zone: Zone) -> None:
"""Initialise ZoneDevice."""
self._controller = controller
@ -525,14 +521,6 @@ class ZoneDevice(ClimateEntity):
"""Return the name of the entity."""
return self._name
@property
def should_poll(self) -> bool:
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return False
@property # type: ignore[misc]
@_return_on_connection_error(0)
def supported_features(self):