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

Sensors entity_id's are localised #1373

Closed
alex3305 opened this issue Feb 23, 2021 · 11 comments · Fixed by #1552
Closed

Sensors entity_id's are localised #1373

alex3305 opened this issue Feb 23, 2021 · 11 comments · Fixed by #1552
Labels
bug Something isn't working

Comments

@alex3305
Copy link

Home Assistant Android version: 2021.2.2-full

Android version: 10

Phone model: OnePlus 7 Pro

Home Assistant version: 2021.2.3

Last working Home Assistant release (if known): n/a

Description of problem:

The generated entity_id's for the sensors are suddenly localized. This happened to me when I re-installed the app today. Since the sensor information screen within the app contain the unique id property, I think this is a bug. On another phone where I didn't reinstall, this behavior did not show itself. See below.

Screenshot of problem:

Re-installed phone:
image

Old phone:
image

Additional information:

@alex3305 alex3305 added the bug Something isn't working label Feb 23, 2021
@dshokouhi
Copy link
Member

You need to change the language on the device before adding new sensors, this is as designed. If you reinstall you need to make sure to change the language to what you expected. Your best bet is to remove integration, clear data in the app, log back in, change language. The battery sensors are the only one that default to your system language and need to be changed manually.

@alex3305
Copy link
Author

@dshokouhi Thanks for the quick response. FYI this also happens with other sensors, not only with the battery sensors. I've tested this with the next alarm.

Thanks for letting me know that I can easily change the entity name. What confuses me is the unique id within the app, which I expect to be the same as the entity id in Home Assistant, prefixed with the device name. Perhaps this assumption is wrong, but imho can be a bit confusing.

@septillion-git
Copy link

@dshokouhi
I would say that's pretty undesirable design... Most integrations just make English suffixed entities which is just way more convenient. It's already hard enough to let my girlfriend use the HA companion app with sensors but now I need to do a language limbo first because she likes local language and I like English, especially in the back-end of HA (or any system for that matter).

I would get it if the Friendly name were localized but the entity is pretty annoying 😞

@alex3305
Copy link
Author

@dshokouhi I really want to press this issue again. Like @septillion-git said this behaviour seems pretty undesirable. All other Home Assistant integrations use English, non-localized entity id's. Also having to implement Lovelace dashboards and automations based on user preferences is just very counter intuitive.

Furthermore setting the app to English will also generate localized id's, which would be a bug if I'm not mistaken.

@dshokouhi
Copy link
Member

@alex3305 and @septillion-git I understand your guys frustration we had other language issues in the past. What I meant as "by design" is that this is how Android works. Any application when first launched defaults to the system language if the app provides translations or it falls back to English. This is just the way android works. We get requests often from users to add more and more languages for translations so its clear that users do indeed want to see the app as translated as possible. We had a few requests from users about how they were not happy with how they cannot change the app language. A contributer came by and added the language field that you see today in App Configuration. This was designed to help alleviate the situation. If you are unhappy with the sensor ID's Home Assistant offers the entity registry for this very purpose. To rename things as you see fit.

@septillion-git
Copy link

@dshokouhi I do get a lot of users want to see the app in there own language. (Although, as a Dutch it's very common to use English.) To have the option to have the app translated is a good thing! But this does not apply to the entity id's. It's not in line with any other integration to have localized entity id's. So I guess what @alex3305 and I ask is not to have no translation, but to only translate the app and friendly names but please, leave the entity id's for the back-end just in English just like any other integration.

@dshokouhi
Copy link
Member

@septillion-git actually a lot of integrations grab the device name from the product itself which can be localized or not, it depends on the integration. You just may not be using an integration that lets the user name things as they see fit. The mobile app integration does not separate the friendly name from entity ID either so that is not unique to this app. If you guys do not like the entity ID's supplied you can simply change them using the Entity Registry. It was created for this very purpose.

@septillion-git
Copy link

@dshokouhi Device name, sure. But sensor suffix is very very very rare.

Yeah, we can change it but I think this is undesirable behaviour altogether. You will now always end up with a annoying mix as sensor domains are never translated.

@skynetua
Copy link
Contributor

skynetua commented Mar 9, 2021

@dshokouhi I believe we can fix this by adding code to apply locale to application class on starting as well as we do it for activities in baseActivity class. Unfortunately I don't have configured environment to check and fix it right now.

@alex3305
Copy link
Author

alex3305 commented Mar 16, 2021

[...] actually a lot of integrations grab the device name from the product itself which can be localized or not, it depends on the integration. You just may not be using an integration that lets the user name things as they see fit.

I was still thinking about this especially and you're right about this. However in my experience these integrations also provides the user with entity or device naming capabilities. Which the mobile app integration does not. When I look at some my integrations I see the following:

  • AdGuard Home
    Web interface and application is fully localized, entities are English
  • Brother
    Web interface and device LCD is completely localized, entities are English
  • deCONZ
    Devices and entities use the names I have provided when setting up (which are English)
  • NZBGet
    Web interface is English, entities are English
  • Sonarr
    Web interface is fully localized, entities are English

Within the mobile app I cannot customize the entity names to be in English. Unlike deCONZ where I can do that. Based on the other integration I have, I think the mobile app should generate English entity id's. Perhaps with a localized friendly name like the one displayed within the app.

Quick edit: Can this issue be re-opened?

@dshokouhi
Copy link
Member

So we had a brief discussion about this between the other companion apps. For the companion apps we will be sending entity ID and friendly name in English only so that it will match our documentation and to follow suit with the iOS app. We will still show the translations in the app so the interface will remain translated, this is purely for the data we send back to HA. So we will not be using the language picker to determine the entity ID names in this instance, we will just force English as the sensor name being sent to HA. This is not coming from a core requirement and HA does not explicitly mention English has to be used as we have integrations that are region specific, this is just for the companion apps.

Reopening while we get a PR ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants