Closed nate8199 closed 8 months ago
Hi @nate8199, thanks for your interest. You are right. The current version of modpoll
is using SOCKET framer for tcp client and RTU framer for rtu client by default. It doesn't support your use case, which requires RTU framer but over tcp client. Thanks to your report, I understand such use cases might be useful when people tend to use RTU device over TCP network, I am going to add this feature in the next version of modpoll
. Stay tuned.
Released a new version 0.7.0
with a newly added argument --framer
and a few other improvements.
@nate8199 Please help to test with your setup and let me know the outcome, since it is not easy to replicate such a unique setup on my side.
The following command for your reference, feel free to adjust,
modpoll --tcp 192.168.0.63 --config desk_ac_current.csv --framer rtu
Possible choices of framer are: [ascii, binary, rtu, socket]. Refer to here for argument details.
Thank you @gavinying, this works now with the new framer option
nate@framework:~/Code> modpoll --tcp 192.168.0.63 --tcp-port 502 --framer rtu --config desk_ac_current.csv
modpoll - A New Command Line Tool for Modbus
2024-02-16 16:00:28,888 | I | modpoll.main | No MQTT host specified, skip MQTT setup.
2024-02-16 16:00:28,888 | I | modpoll.modbus_task | Loading config from: desk_ac_current.csv
2024-02-16 16:00:28,889 | I | modpoll.modbus_task | Adding new device desk_ac_current
2024-02-16 16:00:28,889 | I | modpoll.modbus_task | Add poller (start_address=0, size=10) to device desk_ac_current
2024-02-16 16:00:28,889 | I | modpoll.modbus_task | Polling 1 device(s)...
2024-02-16 16:00:28,889 | I | modpoll.main | ====== modpoll polling at rate:10.0s, actual:10.0s ======
2024-02-16 16:00:28,974 | I | modpoll.modbus_task | Reading device:desk_ac_current, FuncCode:4, Start_address:0, Size:10... SUCCESS
===== references from device: desk_ac_current =====
+-------------+-------+---------+-------+
| name | unit | address | value |
+-------------+-------+---------+-------+
| voltage | V | 0 | 122 |
| amps | A | 1 | 0.073 |
| power | W | 3 | 4.2 |
| energy | Wh | 5 | 2227 |
| frequency | Hz | 7 | 60 |
| powerfactor | pf | 8 | 0.47 |
| alarm | alarm | 9 | 0 |
+-------------+-------+---------+-------+
Done.
I'm having issues reading a serial device that is plugged into a TCP Serial Server with Modpoll I can get it to work with plain pymodbus in VSCode with the attached code, not sure if I'm missing an option, doing something wrong, or if this type of device doesn't work by default.
Python
CSV (I have tried both Input and Holding)
Command
modpoll --tcp 192.168.0.63 --config desk_ac_current.csv