HMS-XXXXW-2T publisher

Overview

hms-mqtt-publisher

This tool fetches the current telemetry information from the HMS-XXXXW-T2 series of micro-inverters and publishes the information into an MQTT broker. Please note that it doesn’t implement a DTU, but pulls the information off the internal DTU of these inverters.

How to run

The tool is distributed as source only — for now. You’ll have to download, compile and run it yourself.

$ git clone https://github.com/DennisOSRM/hms-mqtt-publisher.git
$ cd hms-mqtt-publisher
$ cargo r --release [inverter] [mqtt broker] [mqtt user] [mqtt password] [optional:mqtt port]

image

Docker

The latest release is directly deployable via a docker image from DockerHub. It is built automatically for the following Linux platforms:

  • amd64,
  • arm/v7,
  • and arm64.

The parameters to access the inverter and MQTT instance are pulled from environment variables:

  • $INVERTER_HOST
  • $MQTT_BROKER_HOST
  • $MQTT_USERNAME (optional)
  • $MQTT_PASSWORD (optional)
  • $MQTT_PORT (optional)

Note of caution

Please note: The tool does not come with any guarantees and if by chance you fry your inverter with a funny series of bits, you are on your own. That being said, no inverters have been harmed during development.

Known limitations

  • One can only fetch updates approximately twice per minute. The inverter firmware seems to implement a mandatory wait period of a little more than 30 seconds. If one makes a request within 30 seconds of the previous one, then the inverter will reply with the previous reading and restart the countdown. It will also not send updated values to S-Miles Cloud if this happens.
  • The tool is a CLI tool and not a background service.
  • The tools was developed for (and with an) HMS-800W-T2. It may work with the other inverters from the series, but is untested at the time of writing
Comments
  • Auto-publish docker images for several platforms

    Auto-publish docker images for several platforms

    As mentioned first here: https://github.com/lumapu/ahoy/issues/1189#issuecomment-1793503475

    • [x] merge #13
    • [x] create credentials for Dockerhub
    • [x] set up auto-deployment via a GitHub action
    enhancement 
    opened by DennisOSRM 8
  • Home Assistant Add-on

    Home Assistant Add-on

    This PR adds home assistant add-on support. It is functional, but still a work in progress.

    Adresses https://github.com/DennisOSRM/hms-mqtt-publisher/issues/17

    Todo:

    • update URLs in repository.json and config.yaml
    • publish data with home assistant discovery support (separate PR for this?)
    • get mqtt user, pw via bashio
    • ? (Happy to accept feedback)
    opened by dominikandreas 4
  • Set MQTT Port as a Configurable Parameter

    Set MQTT Port as a Configurable Parameter

    Hello,

    I've noticed that the MQTT port is currently hardcoded in the application. For improved flexibility and to accommodate various deployment environments, it would be beneficial to have the MQTT port settable through a configuration parameter.

    Thanks

    enhancement 
    opened by ringelbaer 1
  • Feature: Auto publish docker image to docker hub

    Feature: Auto publish docker image to docker hub

    This branch adds the function to automatically create multi-platform images and transfer them to Docker Hub. It uses the git hub action for this. You only need to set the following secrets in git hub:

    DOCKER_HUB_USER
    DOCKER_HUB_PASS
    DOCKER_HUB_NAMESPACE
    DOCKER_HUB_REPOSITORY 
    

    The action is triggered by the creation of a release in git hub. It uses the release version to publish it in Docker Hub. The latest version is also automatically set to this new version.

    Resolve DennisOSRM/hms-mqtt-publisher#6

    opened by InScene 0
  • feat: add Dockerfile

    feat: add Dockerfile

    The Dockerfile has been added to create a Docker image. Use the following command to do this and push it to docker hub: docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t <your docker hub id>/hms-mqtt-publisher:<version> --push .

    opened by InScene 0
  • Feature/ha discovery

    Feature/ha discovery

    This is a work in progress, but wanted to get some early feedback. The main contributions of this PR are:

    • Implemented support for home assistant discovery (https://github.com/DennisOSRM/hms-mqtt-publisher/issues/17)
    • Add extra sensors (https://github.com/DennisOSRM/hms-mqtt-publisher/issues/14)

    Other notable changes / additions:

    • added vscode devcontainer support and debug launch configuration to simplify development for future contributors
    • add serde dependency for json serialization
    • version bump to 0.2.0 because of breaking changes (mqtt paths change)
    • refactor log init into its own module
    • add mock_state function to inverter for testing purposes

    Note that this is my first time developing in rust and there's probably a lot of things to improve / things that an experienced rust developer would've probably done differently. I'm happy to receive some constructive feedback and improve where necessary :-)

    TODO:

    • update home assistant addon once PR is merged / docker build is ready
    • make home assistant prefix configurable (https://github.com/DennisOSRM/hms-mqtt-publisher/issues/25)
    opened by dominikandreas 1
  • Support home assistant auto-discovery

    Support home assistant auto-discovery

    As mentioned in #17, the tool should support auto discovery in a home assistant setup. This is achieved by publishing a certain topic to MQTT. More details:

    enhancement 
    opened by DennisOSRM 0
  • Question: Power Adjustments

    Question: Power Adjustments

    Hi, just tested this library and it works great! But I do have a question: Is there a possibility to configure the power ratio? I saw that you're working with a TCP connection to read values from the DTU and I was wondering if it's also possible to adjust the maxmimum generated power through this connection. I was planning to handle this automatically but I'm currently struggling to set it up.

    Thanks for your work!

    question 
    opened by jogybaer0815 2
  • Add testing for home assistant addon

    Add testing for home assistant addon

    As surfaced in PR20:

    Maybe long term we can also come up with some means of automatic testing. For this we would need:

    a docker service emulating a HMS a docker service running an mqtt server a docker service running some tests and validates mqtt messages against some predefined schema Such a test framework would of course also be useful for testing the rest of the codebase

    enhancement 
    opened by DennisOSRM 0
  • Home Assistant Addon

    Home Assistant Addon

    I would like to run this application directly within home assistant as an addon. I do have a little experience with writing addons and think it shouldn't be too complicated. Has someone already started with that? Does it make sense to have a separate repository for the home assistant addon or directly create a PR for this one?

    Great work btw, I really appreciate it!

    opened by dominikandreas 10
Releases(v0.1)
  • v0.1(Nov 5, 2023)

    This is the initial release that publishes live performance data every 30+ seconds to MQTT.

    What's Changed

    • Make tool less chatty in case inverter is unreachable by @DennisOSRM in https://github.com/DennisOSRM/hms-mqtt-publisher/pull/1
    • Fix tool and project name by @DennisOSRM in https://github.com/DennisOSRM/hms-mqtt-publisher/pull/2
    • Refactor main.rs into a set of structs by @DennisOSRM in https://github.com/DennisOSRM/hms-mqtt-publisher/pull/10
    • Feature: Auto publish docker image to docker hub by @InScene in https://github.com/DennisOSRM/hms-mqtt-publisher/pull/13

    New Contributors

    • @DennisOSRM made their first contribution in https://github.com/DennisOSRM/hms-mqtt-publisher/pull/1
    • @InScene made their first contribution in https://github.com/DennisOSRM/hms-mqtt-publisher/pull/13

    Full Changelog: https://github.com/DennisOSRM/hms-mqtt-publisher/commits/v0.1

    Source code(tar.gz)
    Source code(zip)
Owner
Dennis Luxen
Algorithms and data structures at heart.
Dennis Luxen