pipp37/hms-mqtt-publisher2

By pipp37

Updated 3 months ago

Fetch telemetry infos from hoymiles HMS-XXXXW-2T micro-inverters and publish to a MQTT broker V2

Image
Networking
Message queues
0

315

pipp37/hms-mqtt-publisher2 repository overview

This image implements a tool that fetches the current telemetry information from the hoymiles HMS-XXXXW-T2 series of micro-inverters and publishes the data to a MQTT broker.

The code of the original application can be found here:
https://github.com/DennisOSRM/hms-mqtt-publisher

This is a fork of the main branch with changes from:
https://github.com/dc7kr/hms-mqtt-publisher
https://github.com/DennisOSRM/hms-mqtt-publisher/pull/94
which includes minimal usage of multiple inverters (changed serial number fix).

The code of this application is at: IN PROGRESS

https://github.com/pipp37/hms-mqtt-publisher2

Infos

Multiple inverter configurations are solved with one container for each device/dtu.
At a configurable intervall (min.30 seconds) the app pools the hoymiles inverter and publishes data homeassistant compatibel to an mqtt broker to the topic solar/.
Also with mqtt-simple the values are published to a configurable topic like hms/hms800wt2.

This works also if the inverter ist connected to the hoymiles-cloud if you pool them at a intervall greater then 30 seconds. In this example configs the intervall is set over 90 seconds.

The docker container runs on linux/amd64, linux/arm/v7 and linux/arm64 (for all raspberries)

One caveat: If you use the original image from the maintainer, the inverter serial function is changed. So you have to change all existing device configurations to the new device-id.
Look at the comment at:
https://github.com/DennisOSRM/hms-mqtt-publisher/pull/94#issuecomment-2234060369
The Hoymiles serial numbers are of the form:
DTU-SN: 4143 A23 12345
Mikro-SN: 1412 A23 12345

  • the first 4 digits are the model number
    • they differ between built-in DTUBI 4143 and
    • the bundled inverter HMS-WiFi Model 1412
  • next 3 digits are the year of production A being 2024 and 23 being the calendar week of manufacture
  • last 5 digits 12345 are the actual serial number of that week's production run for the model

Changes 4/26
  • Fix for hoymiles serial numbering: use 8 chars prefix instead of suffix.
  • Fix for mqtt-client-id connecting - add inverter_id and milisecond-timestamp to the connect strings. Multiple containers für more inverters are now possible.
  • Add configurable mqtt topic for simple-mqtt for multiple inverters.
  • All configurations are in environment variables now. No need to configure the extra config.toml. This file will be written from the entrypoint.sh .
  • Add inverter_serial to simple-mqtt output.
Setting the configuration

Set the following environment variables when executing:

  • INVERTER_HOST='ip-address hms-inverter'
  • MQTT_BROKER_HOST='ip-address mqtt broker'
  • MQTT_USERNAME='mqtt user'
  • MQTT_PASSWORD='mqtt pass'
  • MQTT_PORT='mqtt server port'
  • UPDATE_INTERVAL='90500 - 90,5sec hms-pooling'
    • new
  • INVERTER_ID='dtu1 - for multiple inverters'
  • MQTT_TOPIC='hms/hms800wt2 - topic for simple-mqtt'

Running the container
docker run -d \
  --name hms800a \
  --restart unless-stopped \
  -e INVERTER_HOST=xxx.xxx.xxx.xxx \
  -e INVERTER_ID=dtu1 \
  -e MQTT_BROKER_HOST=xxx.xxx.xxx.xxx \
  -e MQTT_USERNAME=user1 \
  -e MQTT_PASSWORD=pass1 \
  -e MQTT_PORT=1883 \
  -e UPDATE_INTERVAL=95500 \
  -e MQTT_TOPIC=hms/hms800wt2 \
  pipp37/hms-mqtt-publisher2
docker-compose.yaml for one inverter
version: '2'

