Local RS485-to-LaMetric bridge for showing realtime solar generation from an Autarco-branded inverter that speaks Solis/Ginlong-ish Modbus RTU.
This is deliberately simpler than lametric-power-bridge: one ingress path, one display target, no cloud.
- Polls the inverter over a USB RS485 adapter using Modbus RTU.
- Reads a configurable active-power holding register.
- Pushes the current generation to a LaMetric Time using the local HTTP Push URL.
- Shows
-- Wif data goes stale. - Runs cleanly under systemd on a small Linux box.
- LaMetric Time with the My Data DIY app configured for HTTP Push.
- USB RS485 adapter.
- Twisted pair from adapter A/B to the inverter RS485 A/B terminals.
- Correct serial permissions for the service user, usually membership of
dialout.
Public Solis/Ginlong register maps are annoyingly inconsistent across model families and tools.
The default is:
SOLIS_MODBUS_REGISTER=3004
SOLIS_MODBUS_REGISTER_COUNT=2
SOLIS_MODBUS_SCALE=1.0
SOLIS_MODBUS_BYTEORDER=big
SOLIS_MODBUS_SIGNED=false
That matches commonly documented Solis string inverter active power at registers 3004, 3005.
For many hybrid models, try:
SOLIS_MODBUS_REGISTER=33079
SOLIS_MODBUS_REGISTER_COUNT=2
Some Modbus tools show one-based register numbers while libraries use zero-based addresses. This bridge sends SOLIS_MODBUS_REGISTER directly to pymodbus. If the read fails or the values look shifted, try one lower: 3003 or 33078.
Useful references:
- Solis Modbus integration register overview: https://solis-modbus.readthedocs.io/en/latest/sensors.html
- Solis service note showing function code 03 and starting address
3000: https://usservice.solisinverters.com/support/solutions/articles/73000660897-modbus-tcp-ip
git clone git@github.com:spacebabies/lametric-autarco-bridge.git
cd lametric-autarco-bridge
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtcp lametric-autarco-bridge.env.example lametric-autarco-bridge.env
vim lametric-autarco-bridge.envRequired:
LAMETRIC_URL: full HTTP Push URL from the LaMetric mobile app.LAMETRIC_API_KEY: local API key for the device.SOLIS_MODBUS_DEVICE: USB RS485 adapter path, default/dev/ttyUSB0.
Common Modbus defaults:
SOLIS_MODBUS_BAUDRATE=9600SOLIS_MODBUS_SLAVE_ID=1SOLIS_MODBUS_REGISTER=3004SOLIS_MODBUS_REGISTER_COUNT=2
Do not select an adapter from its /dev/ttyUSB0 number. That number is assigned
when devices are detected and may change after a reboot or when another USB
serial device is connected. P1 smart-meter cables, console cables and RS485
adapters can also use the same FTDI USB chip, so even identical lsusb entries
do not prove which cable is which.
The most reliable procedure is to identify the adapter while it is the only USB serial cable being connected:
-
Stop programs which use any USB serial cables, then disconnect the other serial cables temporarily. If that is impractical, record the list before connecting the RS485 adapter.
ls -l /dev/serial/by-id/ 2>/dev/null -
Connect the USB RS485 adapter and run the command again. The newly appearing entry is the adapter. For example:
usb-FTDI_FT232R_USB_UART_BG03OE3O-if00-port0 -> ../../ttyUSB0The part before
->is the stable device name. It will be different for each adapter; copy it exactly from your own output. -
Put its complete path in
lametric-autarco-bridge.env:SOLIS_MODBUS_DEVICE=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_BG03OE3O-if00-port0 SOLIS_MODBUS_BAUDRATE=9600 SOLIS_MODBUS_SLAVE_ID=1
-
Reconnect the other cables and confirm that the selected symlink still resolves to an existing device:
readlink -f /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_BG03OE3O-if00-port0
Output such as
/dev/ttyUSB0or/dev/ttyUSB1is expected. It does not matter if that final number changes later: the configuredby-idpath stays associated with the adapter's USB serial number. -
Test only the selected adapter and Modbus connection:
python bridge.py --modbus-only
This bridge only reads Modbus registers. A wrong serial device normally results in timeouts or invalid responses, but it is still better to identify the cable physically instead of trying every serial port on the system.
For additional diagnosis, list all USB devices and serial ports:
lsusb
ls -l /dev/ttyUSB* /dev/ttyACM* 2>/dev/null
ls -l /dev/serial/by-id/ 2>/dev/nullAn RS485 adapter may appear as an FTDI, CH340/CH341, CP210x or Prolific device.
USB vendor/product IDs from lsusb, such as 0403:6001, do not need separate
env settings. If no new serial device appears, follow kernel messages while
reconnecting the adapter:
sudo dmesg --followThe kernel should report a device such as ttyUSB0 or ttyACM0. Its USB
properties can be inspected with:
udevadm info --query=property --name=/dev/ttyUSB0source .venv/bin/activate
python bridge.pyTo test only the USB/Modbus connection, without configuring or contacting a LaMetric device:
python bridge.py --modbus-onlyThis continuously writes timestamped power readings to stdout. Stop it with
Ctrl-C. Only the SOLIS_MODBUS_* settings are used in this mode.
If the serial adapter is not accessible:
ls -la /dev/ttyUSB*
sudo usermod -a -G dialout "$USER"Then log out and back in.
Edit lametric-autarco-bridge.service for your username and path, then:
sudo cp lametric-autarco-bridge.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now lametric-autarco-bridge
sudo journalctl -u lametric-autarco-bridge -fpip install -r requirements-dev.txt
pytestThis only reads registers. It does not write settings to the inverter.
GPLv3.