Fix bool registers in modbus integration (#41506)

When a register is of type bool modbus returns a whole byte, but ONLY the
lowest bit determine true/false.
This commit is contained in:
jan iversen 2020-10-08 23:52:41 +02:00 committed by GitHub
parent 8e3258cdfb
commit 4d9ff13384
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 33 deletions

View file

@ -122,5 +122,5 @@ class ModbusBinarySensor(BinarySensorEntity):
self._available = False
return
self._value = result.bits[0]
self._value = result.bits[0] & 1
self._available = True