Fockaert / rika-firenet-custom-component

MIT License
20 stars 17 forks source link

Multi language support for stove status #5

Closed Fockaert closed 3 years ago

Fockaert commented 3 years ago

Currently the stove status is only returned hardcoded in Dutch. Support multiple languages.

Antoine1-byte commented 3 years ago

Hello,

Here is what I have translated so far.

 if frostStarted:
            return ["/images/status/Visu_Freeze.svg", "Vorstbeveiliging"]

        if mainState == 1:
            if subState == 0:
                return ["/images/status/Visu_Off.svg", "Poêle éteint"]
            elif subState == 1:
                return ["/images/status/Visu_Standby.svg", "En veille"]
            elif subState == 2:
                return ["/images/status/Visu_Standby.svg", "Extern contact"]
            elif subState == 3:
                return ["/images/status/Visu_Standby.svg", "En veille"]
            return ["/images/status/Visu_Off.svg", "Substate onbekend"]
        elif mainState == 2:
            return ["/images/status/Visu_Ignition.svg", "Allumage"]
        elif mainState == 3:
            return ["/images/status/Visu_Ignition.svg", "Démarrage"]
        elif mainState == 4:
            return ["/images/status/Visu_Control.svg", "Contrôle"]
        elif mainState == 5:
            if subState == 3 or subState == 4:
                return ["/images/status/Visu_Clean.svg", "Nettoyage approfondi"]
            else:
                return ["/images/status/Visu_Clean.svg", "Nettoyage"]
        elif mainState == 6:
            return ["/images/status/Visu_BurnOff.svg", "Fin de combustion"]
        elif mainState == 11 or mainState == 13 or mainState == 14 or mainState == 16 or mainState == 17 or mainState == 50:
            return ["/images/status/Visu_SpliLog.svg", "Hout check"]
        elif mainState == 20 or mainState == 21:
            return ["/images/status/Visu_SpliLog.svg", "Regeling Hout"]

        return ["/images/status/Visu_Off.svg", "Onbekend"]

I haven't faced yet all the different status so I haven't yet translated everything. If I face a new lessage I'll update this

Regards,

Fockaert commented 3 years ago

@Antoine1-byte I've added support for 4 stove state translations, please check it out whether it works as expected.

Antoine1-byte commented 3 years ago

image image

@Fockaert I did the update and checked the result. It looks like when using an entity card in Lovelace, the translation is done properly but when using the custom card 'simple-thermostat' the translation is not done and language stays in English.

Regarding the French language: -'Baking' shall be 'Contrôle' (or at least this is what I have on mine) -I try to generate the missing ones (not so cold at the moment so the tank is not yet empty'

Antoine1-byte commented 3 years ago

image

In addition to my previous feedback, it looks like sometime the translation is done, and sometimes not

Fockaert commented 3 years ago

The translation is not applied every time, no idea what's the root cause for this.

For the simple thermostat component, I see no translation is applied at all based on your screenshots, how did you configure this component on the UI?

Antoine1-byte commented 3 years ago

@Fockaert Hi

Regarding simple thermostat: I installed the custom card through HACS.

Piece of code in yaml:

type: 'custom:simple-thermostat'
entity: climate.rika_domo
step_size: 1
step_layout: row
name: true
icon: false
control:
  _headings: false
  hvac:
    auto:
      name: Auto
      icon: 'mdi:calendar-clock'
    heat:
      name: Chauffe
    'off':
      name: Eteint
      icon: 'mdi:power'
hide:
  temperature: true
sensors:
  - entity: sensor.rika_domo_room_temperature
    name: T° sonde
  - entity: sensor.rika_domo_stove_status
    name: Etat
style: |
  ha-card {
    --st-font-size-xl: 20px;
    --st-font-size-m: 16px;
    --st-font-size-title: 16px;
    --st-font-size-sensors: 16px;
  }       

I do not have any idea if it is the custom card or your integration. Anyway, Translating the status into core.py still works. That's no big deal...

FYI I have finaly been in shortage of pellets this morning but no info about this into HA. I checked onto Firenet website and the state is known so maybe there is a way to collect the info also with your integration?

Fockaert commented 3 years ago

@Antoine1-byte Could you try the latest commit whether this works? I moved the translations one lever higher.

Antoine1-byte commented 3 years ago

@Fockaert

Hello,

I did the test and I do not see any change on my side. The different states are properly tanslated using the entity and the climate one. When using the Simple Thermostat card, keep have the issue that nothing is translated

image

image

Feel free to ask in case you want me to look at something else.