services:
  hms-mqtt-1:
    image: pipp37/hms-mqtt-publisher2
    container_name: hms800wt2-1
    restart: unless-stopped

    # - no volumes needed - otherwise create empty config.toml file: touch config.toml
    #volumes:
    #  - ./config.toml:/config.toml

    environment:
       - INVERTER_HOST=xxx.xxx.xxx.xxx
         # new
       - INVERTER_ID=dtu1

       - MQTT_BROKER_HOST=xxx.xxx.xxx.xxx
       - MQTT_USERNAME=user1
       - MQTT_PASSWORD=pass1
       - MQTT_PORT=1883
       - UPDATE_INTERVAL=95500

         # new topic prefix for simple-mqtt - 'hms800wt2' if not set
       - MQTT_TOPIC=hms/hms800wt2
docker-compose.yaml for 2 inverters
version: '2'

services:
  hms-mqtt-1:
    image: pipp37/hms-mqtt-publisher2
    container_name: hms800wt2-1
    restart: unless-stopped

    # - no volumes needed - otherwise create empty config.toml file: touch config.toml
    #volumes:
    #  - ./config.toml:/config.toml

    environment:
       - INVERTER_HOST=xxx.xxx.xxx.xxx
         # new
       - INVERTER_ID=dtu1

       - MQTT_BROKER_HOST=xxx.xxx.xxx.xxx
       - MQTT_USERNAME=user1
       - MQTT_PASSWORD=pass1
       - MQTT_PORT=1883
       - UPDATE_INTERVAL=95500

         # new topic prefix for simple-mqtt - 'hms800wt2' if not set
       - MQTT_TOPIC=hms/hms800wt2

  hms-mqtt-2:
    image: pipp37/hms-mqtt-publisher2
    container_name: hms800wt2-2
    restart: unless-stopped

    # - no volumes needed - otherwise create empty config.toml file: touch config.toml
    #volumes:
    #  - ./config.toml:/config.toml

    environment:
       - INVERTER_HOST=xxx.xxx.xxx.xxx
         # new
       - INVERTER_ID=dtu2

       - MQTT_BROKER_HOST=xxx.xxx.xxx.xxx
       - MQTT_USERNAME=user2
       - MQTT_PASSWORD=pass2
       - MQTT_PORT=1883
       - UPDATE_INTERVAL=98500

         # new topic prefix for simple-mqtt - 'hms800wt2' if not set
       - MQTT_TOPIC=hms/hms800wt2
docker-compose output
docker-compose  -f docker-compose.yaml.example2inverters  up

Creating network "docker-infos_default" with the default driver
Creating hms800wt2-1 ... done
Creating hms800wt2-2 ... done
Attaching to hms800wt2-1, hms800wt2-2

hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] Running revision:
hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] loading configuration from /config.toml
hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] using non-default update interval of 95.50s
hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] inverter host: 192.168.128.194
hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] inverter id: dtu1
hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] Publishing to Home Assistant
hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish::rumqttc_wrapper] Client ID: hms-mqtt-publish-dtu1-ha-1776262235730
hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] Publishing to simple MQTT broker
hms800wt2-1   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish::rumqttc_wrapper] Client ID: hms-mqtt-publish-dtu1-sm-1776262235732
hms800wt2-1   | [2026-04-15T14:10:36Z INFO  hms2mqtt::inverter] Inverter is Online

hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] Running revision:
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] loading configuration from /config.toml
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] using non-default update interval of 98.50s
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] inverter host: 192.168.128.193
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] inverter id: dtu2
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] Publishing to Home Assistant
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish::rumqttc_wrapper] Client ID: hms-mqtt-publish-dtu2-ha-1776262235726
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish] Publishing to simple MQTT broker
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms_mqtt_publish::rumqttc_wrapper] Client ID: hms-mqtt-publish-dtu2-sm-1776262235728
hms800wt2-2   | [2026-04-15T14:10:35Z INFO  hms2mqtt::inverter] Inverter is Online

Tag summary

Content type

Image

Digest

sha256:d6dedbfff

Size

29.6 MB

Last updated

3 months ago

docker pull pipp37/hms-mqtt-publisher2:v0.5