Skip to content

Instantly share code, notes, and snippets.

View markgdev's full-sized avatar

Mark Gardner markgdev

View GitHub Profile
@markgdev
markgdev / solis_5g_modbus.py
Last active October 29, 2023 19:30
Query a Solis Hybrid 5G inverter and push to MQTT
import minimalmodbus
import time
import paho.mqtt.publish as publish
instrument = minimalmodbus.Instrument('/dev/ttyUSB0', 1, debug = False)
instrument.serial.baudrate = 9600
# This probably doesn't need setting but I was getting timeout failures
# rather than wrong data address when I had the registers wrong
instrument.serial.timeout = 2
# An example read for long