Program that tests MODBus register values compared them to OpenWRT MicroBus, gsmdctl module values
Program tests any device from device list in config file when given parameter -D
, for example: sudo python3 ./main.py -D RUTX11
.
Note: the device must defined in config file. Config JSON file example.
It connects to device via SSH and MODBus TCP to test MODBus returned values. The program reads all data of a given device from config file (or default argument values) if such device exists. A connection is established if given parameters are correct (Device IP address, MODBus port, SSH port, auth credentials, etc.) and if the device is connected and is avaliable.
Program tests if given register address value is as axpected (see config file example) and forms result file.
Example result file:
Example program output:
Install Python 3.9.x with pip:
sudo apt update
sudo apt install python3.9 python3-pip
Install listed packages:
pip3 install pyModbusTCP
pip3 install paramiko
pip3 install reprint
Run program as sudo with parameters: sudo python3 ./main.py -D {device}
. For more information run python3 ./main -h
Note: when connecting to devices via serial port, make sure ModBus is enabled under services tab.
Default flag values:
- General flags:
- Device name: (
-D, --device
) no default value, the device must be specified by the user. - IP address (
-a" | --ip
) default value - `'192.168.1.1'
- Device name: (
- SSH flags:
- SSH port: (
-pS | --serial-port
) default value -22
- SSH IP address: (
-a | --ip
) default value -'192.168.1.1'
- SSH user username: (
-u | --user
) default value -'root'
- SSH user password: (
-p | --password
) default value -'Admin123'
- SSH port: (
- MODBus flags:
- MODBus port: (
-pM, --modbus-port
) default value -502
- MODBus port: (