spacemanspiff2007 / SmlLib

A library for the SML (Smart Message Language) protocol
GNU General Public License v3.0
27 stars 9 forks source link

Add more OBIS descriptions #17

Closed pvogt09 closed 8 months ago

pvogt09 commented 11 months ago

This PR adds most of the OBIS descriptions from https://www.promotic.eu/en/pmdoc/Subsystems/Comm/PmDrivers/IEC62056_OBIS.htm and corrects some descriptions.

spacemanspiff2007 commented 8 months ago

I've had to fix some type hints and during this I added the german translations. Imho it's not very nice to mix languages so I chose that way.

Do you still think it would make sense to add the more exotic (imho) obis fields in English?

pvogt09 commented 8 months ago

I think it would make more sense to have everything in English because error messages and code in the library are international as well. It would be nice to have the German translations in some kind of language file, but I don't know enough about Python and how internalization can be achieved with it to come up with a good solution for that, maybe gettext is a way to go. I just translated the ones that were already there or variants of them to not break too much in existing code in case somebody relies on the translations. Mixing is probably not a good solution, that is true.

Adding all the possible ones should be the way to go because somebody might come across them while using the library and wonder why it fails to give a name at all. I didn't come across any of the more specific ones with the meter I am using the library with though. Eventually then the OBIS codes for caloric energy should be added as well, but I don't know whether caloric energy meters using the SML protocol even exist.

spacemanspiff2007 commented 8 months ago

I'm aware of the conflict between English error messages / object and function names and the German detail description. It's not great but I chose it that way because SML is a German standard developed by the BSI. So the users of this library will be mostly from Germany, thus German detail description. I'm happy with adding English descriptions, but I would just go the easy route and add a second dict with descriptions and make it possible so the user can switch between German and English. 😆

I agree that adding all possible descriptions should be the goal or even better: programmatically building the name from the OBIS code. But tbh - I don't think it's worth the time and effort. But If you want to provide a PR (for programmatically building the name or adding more descriptions) I'll gladly review it. Until then I'll close this PR.

Thank you for your contributions.