https://github.com/arevindh/solarman-to-mqtt
Read inverter data from sofar inverters using solarman wifi stick
https://github.com/arevindh/solarman-to-mqtt
Last synced: 11 months ago
JSON representation
Read inverter data from sofar inverters using solarman wifi stick
- Host: GitHub
- URL: https://github.com/arevindh/solarman-to-mqtt
- Owner: arevindh
- License: gpl-3.0
- Created: 2021-10-20T02:45:53.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-02-16T15:52:02.000Z (over 4 years ago)
- Last Synced: 2025-02-13T08:30:53.844Z (over 1 year ago)
- Language: Python
- Size: 75.2 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## Introduction

Solarman to MQTT a small script to get data from Omnik, Hosola, Goodwe, Solax, Ginlong, Samil, Sofar or Power-One Solar inverter, equipped with a wifi module or connected to a Wi-Fi data logger and push to an mqtt server of your choice.
MQTT topic optimized for Home Assistant [autodiscovery](https://www.home-assistant.io/docs/mqtt/discovery/).
This script is adapted from [https://github.com/mcikosos/Inverter-Data-Logger](https://github.com/mcikosos/Inverter-Data-Logger)
Check the above link to know the list of supported inverters.
## Notes
This service should be running on an always on device preferably a Raspberry Pi or a VM.
Wifi Logger needs a static ip inorder to work flawlessly [https://www.pcmag.com/how-to/how-to-set-up-a-static-ip-address](https://www.pcmag.com/how-to/how-to-set-up-a-static-ip-address)

## Docker
Create `docker-compose.yaml`
```
version: '3.7'
services:
solarman-to-mqtt:
image: arevindh/solarman-to-mqtt
container_name: solarman-to-mqtt
volumes:
- ./config.cfg:/usr/src/app/config.cfg
- ./logs:/usr/src/app/logs
restart: unless-stopped
```
create `config.cfg` from template [config.org.cfg](config.org.cfg) in the same folder
`sudo docker-compose up -d`
## Solarman stick logger to mqtt
`git clone https://github.com/arevindh/solarman-to-mqtt`
`cd solarman-to-mqtt`
`cp config.org.cfg config.cfg`
Edit the contents to match your settings
## Install requirements
`pip3 install -r requirements.txt`
## Testing
`python3 SyncSolarMan.py`
## Create Service
Change `dietpi` to your username ( `whoami` will provide you with your username )
`sudo nano /etc/systemd/system/solarman.service`
```
[Unit]
Description = Solarman Logger to MQTT
After = network.target
[Service]
Type = simple
ExecStart = python3 /home/dietpi/solarman-to-mqtt/SyncSolarMan.py
WorkingDirectory = /home/dietpi/solarman-to-mqtt
User = dietpi
Group = dietpi
Restart = on-failure
RestartSec = 60
TimeoutStartSec = infinity
[Install]
WantedBy = multi-user.target
```
`sudo systemctl daemon-reload`
`sudo systemctl start solarman`
`sudo systemctl status solarman`
`sudo systemctl enable solarman`
## To do
- Better handling of offline device
- Code refactor