Skip to content

Translate inverter and battery status states - #1037

Open
it-rec wants to merge 2 commits into
WillCodeForCats:mainfrom
it-rec:feat/status-state-translations
Open

Translate inverter and battery status states#1037
it-rec wants to merge 2 commits into
WillCodeForCats:mainfrom
it-rec:feat/status-state-translations

Conversation

@it-rec

@it-rec it-rec commented Aug 16, 2026

Copy link
Copy Markdown

Proposed change

Both status sensors are already SensorDeviceClass.ENUM with options, and the integration ships translations for the config flow, options and repair issues. The entity states however are not translated, so the UI shows the raw option, for example B_STATUS_PRESERVE_CHARGE or I_STATUS_MPPT.

The readable text already exists in the integration - DEVICE_STATUS_TEXT and BATTERY_STATUS_TEXT are exposed as a status_text attribute - but attributes are not shown on the device page, so what a user actually reads is the raw constant.

This adds a translation_key to both status sensors and the corresponding entity.sensor.*.state sections, covering all 8 inverter and all 9 battery states.

Updated for review: all seven shipped languages are now filled in together - en, de, fr, it, nb, nl, pl. The first version only had en and de; that was wrong for this project and is fixed.

English reuses the existing wording from the two *_TEXT tables so there is only one set of terms in the project. I can verify en, de and fr myself; it, nb, nl and pl are my best effort from the English terms, so corrections from native speakers are welcome for those four.

This is not a breaking change. The state value is untouched, only the displayed text changes, so automations and templates comparing against B_STATUS_* or I_STATUS_* keep working.

Testing

Tested on a running Home Assistant instance with an inverter and a battery.

Registry after the change:

sensor.<inverter>_status      translation_key=inverter_status
sensor.<inverter>_b1_status   translation_key=battery_status

Translations served by the frontend API:

[de] B_STATUS_PRESERVE_CHARGE -> Ladung halten     [en] -> Preserve Charge
[de] I_STATUS_MPPT            -> Erzeugung         [en] -> Production

Two things I checked explicitly because they were the risk:

  • State values unchanged. The sensors still report B_STATUS_DISCHARGE and I_STATUS_MPPT through the API after the change.
  • Entity names unchanged. Setting a translation key can take over the entity name; it does not here, because both classes define name as a property.

Rebased on the current main.

Checklist

  • Based on the latest upstream main.
  • One subject only.
  • Tested on a running instance.

@WillCodeForCats

Copy link
Copy Markdown
Owner

All translations must be updated together.

The status sensors are already SensorDeviceClass.ENUM with options, and
the integration ships translations for config flow and issues, but the
entity states themselves were never translated: the UI shows the raw
option, e.g. B_STATUS_PRESERVE_CHARGE. The plain text existed only as a
status_text attribute, which is not visible on the device page.

Give both status sensors a translation key and add the entity state
strings for en and de. English reuses the wording already in
DEVICE_STATUS_TEXT and BATTERY_STATUS_TEXT so there is only one set of
terms. The state value itself is unchanged, so automations comparing
against B_STATUS_* keep working; only the displayed text changes.

Other languages are left out on purpose rather than machine translated;
they fall back to English.
@it-rec
it-rec force-pushed the feat/status-state-translations branch from b0960db to 567b0b9 Compare August 17, 2026 05:11
Fills in fr, it, nb, nl and pl so all shipped translation files carry the
status states, as requested in review: translations are updated together
rather than one language at a time.

English reuses the wording already in DEVICE_STATUS_TEXT and
BATTERY_STATUS_TEXT. I can verify en, de and fr myself; it, nb, nl and pl
are my best effort from the English terms, so corrections from native
speakers are welcome for those four.
@it-rec
it-rec force-pushed the feat/status-state-translations branch from 567b0b9 to 2279ba6 Compare August 17, 2026 06:01
@it-rec

it-rec commented Aug 17, 2026

Copy link
Copy Markdown
Author

All translations must be updated together.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants