mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 20:25:07 +02:00
Fix binary_sensor async_update (#14376)
This commit is contained in:
@@ -133,7 +133,8 @@ class BinarySensor(zha.Entity, BinarySensorDevice):
|
||||
from bellows.types.basic import uint16_t
|
||||
|
||||
result = await zha.safe_read(self._endpoint.ias_zone,
|
||||
['zone_status'])
|
||||
['zone_status'],
|
||||
allow_cache=False)
|
||||
state = result.get('zone_status', self._state)
|
||||
if isinstance(state, (int, uint16_t)):
|
||||
self._state = result.get('zone_status', self._state) & 3
|
||||
|
@@ -410,7 +410,7 @@ def get_discovery_info(hass, discovery_info):
|
||||
return all_discovery_info.get(discovery_key, None)
|
||||
|
||||
|
||||
async def safe_read(cluster, attributes):
|
||||
async def safe_read(cluster, attributes, allow_cache=True):
|
||||
"""Swallow all exceptions from network read.
|
||||
|
||||
If we throw during initialization, setup fails. Rather have an entity that
|
||||
@@ -420,7 +420,7 @@ async def safe_read(cluster, attributes):
|
||||
try:
|
||||
result, _ = await cluster.read_attributes(
|
||||
attributes,
|
||||
allow_cache=True,
|
||||
allow_cache=allow_cache,
|
||||
)
|
||||
return result
|
||||
except Exception: # pylint: disable=broad-except
|
||||
|
Reference in New Issue
Block a user