lovelace-xiaomi-vacuum-card icon indicating copy to clipboard operation
lovelace-xiaomi-vacuum-card copied to clipboard

Feature Request: Translation of values

Open kefdk opened this issue 3 years ago • 3 comments

Hi,

First of all, thank you for your great card. I have two Roombas, and we are using this card to handle them.

Previously I created my own local version of your card to handle attributes from a custom sensors instead of from the vacuum-entity, but since I don't want to make sure my custom-card based on your card is working after an update, I would like to use your standard custom-card instead.

I would really like that the card could handle translation of values, for example that "Charging" could be translated into (in this case Danish) "Oplader".

My solution on my own card was to have a template sensor with attributes, that I used instead of the attribute or state from the vacuum-entity.

It would give a huge amount of possibility to this card. For example the "Full Bin: Yes/No" could be changed to: "Beholder: Fuld" if you wanted that instead, or as I did; set the State-text to "Tøm beholder" / "Empty bin".

Using a template sensor for this would also give you the possibility of adding conditions to some of the states, for example "Charging" would not say "Charging" when battery is 100%, instead it would say "Ready", unless the bin is full, then it would say "Empty bin".

Giving the card these possibilities would make it extremely flexible towards usage. I don't have the "great idea" on how to solve it code-wise and still have the 100% respect of the main features of the current card. Thats why I didn't make a PR.

Have a great day!

Best regards,

Kristian

kefdk avatar Jan 02 '21 09:01 kefdk

Great suggestion, however I think this involves a lot of changes and special handling just to "translate" all the different values possible from the different vacuum integrations. I thought about adding the localisation handling from HA, but I don't think even that has the translation values for every vacuum integration (I might be wrong).

The labels (i.e. Full Bin) can be customised already with label: 'Beholder: '. See the examples.

Would gladly take a PR on this, but at the moment I don't think I have the time to put into solving this. I'll keep it open, maybe I (or someone) find the time to do it at some point.

benct avatar Mar 12 '21 23:03 benct

Hello, For the vacuum state, with my Dreame D9 I had to go this way :

state:
  status:
    key: state

And it shows the raw value ("docked"), while in HA it shows "Sur la base" (french translation) Is there a way to retrieve this value instead of the raw state ? Maybe some kind of template syntax like custom sensors in HA ?

LittleBigDev avatar Dec 04 '21 00:12 LittleBigDev

I experienced the same issue. The native HA card shows translated state, so I guess the translation is somewhere available. image

jaid33 avatar Nov 24 '22 17:11 jaid33