Skip to content

This project provides an integration between Sofar inverters over RS485 and MQTT using Python It allows you to read and write data to Sofar inverters using a prebuilt Docker image or Python script

Notifications You must be signed in to change notification settings

rjpearce/sofar2mqtt-python

Repository files navigation

Sofar2MQTT - Python

Build Docker Image CodeQL

Overview

This project provides an integration between Sofar inverters over RS485 and MQTT using Python

It allows you to read and write data to Sofar inverters using a prebuilt Docker image (preferred) or Python script .

View the documentation

Release notes

3.0.1

  • Implemented MQTT auto discovery for home assistant - no more manual config!
  • Added a new refresh option for each register allowing some registers to be read more regularly (fresher) than other that are less important (i.e serial number)
  • Added registers for serial number, software version, hardware version.
  • The script now retains a local dict of data which is updated after reading registers for this iteration (based on refresh)
  • After an iteration the entire dict (JSON) is sent to a new topic sofar/state_all'
  • Added a new option for LEGACY_PUBLISH to continue to send messages individually in addition to sofar/state_all.
  • Introduce Signal handling to ensure graceful exit

Inverter Compatability

This software is currently compatible with:

  • Sofar ME3000
  • Sofar HYD 3~6 EP

Note: It has only been tested on EP inverters.

There is no reason it cannot work with other Sofar inverters, the code and data have been seperately deliberately to support this you just need to provide the correct registers, see the following files:

Please do feel free to contribute changes and improvements.

Example usage

Watch the video Click here to watch the video

NOTE: The slightly weird behaviour of desired power when in Self use, it is probably best to only change it when you are in Passive mode.

Home Assistant auto-discovery

The gateway supports Home Assistant MQTT discovery. It publishes configuration information automatically, the inverter will appears as an new MQTT device. No more manual configuration in Home Assistant!

Credits

Based on a script originally created by Matt Nichols in 2021. Thank you to Andre Wagner to his example write python code. Thank you everyone on the Sofar Solar Inverter - Remote Control & Smart Home Integration Facebook group.

Support

You can ping me directly on here or the awesome Sofar Solar Inverter - Remote Control & Smart Home Integration Facebook group

Other interesting projects

About

This project provides an integration between Sofar inverters over RS485 and MQTT using Python It allows you to read and write data to Sofar inverters using a prebuilt Docker image or Python script

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published