From 0f580af1d3d1a7eceeefc5964f1967b1af3daed6 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Mon, 21 Feb 2022 19:15:03 +0100 Subject: [PATCH] Correct switch verify to handle discret_read in Modbus (#66890) --- homeassistant/components/modbus/base_platform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/modbus/base_platform.py b/homeassistant/components/modbus/base_platform.py index 615e86ae920..0727fa81e44 100644 --- a/homeassistant/components/modbus/base_platform.py +++ b/homeassistant/components/modbus/base_platform.py @@ -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])