As we discussed last year in my thread on modbus [Modbus challenge], I’d trying to monitor and control a commercial PID Temp controller via modbus.
Well, new year, new controller. With the new controller, I can successfully read the PV, SV and alarm setting and value.
But, I am unable to new SV value to a register.
Per the controller docs SYL-2381 docs, in order to write a floating point value I must use modbus function 10H. As I read the HA modbus docs, in order to use function 10H for a write, I must specify an array. I’m using the following service call to set the temp to 75.
This results in the setting changing to 0.
I have also tried [75,00] : also changed to 0
[75] - no change plus error:
Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:409
First occurred: 4:05:08 PM (1 occurrences)
Last logged: 4:05:08 PM
websocket_api script: Error executing script. Invalid data for call_service at pos 1: expected int @ data['value'][0]
and 75 has no effect.
Apppreciate any assistance. I am on 2023.2.5 running HAOS on a HA Blue.
There is a way to turn debug on. Described in the docs. May be useful to see it that dump out the bytes sent to the device and see if that 57 even makes it.
The issue was that I needed to write a floating point value. I changed the value to [0x4296,0x0000] (per the Modbus docs) and successfully wrote the value!
While this works, I have another issue to solve. Per the modbus docs, I have to use a “network order float hexadecimal” when I submit to modbus.write-register. That format is IEEE 754. I’ll need to convert decimal values to this format. Has anyone used a template to do so?