-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use suffix instead of prefix of serial number for topic / Multiple Inverter Support #94
base: main
Are you sure you want to change the base?
Conversation
When trying to use more than one inverter on the same mqtt host the previous implementation causes a topic clash as the serial numbers share a common prefix. This change uses the last 8 digits instead of the first for the topic (and whenever the shortened SN is used)
running two instances of hms-mqtt-publish with the hardcoded client_id causes conflicts and high cpu load. This makes the client_id optionally configurable
Thanks so much for the submission |
Seems this requires an additional fix:
|
Unfortunately this is a breaking change for existing users, as it will change the unique IDs of the sensors in home assistant (so effectively introduce new sensors instead). Changing the lovelace UI elements and other references is relatively easy, but afaik the energy dashboard history would be lost after switching to the new sensor id. We could solve this dilemma by introducing a mapping from serial number to a custom string as a configuration option in the home assistant addon to be used in the client id and unique identifier of the sensors, or just live with the breaking change for the sake of simplicity. Let me know what you think |
@DennisOSRM pinging for #127 being an other duplicate request for the same feature. |
@dc7kr the Hoymiles serial numbers are of the form DTU-SN:
See e.g. here tbnobody/OpenDTU#714 |
@DennisOSRM BTW would you like to join us on Discord, |
The current implementation uses the first 8 digits of the serial as an mqtt topic. If you manage more than one device with the same MQTT broker this causes a topic collision as the serials share a common prefix.
Running two instances in parallel causes disconnects on MQTT due to the hardcoded client_id. This also introduces a configurable client_id
This PR uses the last 8 digits instead for the topic to make it unique.
cargo clippy
and fix all issuescargo fmt
to format all source files