PySolarmanV5

raw JSON →
3.0.6 verified Fri May 01 auth: no python

A Python library for interacting with Solarman (IGEN-Tech) v5 based Solar Data Loggers. Version 3.0.6, requires Python >=3.8. Active development with breaking changes in v2-to-v3 transition.

pip install pysolarmanv5
error TypeError: 'str' object cannot be interpreted as an integer
cause serial number passed as string instead of int
fix
Convert serial to int: serial=int('your_serial_string')
error pysolarmanv5.exceptions.SolarmanV5Error: Connection refused
cause Wrong port or host unreachable. Default port is 8899, some loggers use 4196.
fix
Check logger IP and try port 4196 or 8899.
error AttributeError: module 'pysolarmanv5' has no attribute 'SolarmanV5'
cause Outdated import path from v1.
fix
Use 'from pysolarmanv5 import SolarmanV5' (not pysolarmanv5.pysolarmanv5).
breaking v2 to v3: The constructor no longer accepts 'inverter_address' or 'inverter_port' parameters; use 'host' and 'port'.
fix Replace inverter_address with host, inverter_port with port.
breaking v2 to v3: 'get_sensors()' returns list of dicts, not list of InverterData objects.
fix Adapt code to iterate over dict keys instead of object attributes.
gotcha Inverter serial number must be passed as int, not str. Passing a string leads to TypeError.
fix Cast to int: serial=int(os.environ.get('SERIAL'))
gotcha Default port is 8899 for TCP, but some loggers use 4196. Check your logger's manual.
fix Explicitly set port=4196 if connection fails.

Connect to a Solarman v5 logger, read sensors and registers.

from pysolarmanv5 import SolarmanV5
import os

inverter = SolarmanV5(
    host=os.environ.get('INVERTER_HOST', '192.168.1.100'),
    serial=int(os.environ.get('INVERTER_SERIAL', '123456789')),
    port=8899,
    mb_slave_id=1,
    verbose=False
)
print(inverter.get_sensors())
data = inverter.read_holding_registers(register_addr=0, quantity=10)
print(data)
inverter.disconnect()