Tasshack / dreame-vacuum

Home Assistant integration for Dreame robot vacuums with map support
https://community.home-assistant.io/t/custom-component-dreame-vacuum
MIT License
898 stars 113 forks source link

Translation for Default Rooms #608

Closed jimjaeger closed 5 months ago

jimjaeger commented 5 months ago

Is your feature request related to a problem? Please describe. The dreame app provides default rooms and custom rooms. The default rooms are translated in the app but not in the integration. I am happy to provide the translation values and I already looked if it is easy to add. But it looks like rooms are handled differently than other translated attributes.

Describe the solution you'd like

Add any other context or screenshots about the feature request here. image Home Assistant History image App Screenshots Screenshot_20240623_185920_Dreamehome Screenshot_20240623_185837_Dreamehome

Tasshack commented 5 months ago

Translation files only used by the frontend but entity names should be handled from backend which doesn't know your selected language. It is not possible without doing so much work that I don't have time for but you can set custom names to your rooms in your language easily from the app.

jimjaeger commented 5 months ago

Hello, thanks for the response. I am not sure if I understand the difference between can be translated and not.

Attributes like status or cleangenius or cleaning_mode area are sensor values, base values are provided from dreame and supported with integration translation. The value from Current Room is a sensor, default values are provided but they are not translated yet. They are hardcoded as fixed values (https://github.com/Tasshack/dreame-vacuum/blob/fe3133384e14b0d9b2da6cca2c794d1507a39f98/custom_components/dreame_vacuum/dreame/types.py#L10)

image image

Can you explain the difference? If you show how to add, I could provide a PR.

Tasshack commented 5 months ago

Room names are not just sensor values to indicate a status but also used in the backend rendering of the map and generating entity names therefore cannot be translated from frontend. To a value to be translated it must be a static value but room names are dynanic and not just consits of its type name. For example; if you set same type to multiple rooms, their names will contain also index like Living Room and Living Room 2. And if you don't set a type or custom name to a room its name will consits nothing but its id like Room 18.

It's much more complicated then you think so please trust me when I say it is not possible/too time consuming.

Tasshack commented 5 months ago

https://github.com/Tasshack/dreame-vacuum/blob/fe3133384e14b0d9b2da6cca2c794d1507a39f98/custom_components/dreame_vacuum/dreame/types.py#L982