Report modbus buffer too small or too big to unpack (#57838)

This commit is contained in:
jan iversen
2021-10-21 00:22:01 +02:00
committed by GitHub
parent 38586d2cf1
commit cca7da77ad
5 changed files with 54 additions and 4 deletions

View File

@@ -74,6 +74,9 @@ class ModbusRegisterSensor(BaseStructPlatform, RestoreEntity, SensorEntity):
return
self._attr_native_value = self.unpack_structure_result(result.registers)
if self._attr_native_value is None:
self._attr_available = False
else:
self._attr_available = True
self._lazy_errors = self._lazy_error_count
self._attr_available = True
self.async_write_ha_state()