A local Growatt server which listens to your Shine Wifi-X datalogger and publishes to MQTT
Project description
๐ Shine2MQTT
A local Growatt server which listens to your Shine Wifi-X datalogger and publishes to MQTT
Shine2MQTT acts as a local server for your Growatt Shine Wifi-X datalogger, capturing data that would normally be sent to Growatt's cloud servers. It publishes this data via MQTT in a Home Assistant-friendly format, giving you complete local control of your solar inverter data.
โจ Features
- ๐ Home Assistant Integration - Native MQTT discovery support
- ๐ Local Control - Keep your data private, no cloud dependency
- ๐ณ Docker Support - Easy deployment with Docker/Docker Compose
- โก Real-time Data - Instant solar production metrics
- ๐ ๏ธ RESTful API - Built-in API for monitoring and control (Alpha)
- ๐ Comprehensive Metrics - Power, voltage, current, energy totals, and more
๐ Compatibility
| Component | Tested Models |
|---|---|
| Datalogger | Shine WiFi-X |
| Inverter | MIC 3000TL-X |
๐ก Other Growatt models using the Shine protocol may work but haven't been tested. There is some functionality to capture raw data frames for integrating other models. Please open an issue so I can check if its easy to integrate, most likely it is.
๐ฆ Installation
Option 1: Docker (Recommended)
Using Docker CLI:
Use plain Docker to run the shine2mqtt container:
docker run -d \
--name shine2mqtt \
-p 5279:5279 \
-p 8000:8000 \
bremme/shine2mqtt:latest \
--mqtt-server-host your-mqtt-broker \
--mqtt-server-port 1883 \
--mqtt-server-username username \
--mqtt-server-password password \
--mqtt-discovery-inverter-model "MIC 3000TL-X" \
--mqtt-discovery-datalogger-model "Shine WiFi-X"
Using Docker Compose:
Create a docker-compose.yaml file, a basic example would look like this:
services:
shine2mqtt:
image: bremme/shine2mqtt:latest
container_name: shine2mqtt
ports:
- "5279:5279"
- "8000:8000"
environment:
SHINE2MQTT_MQTT__CLIENT__HOST: "your-mqtt-broker"
SHINE2MQTT_MQTT__CLIENT__PORT: "1883"
SHINE2MQTT_MQTT__CLIENT__USERNAME: "username"
SHINE2MQTT_MQTT__CLIENT__PASSWORD: "password"
SHINE2MQTT_MQTT__DISCOVERY__INVERTER__MODEL: "MIC 3000TL-X"
SHINE2MQTT_MQTT__DISCOVERY__DATALOGGER__MODEL: "Shine WiFi-X"
restart: unless-stopped
Run the container:
docker compose up
๐ก See docker-compose.example.yaml for all available options.
Option 2: UV (Python Package Manager)
# Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run directly with UV
uv run shine2mqtt
# Or install globally
uv tool install shine2mqtt
# And run
shine2mqtt
Option 3: Python Module from src
# Clone the repository
git clone https://github.com/bremme/shine2mqtt.git
cd shine2mqtt
# Install dependencies
uv sync --no-dev
# Run the application
uv run shine2mqtt
โ๏ธ Configuration
Shine2MQTT can be configured through CLI arguments, environment variables, or a YAML configuration file. Options are applied in this priority order (highest to lowest):
- Command-line arguments
- Environment variables
- Configuration file
- Default values
Configuration options
| Option | Default | Description |
|---|---|---|
log_level |
INFO |
Logging level (DEBUG, INFO, WARNING, ERROR) |
log_color |
false |
Force colored logging output |
capture_data |
false |
Capture raw frames and store in captured_frames/ |
mqtt.base_topic |
solar |
Base MQTT topic for publishing data |
mqtt.availability_topic |
solar/state |
MQTT topic for availability status |
mqtt.server.host |
localhost |
MQTT broker host |
mqtt.server.port |
1883 |
MQTT broker port |
mqtt.server.username |
MQTT broker username | |
mqtt.server.password |
MQTT broker password | |
mqtt.server.client_id |
shine2mqtt |
MQTT client identifier |
mqtt.discovery.enabled |
false |
Enable Home Assistant MQTT discovery |
mqtt.discovery.prefix_topic |
homeassistant |
MQTT discovery topic prefix |
mqtt.discovery.inverter.model |
Inverter model for Home Assistant | |
mqtt.discovery.datalogger.model |
Datalogger model for Home Assistant | |
server.host |
0.0.0.0 |
TCP server host |
server.port |
5279 |
TCP server port |
api.enabled |
false |
Enable RESTful API |
api.host |
0.0.0.0 |
RESTful API host |
api.port |
8000 |
RESTful API port |
simulated_client |
false |
Enable simulated client for testing |
simulated_client.server_host |
localhost |
Simulated client server host |
simulated_client.server_port |
5279 |
Simulated client server port |
All options can be set via any of the configuration methods.
CLI Arguments
For cli arguments _, or . need to be converted to -. For example:
log_levelbecomes--log-levelmqtt.base_topicbecomes--mqtt-base-topic
For all available options run:
uv run shine2mqtt --help
Environment Variables
For environmental variables prefix with SHINE2MQTT_, use uppercase, convert - to _ and . to __. For example:
log_levelbecomesSHINE2MQTT_LOG_LEVELmqtt.base_topicbecomesSHINE2MQTT_MQTT__BASE_TOPIC
YAML Configuration File
To use a configuration file, have a look at the config.example.yaml file and create your own config.yaml. The file will be automatically picked up in the default location (./config.yaml), but you can also specify a custom path with the --config-file CLI argument or SHINE2MQTT_CONFIG_FILE environment variable.
๐ Usage
1. Configure Your Shine Datalogger
Point your Shine datalogger to the IP address where Shine2MQTT is running:
- Connect to your datalogger's WiFi network
- Press the button on the bottom, and wait for the blue LED.
- Access your datalogger's web interface (usually at
http://192.168.10.100) - Login using default credentials (typically admin and 12345678)
- Navigate to Advanced Settings > Server IP
- Change the server IP to your Shine2MQTT host address
- Set the port to
5279(default) - Save and reboot the datalogger
2. Verify Connection
Check the logs to confirm the datalogger is connecting:
# Docker
docker logs -f shine2mqtt
# Docker compose (if running detached)
docker compose logs -f shine2mqtt
# UV/Python
# Logs will appear in stdout
You should see a message like:
11:48:15 | INFO | server - Accepted new TCP connection from ('<ip-address>', <random-port>)
3. Home Assistant Integration
If MQTT discovery is enabled, your inverter will automatically appear in Home Assistant under:
- Settings โ Device & Services โ MQTT -> Devices
- You should see a new entry for both the inverter as well as the datalogger:
- Inverter Name:
Growatt MIC 3000TL-X(or your specified model) - Datalogger Name:
Shine WiFi-X(or your specified model)
- Inverter Name:
All sensors will be automatically created with appropriate device classes and units.
๐ Published Data
Shine2MQTT publishes the following metrics via MQTT:
Inverter Sensors
| Metric | Topic | Unit |
|---|---|---|
| DC Metrics | ||
| Total DC Power Input | solar/inverter/sensor/power_dc |
W |
| DC Voltage String 1 | solar/inverter/sensor/voltage_dc_1 |
V |
| DC Current String 1 | solar/inverter/sensor/current_dc_1 |
A |
| DC Power String 1 | solar/inverter/sensor/power_dc_1 |
W |
| DC Voltage String 2 | solar/inverter/sensor/voltage_dc_2 |
V |
| DC Current String 2 | solar/inverter/sensor/current_dc_2 |
A |
| DC Power String 2 | solar/inverter/sensor/power_dc_2 |
W |
| AC Metrics | ||
| AC Power Output | solar/inverter/sensor/power_ac |
W |
| Grid Frequency | solar/inverter/sensor/frequency_ac |
Hz |
| AC Voltage Phase 1 | solar/inverter/sensor/voltage_ac_1 |
V |
| AC Current Phase 1 | solar/inverter/sensor/current_ac_1 |
A |
| AC Apparent Power Phase 1 | solar/inverter/sensor/power_ac_1 |
VA |
| AC Line Voltages | ||
| AC Line Voltage L1-L2 | solar/inverter/sensor/voltage_ac_l1_l2 |
V |
| AC Line Voltage L2-L3 | solar/inverter/sensor/voltage_ac_l2_l3 |
V |
| AC Line Voltage L3-L1 | solar/inverter/sensor/voltage_ac_l3_l1 |
V |
| Energy Production | ||
| Today's AC Energy Production | solar/inverter/sensor/energy_ac_today |
kWh |
| Lifetime AC Energy Production | solar/inverter/sensor/energy_ac_total |
kWh |
| Lifetime DC Energy Production | solar/inverter/sensor/energy_dc_total |
kWh |
| Today's DC Energy String 1 | solar/inverter/sensor/energy_dc_1_today |
kWh |
| Lifetime DC Energy String 1 | solar/inverter/sensor/energy_dc_1_total |
kWh |
| Today's DC Energy String 2 | solar/inverter/sensor/energy_dc_2_today |
kWh |
| Lifetime DC Energy String 2 | solar/inverter/sensor/energy_dc_2_total |
kWh |
Inverter Diagnostic Sensors
| Metric | Topic | Unit |
|---|---|---|
| Inverter Serial Number | solar/inverter/sensor/inverter_serial |
- |
| Inverter Firmware Version | solar/inverter/sensor/inverter_fw_version |
- |
| Inverter Control Firmware Version | solar/inverter/sensor/inverter_control_fw_version |
- |
| Maximum Active AC Power | solar/inverter/sensor/active_power_ac_max |
% |
| Maximum Reactive AC Power | solar/inverter/sensor/reactive_power_ac_max |
% |
| Power Factor | solar/inverter/sensor/power_factor |
- |
| Power Factor Control Mode | solar/inverter/sensor/power_factor_control_mode |
- |
| Rated AC Power | solar/inverter/sensor/rated_power_ac |
VA |
| Rated DC Voltage | solar/inverter/sensor/rated_voltage_dc |
V |
| AC Voltage Low Limit | solar/inverter/sensor/voltage_ac_low_limit |
V |
| AC Voltage High Limit | solar/inverter/sensor/voltage_ac_high_limit |
V |
| AC Frequency Low Limit | solar/inverter/sensor/frequency_ac_low_limit |
Hz |
| AC Frequency High Limit | solar/inverter/sensor/frequency_ac_high_limit |
Hz |
Datalogger Diagnostic Sensors
| Metric | Topic | Unit |
|---|---|---|
| Datalogger Serial Number | solar/datalogger/sensor/datalogger_serial |
- |
| Datalogger Software Version | solar/datalogger/sensor/datalogger_sw_version |
- |
| Datalogger Hardware Version | solar/datalogger/sensor/datalogger_hw_version |
- |
| Data Update Interval | solar/datalogger/sensor/update_interval |
min |
| Datalogger IP Address | solar/datalogger/sensor/ip_address |
- |
| Datalogger MAC Address | solar/datalogger/sensor/mac_address |
- |
| Network Netmask | solar/datalogger/sensor/netmask |
- |
| Gateway IP Address | solar/datalogger/sensor/gateway_ip_address |
- |
| Server IP Address | solar/datalogger/sensor/server_ip_address |
- |
| Server Port | solar/datalogger/sensor/server_port |
- |
| WiFi Network Name (SSID) | solar/datalogger/sensor/wifi_ssid |
- |
๐ ๏ธ Development
Prerequisites
- Python 3.14+
- UV - Fast Python package manager
- Pre-commit - Git hooks
Setup Development Environment
# Clone the repository
git clone https://github.com/bremme/shine2mqtt.git
cd shine2mqtt
# Install dependencies (including dev dependencies)
uv sync
# Install pre-commit hooks
pre-commit install
Project Structure
shine2mqtt/
โโโ src/shine2mqtt/ # Main application code
โ โโโ growatt/ # Growatt protocol implementation
โ โ โโโ protocol/ # Protocol decoders/encoders
โ โ โโโ server/ # TCP server
โ โ โโโ client/ # Simulated client (testing)
โ โโโ mqtt/ # MQTT bridge
โ โโโ hass/ # Home Assistant discovery
โ โโโ api/ # REST API
โโโ tests/ # Test suite
โ โโโ unit/ # Unit tests
โ โโโ integration/ # Integration tests
โโโ docs/ # Documentation
Development Tools
The project uses modern Python development tools:
- UV - Fast dependency management and task running
- Ruff - Lightning-fast linting and formatting
- Pytest - Testing framework
- Ty - Type checking
- Pre-commit - Automated code quality checks
Running Tests
# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/unit/growatt/protocol/decoders/test_data_request_decoder.py
Code Quality
# Run linter (auto-fix)
uv run ruff check --fix src tests
# Format code
uv run ruff format src tests
# Type checking
uv run ty check src
# Run all pre-commit hooks
pre-commit run --all-files
Building
# Build wheel and sdist
uv build
# Build Docker image
docker build -t bremme/shine2mqtt:latest .
Running Locally
# Run application
uv run shine2mqtt
# Run with simulated client
# run shine2mqtt on different port (to prevent datalogger conflicts)
uv run shine2mqtt --server-port 4000
# run simulated client
uv run shine2mqtt --simulate-client --simulated-client-server-port 4000
๐ Resources
Related Projects
This project took inspiration from various other open-source Growatt projects:
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and code quality checks
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the GNU General Public License V3.0 - see the LICENSE file for details.
๐ Acknowledgments
- Johan Vromans for the excellent protocol documentation
- The Home Assistant community
- All contributors to related Growatt projects
โ ๏ธ Disclaimer: This project is not affiliated with or endorsed by Growatt. Use at your own risk.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shine2mqtt-0.0.1.tar.gz.
File metadata
- Download URL: shine2mqtt-0.0.1.tar.gz
- Upload date:
- Size: 3.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90ca8a6fcdc872d8f7c69ef494c577caf10280ebfedf77f644341258ff915c8c
|
|
| MD5 |
1a625a1e2f2613ebc3b56680db54793a
|
|
| BLAKE2b-256 |
2c19ff32f3f284cb5f2d616c6ee772a1b7ef4363908dcdda7ceb654fda4a9852
|
Provenance
The following attestation bundles were made for shine2mqtt-0.0.1.tar.gz:
Publisher:
release.yaml on bremme/shine2mqtt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shine2mqtt-0.0.1.tar.gz -
Subject digest:
90ca8a6fcdc872d8f7c69ef494c577caf10280ebfedf77f644341258ff915c8c - Sigstore transparency entry: 881769998
- Sigstore integration time:
-
Permalink:
bremme/shine2mqtt@1fca5e4056501d79c357a7e06444ca485b9b22a6 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/bremme
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@1fca5e4056501d79c357a7e06444ca485b9b22a6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file shine2mqtt-0.0.1-py3-none-any.whl.
File metadata
- Download URL: shine2mqtt-0.0.1-py3-none-any.whl
- Upload date:
- Size: 58.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5771b8087a67751edff8faf3e31ba3399a49c38c38427815c2374e5658574944
|
|
| MD5 |
4e3b202139cdf2a4dc9e38932d05cda3
|
|
| BLAKE2b-256 |
7079351fe17feff926470053ab840801c3339d2e7192cdea975bf81f55f827a5
|
Provenance
The following attestation bundles were made for shine2mqtt-0.0.1-py3-none-any.whl:
Publisher:
release.yaml on bremme/shine2mqtt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shine2mqtt-0.0.1-py3-none-any.whl -
Subject digest:
5771b8087a67751edff8faf3e31ba3399a49c38c38427815c2374e5658574944 - Sigstore transparency entry: 881770043
- Sigstore integration time:
-
Permalink:
bremme/shine2mqtt@1fca5e4056501d79c357a7e06444ca485b9b22a6 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/bremme
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@1fca5e4056501d79c357a7e06444ca485b9b22a6 -
Trigger Event:
push
-
Statement type: