09.02.2022, 07:52
The value that you are writing has both bits 0 and 2 set which the Modbus device might reject. Log the returned write result. It might have an error indication.
Also keep in mind that using scripts can lead to random errors if two scripts try to access the same serial port in parallel. It is recommended to use profiles instead.
Code:
value = 4 -- bit 2 set to 1
res, err = mb:writeregisters(33471, value)
log(res, err)
Also keep in mind that using scripts can lead to random errors if two scripts try to access the same serial port in parallel. It is recommended to use profiles instead.