-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Add language selection for entity naming in WolfLink #126764
base: dev
Are you sure you want to change the base?
Conversation
Hey there @adamkrol93, @mtielen, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexdev03 Thanks for making it more international. I think it would be better to use LANGUAGE as users know what it is I don't think they know what to fill in at LOCALE
Will the locale also affect the entity state values in Home Assistant? |
Yes, previously they were in german |
We've previously declined other integrations from changing the language of returned values from API. One reason is that it breaks automations. I'll take it up with the Core team. If there are any mitigating factors that we should take with us when discussing this, you're welcome to explain the situation further. Thanks! |
This also not correct the currently they translate to English using HA Language system. See here a screenshot of the current productive version of the integration in English and in German: |
Sorry I misunderstood, states are not translated with the api. |
Thanks @alexdev03 Yes I just tested it with using Italian and can confirm states don't get translated via the api only the entities created: Btw I think at the login to Wolf I still think we should call it language instead of Locale as it for a basic user I think not self explaining |
Yes I'm fixing conversations right now. |
Great only problem I see with the new group feature is duplicated entities which are listed in Wolf's API on different places but they are the same sensor. This is why in the past we only took one if they had the same name. In my case it's 6 duplicate entities. |
Could you give me some examples please? |
I prefer duplicate values instead of missing values. Maybe I could do a check somewhere in Wolf-Comm and prevent the problem. |
You are actually missing more value's if you look into responds json-structure. Much more data available of your system is available then what currently is included via the lib as it only is focused on user heating systems values You technically have the full admin values etc also available to you but they are filtered out as they are in a different part of the json. I guess it would be good to make sure we don't get duplicates from the lib as some systems have lot of parameters. |
I should have fixed the duplicate problem directly in wolf-link, I think we could keep the fix here in wolf-link and also it would be better to fix that also in wolf-comm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @alexdev03 looks good for me. Let's see what the HA core team says. I've tested it with my system and works.
Nice. MOCK_RESPONSE is an example of this https://www.wolf-smartset.com/js/localized-text/text.culture.en.js just with only a few values. |
@home-assistant rename Add language selection for entity naming in WolfLink |
Yeah their API is terrible specially with all the numbers etc and the mapping is even worse. I am working on option to writevalues back but it's a lot of debugging. This way we can introduce switches etc. Btw you can probably put this pull request into Open because it's currently in draft and doesn't change the values so it will not break automations. |
We want entity names and entity_ids to be translated using the Home Assistant translation system. https://developers.home-assistant.io/docs/core/entity#entity-naming What's the point of allowing the user to set a language for the integration with this in mind? |
I understand the wish from a HA point of view. In this case I don't think it would every be practical or work well. |
We only need to translate the existing entity names. |
This pr not only translates entities but also allows to have entities with the same name but different group. For example with the previous system If I had 2 heat pumps I could only see the power consumption of a single heat machine since the name was equal. Now the name is not equal since it's formed by the group, in this case, heat pump 1 or heat pump 2, and then the entire name would be heat pump 1 power consumption and heat pump 2 power consumption. This pr fixes 2 problems, and can't be divided. Previous systems are not compatible since entity names don't start with the entity group. So it's not possible to just "translate the existing entity names". I understand that the best thing would be to have locales in a json file, but that would be too complicated. Wolf has 30 locales and each locale file weight like 450kb, that would mean that this integration would need to handle 13MB of locales. I think that is too much work and as mtielen said, that is a practical solution. |
The entities are not fixed as they are based on the system configuration of the heating setup Like on 1 or more pumps, solar or no solar, oil, gas, heatpump and the connected optional components and sensor which are installed. The API returns these values based on the system and this is how the entities then are created. |
I don't believe we'll accept this PR but I'll check with the core team. |
It's sad to hear that if that would be the case. It's a practical solution for a small integration like this one. But if this is the core team decision then so be it. |
Breaking change
This pr uses the new locale system of wolf-comm 0.0.10, so it's recommended to reinstall the integration
Proposed change
A new locale input parameter is now asked when logging in into the integration, it can be something like (en, es, de, it, etc)
The locale format doesn't follow a common standard for locales, it uses Wolf's website language system.
Entities names are now also translated based on the locale.
If there are 2 entities with the same name but different group. now both of them will be loaded. Previously only one of them was loaded.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: