Allow only_cache parameter in zha.safe_read() (#16553)
* Allow only_cache parameter in zha.safe_read() * Use cache_only for binary_sensor.zha initial update. * Use cache_only for fan.zha initial update. * Use cache_only for sensor.zha initial update. * Use cache_only for switch.zha initial update. * Use cache_only for light.zha initial update. * Refactor cached only read in zha platform.
This commit is contained in:
parent
f2203e52ef
commit
7a52bbdf24
6 changed files with 30 additions and 12 deletions
|
@ -132,7 +132,8 @@ class BinarySensor(zha.Entity, BinarySensorDevice):
|
|||
|
||||
result = await zha.safe_read(self._endpoint.ias_zone,
|
||||
['zone_status'],
|
||||
allow_cache=False)
|
||||
allow_cache=False,
|
||||
only_cache=(not self._initialized))
|
||||
state = result.get('zone_status', self._state)
|
||||
if isinstance(state, (int, uint16_t)):
|
||||
self._state = result.get('zone_status', self._state) & 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue