Skip to content

galets/eg4-modbus-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EG4 inverter monitor via modbus

This project implements a simple RS485 modbus monitor for EG4 inverters, specifically tested on 18kPv

Collected data will be posted to MQTT server

Build

# install dependencies
apt install git build-essential libpaho-mqttpp-dev libpaho-mqtt-dev libjsoncpp-dev libmodbus-dev libgtest-dev nodejs yq
# build
make clean
make

Hardware

This works with following hardware:

Command line parameters

Use following command line parameters to run the program:

  --device-model <model>    REQUIRED: Device Model (e.g., 18kpv or gridboss)
                            (Default: $DEVICE_MODEL)
  --device-manufacturer <m> Device Manufacturer
                            (Default: $DEVICE_MANUFACTURER or 'EG4')
  --device-name <name>      Device Name (friendly name)
                            (Default: $DEVICE_NAME or '')
  --modbus-port <device>    Serial port for Modbus RTU
                            (Default: $MODBUS_PORT or '/dev/ttyUSB0')
  --mqtt-uri <uri>          MQTT broker URI, for example: tcp://localhost:1883.
                            Default: $MQTT_URI
                            if not specified, no MQTT interaction is performed
  --mqtt-username <user>    MQTT username
                            (Default: $MQTT_USERNAME)
  --mqtt-password <pass>    MQTT password
                            (Default: $MQTT_PASSWORD)
  --mqtt-client-id <id>     MQTT client ID, use different IDs for different devices
                            (Default: $MQTT_CLIENT_ID or 'modbus-reader')
  -v, --verbose             Show more diagnostic information
  -n, --no-header           Suppress header
  -h, --help                Show this help message and exit

If MQTT URI is not specified, the program will print all available parameters from device in JSON format and exit.

If MQTT_URI is specified, the program will use MQTT server to post values every 10 seconds. Also, an MQTT auto-discovery entries would be posted, so that Home Assistant can automatically find and configure device

Configuration using environment values

Environment variables can also be used to provide configuration. Example:

export MQTT_URI=tcp://localhost:1883
# empty username indicated anonymous access will be used
export MQTT_USERNAME=
export MQTT_PASSWORD=
export MQTT_CLIENT_ID=modbus-local-reader
export MODBUS_PORT=/dev/ttyUSB0
export DEVICE_MANUFACTURER=EG4
export DEVICE_MODEL=18kpv
export DEVICE_NAME="EG4 18kpv Inverter"
build/eg4-modbus-reader

export DEVICE_MODEL=gridboss
export DEVICE_NAME="EG4 GridBOSS"
build/eg4-modbus-reader 

Contact

This project will be maintained on github at https://github.com/galets/eg4-modbus-monitor

Discussion group will be available on Telegram at https://t.me/eg4modbus

About

Monitor EG4 Inverters and GridBOSS via wired RS485 connection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published