Modpoll and HA

Hi,
since I used modbus on HA I had many and many problems with any device, sometimes bypassed using Nodered. Now I want to try a definitive solution using linux version (x86_64-linux-gnu) of MODPOLL (Free Modbus Master Simulator and Test Tool). I tried to upload it on HA /config/temp folder, chmod 777 and execute. It worked! I have always the right reading values for every device.

./modpoll -t 4:float -f -r 45166 -o 5 -i -c 4 -1 192.168.1.120

modpoll 3.10 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2021 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: MODBUS/TCP, FC3
Slave configuration...: address = 1, start reference = 45166, count = 4
Communication.........: 192.168.1.120, port 502, t/o 5.00 s, poll rate 1000 ms
Data type.............: 32-bit float, output (holding) register table
Word swapping.........: Slave configured as big-endian word and float machine

-- Polling slave...
[45166]: 3511.693115
[45168]: 0.000000
[45170]: 746.195984
[45172]: 90.900002

Now, I want to install correctly Modpoll on HA in order to execute it from a script on HA and get the values on a sensor (e.g. command line sensor)

Can you give me some suggestion?

I tried to copy modpoll in /bin and /etc, but it does’t work when I create a sensor like:

  - platform: command_line
    name: Test Modpoll
    command: "modpoll -t 4:float -f -r 45166 -o 5 -i -c 4 -1 192.168.1.120"  

or

  - platform: command_line
    name: Test Modpoll
    command: "/config/temp/modpoll -t 4:float -f -r 45166 -o 5 -i -c 4 -1 192.168.1.120"  

It seems modpoll is not executed at all. In fact I cannot find sensor test_modpoll

Continues here: Modpoll - An alternative to read modbus device registers on HASSIO

Try this new Modpoll tool, which does exactly what you need. It can also run as Modbus-MQTT gateway for HA integration.