'PyModbus - Read_holding_coils returns strange value
I have written the following little block of code:
from pymodbus.client.sync import ModbuTcpClient
def test(client):
client.connect()
print client.read_holding_registers(10, 1, unit=10)
client.close()
test(client)
.
The output I get from print is:
ReadRegisterResponse (1)
.
Why am I getting this and not the actual value (integer/string) the register is holding?
Thanks for the answers!
Solution 1:[1]
You asked for 1 register at address 10 and got a response that says the value at address 10 is 1. What were you expecting to be different?
Solution 2:[2]
#For me this solution was enough hope it helps
res = client.read_holding_registers(address=10,count=1, unit=10)
print res.encode()
print res.registers
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kevin Herron |
| Solution 2 | duda-arch |
