Skip to content

[ZHA] Support translations for select entity values #8

Open
@TheJulianJES

Description

@TheJulianJES

We should support translations for all select entity values in HA. For that, we need to standardize on all enums being snake_case. Do note that this will be a breaking change. PR zigpy/zha#86 can likely just be updated.

  1. For the first implementation, we should (IMO) just convert all possible casings in ZHA using the approach mentioned here: Allow translations for enum values in EnumSensor and ZHAEnumSelectEntity entities zha#86 (comment).
    This will also affect custom quirks using custom enums. In the future, we could slowly change all the enums in zigpy/quirks? Or at least standardize quirks on whatever casing zigpy uses.

  2. We'll also need to make sure to handle the non-ZCL backed select entities correctly that restore state. That should just be a simple conversion from the OldFormat to the new_format. For the ZCL entities, this isn't necessary.

  3. We'll also need to add the correct translations to strings.json in HA. We should automatically generate these for quirks v2 entities.
    This should be somewhat similar to auto-generating the strings for quirks v2 entity names from fallback_name, except we'll need to get a proper string from the enum name. These will likely need to be fine-tuned manually, though that should be do-able.
    Example of auto-generating the quirks v2 entity names: home-assistant/core@dev...TheJulianJES:core:tjj/zha_translation_key_generation#diff-5d97af3392f844cfcf573642b8ae8a0cc9d605b107865aafea51083d089c7ba0R13-R37

    For the ZHA select entities, we might be able to generate them automatically as well (at least one-time) or we can just manually add them, as there shouldn't be too many.

  4. More..?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions