Make ZHA entities non-polled by default (#19536)
parent
2a2af80309
commit
01fc322488
|
@ -121,11 +121,6 @@ class IasZoneSensor(RestoreEntity, ZhaEntity, BinarySensorDevice):
|
|||
from zigpy.zcl.clusters.security import IasZone
|
||||
self._ias_zone_cluster = self._in_clusters[IasZone.cluster_id]
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""Let zha handle polling."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return True if entity is on."""
|
||||
|
@ -261,11 +256,6 @@ class Remote(RestoreEntity, ZhaEntity, BinarySensorDevice):
|
|||
cluster = out_clusters[cluster_id]
|
||||
self._zcl_reporting[cluster] = {0: REPORT_CONFIG_IMMEDIATE}
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""Let zha handle polling."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if the binary sensor is on."""
|
||||
|
@ -359,11 +349,6 @@ class BinarySensor(RestoreEntity, ZhaEntity, BinarySensorDevice):
|
|||
_LOGGER.debug("%s restoring old state: %s", self.entity_id, old_state)
|
||||
self._state = old_state.state == STATE_ON
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""Let zha handle polling."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def cluster(self):
|
||||
"""Zigbee cluster for this entity."""
|
||||
|
|
|
@ -151,14 +151,6 @@ class ZhaFan(ZhaEntity, FanEntity):
|
|||
new_value = result.get('fan_mode', None)
|
||||
self._state = VALUE_TO_SPEED.get(new_value, None)
|
||||
|
||||
@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
|
||||
|
||||
def attribute_updated(self, attribute, value):
|
||||
"""Handle attribute update from device."""
|
||||
attr_name = self.cluster.attributes.get(attribute, [attribute])[0]
|
||||
|
|
|
@ -266,11 +266,3 @@ class Light(ZhaEntity, light.Light):
|
|||
xy_color = (round(result['current_x']/65535, 3),
|
||||
round(result['current_y']/65535, 3))
|
||||
self._hs_color = color_util.color_xy_to_hs(*xy_color)
|
||||
|
||||
@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
|
||||
|
|
|
@ -117,11 +117,6 @@ class Sensor(ZhaEntity):
|
|||
"""Return Sensor's cluster."""
|
||||
return self._cluster
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""State gets pushed from device."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def state(self) -> str:
|
||||
"""Return the state of the entity."""
|
||||
|
|
|
@ -82,11 +82,6 @@ class Switch(ZhaEntity, SwitchDevice):
|
|||
"""Entity's cluster."""
|
||||
return self._endpoint.on_off
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""Let zha handle polling."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return if the switch is on based on the statemachine."""
|
||||
|
|
|
@ -164,6 +164,11 @@ class ZhaEntity(entity.Entity):
|
|||
"""Return device specific state attributes."""
|
||||
return self._device_state_attributes
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""Let ZHA handle polling."""
|
||||
return False
|
||||
|
||||
@callback
|
||||
def attribute_updated(self, attribute, value):
|
||||
"""Handle an attribute updated on this cluster."""
|
||||
|
|
Loading…
Reference in New Issue