Skip to content
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

Inconsistent enum names in integration #137

Closed
AndyNew2 opened this issue Sep 11, 2024 · 3 comments
Closed

Inconsistent enum names in integration #137

AndyNew2 opened this issue Sep 11, 2024 · 3 comments

Comments

@AndyNew2
Copy link

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
Copy link
Owner

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
Copy link
Author

Yes that seems reasonable. Good approach.

@AndyNew2
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants