Achronite / mqtt-energenie-ener314rt

MQTT interface for Energenie ENER314-RT add-on board for the Raspberry Pi, designed for use by Home Assistant.
MIT License
13 stars 5 forks source link

Enhancement: Include OEM Part Number and Device ID in MQTT Discovery Message #57

Closed genestealer closed 9 months ago

genestealer commented 10 months ago

Inclusion of OEM Part Number in Device JSON Files: I've implemented a modification to include the OEM Part Number in the device JSON files. This enhancement aims to provide comprehensive information about each device, aiding in identification within the system.

JSON Beautification for Future Collaborations: In conjunction with these changes, I've applied a JSON beautifier to the device JSON files. This step ensures enhanced readability and facilitates easier implementation of one-line changes in future collaborations.

Appending Device ID and Part Number to MQTT Discovery Message: I've extended the functionality by appending both the Device ID and OEM Part Number to the Device Model field in the MQTT discovery message. Previously, the Device ID was included only in the Name, but this information was lost if the user decided to rename the device. This adjustment ensures that identification details persist even if the user chooses to customize the device name.

Consideration for Google Assistant Interaction: I have a preference for being aware of the Device ID for my devices, especially as I physically label them. However, I aim to avoid the Device ID becoming a part of the Device "Name." This is crucial to prevent complications when interacting with Google Assistant, as it may read out the Device ID in a long format, such as "fifty-two thousand and twenty-three," along with the custom name. Such instances can lead to less user-friendly interactions.

With the new implementation, the Device ID and Part Number are integrated into the Model details in Home Assistant. This allows me to maintain visibility of this information while customizing the device name. For instance, I can rename a device from "dehumidifier 5223" to simply "dehumidifier."

Achronite commented 10 months ago

Can you give an example of how this now looks in HA (before any manual edits) please?

(merging on my test pi may be tricky until I finish helping get the thermostat working)

genestealer commented 10 months ago

Can you give an example of how this now looks in HA (before any manual edits) please?

(merging on my test pi may be tricky until I finish helping get the thermostat working)

Merging on your test pi should be fine, as this fork is up-to-date with your development branch and includes the thermostat mod.

Absolutely image

As discovered, before user rename (for friendlier name): image image

Note, I choose in this case to not rename the entity IDs of the child entities, as real power and frequency are already used in a "Integration - Riemann sum integral" for calculating energy consumption, and renaming the child entity IDs would mean I would have to edit the Riemann sum integral. image image image

genestealer commented 10 months ago

Some extra photos: image

Note the entity ID is unchanged, in this example. But for most people they would say yes and auto-rename all the entity ID's. image

Achronite commented 10 months ago

I quite like this idea. Did you check if we can use serial_number for this e.g MIHO002-1234 ?

Also, it's going to be tricky merging 18.json (still ongoing!), Can you pull and re-submit? (I've pretty printed this one already for you).

genestealer commented 10 months ago

serial_number

Thank you, yes I can remove 18.json to make it a cleaner merge.

Can you clarify your question on serial_number? The current proposed change shows it as Radiator (MIHO013) [4329]

image

Achronite commented 10 months ago

Can you clarify your question on serial_number? The current proposed change shows it as Radiator (MIHO013) [4329]

Your proposed change adds the device address to the 'model' property; which is really designed to store the generic model details of the device. serial_number can be used to identify the different devices for that model in the device registry; but it isn't listed in the MQTT discovery manual; so I'm not entirely sure we can use it... I was wondering if you have tried?

genestealer commented 10 months ago

Can you clarify your question on serial_number? The current proposed change shows it as Radiator (MIHO013) [4329]

Your proposed change adds the device address to the 'model' property; which is really designed to store the generic model details of the device. serial_number can be used to identify the different devices for that model in the device registry; but it isn't listed in the MQTT discovery manual; so I'm not entirely sure we can use it... I was wondering if you have tried?

Oh, I did not know about that, not sure the serial number would show up on the GUI. I will have to give it a try on the MQTT discovery.

Out of interested, I tried it on the Manually configured MQTT entities, and it gave an error.

image

Achronite commented 10 months ago

Out of interested, I tried it on the Manually configured MQTT entities, and it gave an error.

OK, it's unlikely to work in the current version of MQTT discovery then.

BTW: I'm still seeing conflicts for 18.json

genestealer commented 10 months ago

OK, it's unlikely to work in the current version of MQTT discovery then.

BTW: I'm still seeing conflicts for 18.json

Tested it also with MQTT discovery, with no joy

image

Achronite commented 10 months ago

Tested it also with MQTT discovery, with no joy

OK no problems. If you get the conflict resolved on 18.json (maybe try downloading the latest version), then I'll merge it.

image

genestealer commented 9 months ago

@Achronite Updated and ready for your review.