Correct switch verify to handle discret_read in Modbus (#66890)

This commit is contained in:
jan iversen
2022-02-21 19:15:03 +01:00
committed by GitHub
parent 8080aab98e
commit 0f580af1d3

View File

@@ -312,7 +312,7 @@ class BaseSwitch(BasePlatform, ToggleEntity, RestoreEntity):
self._lazy_errors = self._lazy_error_count
self._attr_available = True
if self._verify_type == CALL_TYPE_COIL:
if self._verify_type in (CALL_TYPE_COIL, CALL_TYPE_DISCRETE):
self._attr_is_on = bool(result.bits[0] & 1)
else:
value = int(result.registers[0])