Add lazy_error_count to modbus (#54412)
* Add lazy_error_count. * Use -= * Review comments.
This commit is contained in:
parent
51434c5faa
commit
33f660118f
15 changed files with 47 additions and 1 deletions
|
@ -146,9 +146,14 @@ class ModbusCover(BasePlatform, CoverEntity, RestoreEntity):
|
|||
)
|
||||
self._call_active = False
|
||||
if result is None:
|
||||
if self._lazy_errors:
|
||||
self._lazy_errors -= 1
|
||||
return
|
||||
self._lazy_errors = self._lazy_error_count
|
||||
self._attr_available = False
|
||||
self.async_write_ha_state()
|
||||
return None
|
||||
return
|
||||
self._lazy_errors = self._lazy_error_count
|
||||
self._attr_available = True
|
||||
if self._input_type == CALL_TYPE_COIL:
|
||||
self._set_attr_state(bool(result.bits[0] & 1))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue