MQTT Bridge
The MQTT bridge publishes every entity to a broker as retained topics, subscribes to write topics for writable entities, and reports availability via a Last-Will message. Like every other surface, the topic set is generated from the active inverter’s manifest.
Enabling
Section titled “Enabling”Configure MQTT from Settings → MQTT & Home Assistant (recommended), or
seed it from environment variables (MQTT_ENABLED,
MQTT_BROKER_URL, MQTT_TOPIC_PREFIX, MQTT_USERNAME, MQTT_PASSWORD).
Enabling, disabling, or changing the config takes effect live — the bridge is rebuilt without a restart. The Settings tab has a Test connection button and a live status badge.
Topic layout
Section titled “Topic layout”All topics are rooted at <prefix>/<inverterId>, where prefix defaults to sunreye and
inverterId is the active profile’s id.
| Topic | Direction | Retained | Payload |
|---|---|---|---|
<prefix>/<inverterId>/<topic> |
publish (state) | ✅ | The entity’s value as a string. |
<prefix>/<inverterId>/<topic>/set |
subscribe (write) | — | A numeric value to write. |
<prefix>/<inverterId>/status |
publish (availability) | ✅ | online / offline. |
<topic> is each entity’s manifest topic (a /-separated suffix). State is published only
while connected — stale samples are not queued.
Writes
Section titled “Writes”Only writable entities get a .../set command topic. When a message arrives:
- The payload is parsed as a number (
NaNis rejected and logged). - The value is validated against the entity’s constraint (range or enum) — the same validation used by the REST API and the dashboard.
- On success the write is pushed to the inverter; invalid writes are dropped with a warning.
Example (publish a new max charge current):
mosquitto_pub -t 'sunreye/deye-sg05lp3/settings/battery/max_charge_current/set' -m '40'Availability (Last-Will)
Section titled “Availability (Last-Will)”- On connect, the bridge publishes
online(retained) to<prefix>/<inverterId>/status. - A broker-registered Last-Will publishes
offline(retained) if the connection drops. - On graceful shutdown it publishes
offlinebefore disconnecting.
Home Assistant uses this topic for entity availability.
Home Assistant
Section titled “Home Assistant”When Home Assistant discovery is enabled, the bridge also publishes MQTT Discovery configs so SunReye auto-populates in Home Assistant. See Home Assistant.