kodebach / hacs-idm-heatpump

HACS integration for IDM heat pumps
MIT License
26 stars 2 forks source link

Inconsistent enum names in integration #137

Closed AndyNew2 closed 2 months ago

AndyNew2 commented 2 months ago

As all enumeration definition in this integration inherits the name from the definition and the definition are done in capital characters, for writing, upper case enum values are expected. Due to an other definition in const.py, all enum outputs are converted to lower case. This is confusing and inconsistent. I don't mind, if it is upper or lower case, but it should match from reading to writing. I just noticed an automatic HA conversion from "off" to "Aus" in German is broken, when changing "off" to "OFF". No idea if this is important.

An easy change chould be in const.py:

Line 21. remove the name.lower() and just assign name

Later on in the enum definitions:

Change all OFF definition to lower case off definition to keep the HA automatic conversion or keep the capital OFF and have consistent enum meanings in HA.

kodebach commented 2 months ago

The enum values are translated to lower case, because Home Assistant mostly uses lower case value and as you noticed even provides translations for some common values (other values could maybe be translated be the integration but I haven't looked into it).

However, even if the value visible in the UI is translated you always need to use the original value in services and scripts. With 0.9.0-beta.7 the enums all accept any casing ("off", "OFF" and even "oFf").

AndyNew2 commented 2 months ago

Yes that seems reasonable. Good approach.

AndyNew2 commented 2 months ago

Ah and yes issue can be closed with beta7, just tried.