Skip to content

Commit

Permalink
Fix entity state translations for breaking change in HA 2023.4
Browse files Browse the repository at this point in the history
Fixes #200 No more translation after Home Assistant version update
  • Loading branch information
Eran Kutner committed Apr 7, 2023
1 parent 893331a commit 39108da
Show file tree
Hide file tree
Showing 24 changed files with 5,114 additions and 4,610 deletions.
13 changes: 1 addition & 12 deletions .devcontainer/config/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,11 @@ logger:
custom_components.home_connect_alt: error
homeassistant.helpers.config_entry_oauth2_flow: debug

# If you need to debug uncomment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
#debugpy:
input_select:
who_cooks:
name: Who cooks today
options:
- Paulus
- Anne Therese
initial: Anne Therese
icon: mdi:panda

home_connect_alt:
client_id: !secret home_connect_client_id
client_secret: !secret home_connect_client_secret
# cache: false
language: en
language: en-GB
sensor_value_translation: local
name_template: $appliance $name ($brand)
log_mode: 7
Expand Down
2 changes: 1 addition & 1 deletion custom_components/home_connect_alt/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"issue_tracker": "https://github.com/ekutner/home-connect-hass/issues",
"requirements": ["home-connect-async==0.7.8"],
"ssdp": [],
"version": "0.6.1-b4",
"version": "0.6.1",
"zeroconf": []
}
12 changes: 12 additions & 0 deletions custom_components/home_connect_alt/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class ProgramSelect(InteractiveEntityBase, SelectEntity):
def unique_id(self) -> str:
return f'{self.haId}_programs'

@property
def translation_key(self) -> str:
return "programs"

@property
def name_ext(self) -> str:
return "Programs"
Expand Down Expand Up @@ -123,6 +127,10 @@ class OptionSelect(InteractiveEntityBase, SelectEntity):
def device_class(self) -> str:
return f"{DOMAIN}__options"

@property
def translation_key(self) -> str:
return "options"

@property
def name_ext(self) -> str|None:
if self._appliance.available_programs:
Expand Down Expand Up @@ -195,6 +203,10 @@ class SettingsSelect(InteractiveEntityBase, SelectEntity):
def device_class(self) -> str:
return f"{DOMAIN}__settings"

@property
def translation_key(self) -> str:
return "settings"

@property
def name_ext(self) -> str|None:
if self._key in self._appliance.settings and self._appliance.settings[self._key].name:
Expand Down
18 changes: 17 additions & 1 deletion custom_components/home_connect_alt/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def unique_id(self) -> str:
def name_ext(self) -> str:
return f"{self._conf['program_type'].capitalize()} Program"

@property
def translation_key(self) -> str:
return "programs"

@property
def icon(self) -> str:
if self._appliance.type in DEVICE_ICON_MAP:
Expand Down Expand Up @@ -133,6 +137,10 @@ def device_class(self) -> str:
return self.get_entity_setting("class")
return f"{DOMAIN}__options"

@property
def translation_key(self) -> str:
return "options"

@property
def icon(self) -> str:
return self.get_entity_setting("icon", "mdi:office-building-cog")
Expand Down Expand Up @@ -239,6 +247,10 @@ class StatusSensor(EntityBase, SensorEntity):
def device_class(self) -> str:
return f"{DOMAIN}__status"

@property
def translation_key(self) -> str:
return "statuses"

@property
def name_ext(self) -> str:
if self._key in self._appliance.status:
Expand Down Expand Up @@ -275,12 +287,16 @@ async def async_on_update(self, appliance: Appliance, key: str, value) -> None:


class SettingsSensor(EntityBase, SensorEntity):
"""Status sensor"""
"""Settings sensor"""

@property
def device_class(self) -> str:
return f"{DOMAIN}__settings"

@property
def translation_key(self) -> str:
return "settings"

@property
def name_ext(self) -> str:
if self._key in self._appliance.settings:
Expand Down
757 changes: 757 additions & 0 deletions custom_components/home_connect_alt/translations/de.json

Large diffs are not rendered by default.

756 changes: 756 additions & 0 deletions custom_components/home_connect_alt/translations/en.json

Large diffs are not rendered by default.

684 changes: 684 additions & 0 deletions custom_components/home_connect_alt/translations/he.json

Large diffs are not rendered by default.

754 changes: 754 additions & 0 deletions custom_components/home_connect_alt/translations/nl.json

Large diffs are not rendered by default.

654 changes: 654 additions & 0 deletions custom_components/home_connect_alt/translations/pl.json

Large diffs are not rendered by default.

371 changes: 0 additions & 371 deletions custom_components/home_connect_alt/translations/select.de.json

This file was deleted.

357 changes: 0 additions & 357 deletions custom_components/home_connect_alt/translations/select.en.json

This file was deleted.

333 changes: 0 additions & 333 deletions custom_components/home_connect_alt/translations/select.he.json

This file was deleted.

356 changes: 0 additions & 356 deletions custom_components/home_connect_alt/translations/select.nl.json

This file was deleted.

318 changes: 0 additions & 318 deletions custom_components/home_connect_alt/translations/select.pl.json

This file was deleted.

355 changes: 0 additions & 355 deletions custom_components/home_connect_alt/translations/select.sv.json

This file was deleted.

370 changes: 0 additions & 370 deletions custom_components/home_connect_alt/translations/select.zh.json

This file was deleted.

371 changes: 0 additions & 371 deletions custom_components/home_connect_alt/translations/sensor.de.json

This file was deleted.

370 changes: 0 additions & 370 deletions custom_components/home_connect_alt/translations/sensor.en.json

This file was deleted.

335 changes: 0 additions & 335 deletions custom_components/home_connect_alt/translations/sensor.he.json

This file was deleted.

370 changes: 0 additions & 370 deletions custom_components/home_connect_alt/translations/sensor.nl.json

This file was deleted.

320 changes: 0 additions & 320 deletions custom_components/home_connect_alt/translations/sensor.pl.json

This file was deleted.

370 changes: 0 additions & 370 deletions custom_components/home_connect_alt/translations/sensor.zh.json

This file was deleted.

724 changes: 724 additions & 0 deletions custom_components/home_connect_alt/translations/sv.json

Large diffs are not rendered by default.

754 changes: 754 additions & 0 deletions custom_components/home_connect_alt/translations/zh.json

Large diffs are not rendered by default.

0 comments on commit 39108da

Please sign in to comment.