Open dc7kr opened 7 months ago
Thanks so much for the submission
Seems this requires an additional fix:
error[E0063]: missing field `client_id` in initializer of `MqttConfig`
--> tests/integration_tests.rs:48:10
|
48 | &MqttConfig {
| ^^^^^^^^^^ missing `client_id`
For more information about this error, try `rustc --explain E0063`.
error: could not compile `hms-mqtt-publish` (test "integration_tests") due to 1 previous error
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
Any update on the review? There are two issues open (#115 and #111) that would be resolved by this PR...
@DennisOSRM pinging for #127 being an other duplicate request for the same feature.
@dc7kr the Hoymiles serial numbers are of the form
DTU-SN: 4143 A23 12345
Mikro-SN: 1412 A23 12345
4143
and1412
A
being 2024 and 23
being the calendar week of manufacture12345
are the actual serial number of that week's production run for the modelSee e.g. here https://github.com/tbnobody/OpenDTU/issues/714
@DennisOSRM BTW would you like to join us on Discord, we could add another channel for #hms-mqtt-publisher and ask DanielR92 to grab the github updates too ;)
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