Fix modbus boolean decoding
Summary
When reading a bool value from a modbus node as discrete input, an error is raised.
Explain your context
I was trying to read whether a phase on an emonio device was connected
Was there an error message?
val = struct.unpack(unpack, struct.pack(pack, *value))[0]
struct.error: unpack requires a buffer of 1 bytes
Steps to reproduce
(How one can reproduce the issue - this is very important)
import struct
value = [1]
dtype = "?"
_len=1
bo=">"
pack = f">{len(value):1d}H"
unpack = f"{bo}{_len}{dtype}"
# Convert the value into the appropriate format
val = struct.unpack(unpack, struct.pack(pack, *value))[0]