Skip to content

Commit

Permalink
fix: State unknow/standby and add missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
sopelj committed Jan 27, 2024
1 parent aab2ccc commit 6e48b32
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
7 changes: 3 additions & 4 deletions custom_components/ember_mug/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class EmberMugStateSensor(EmberMugSensor):
def icon(self) -> str:
"""Change icon based on state."""
state = self.state
if state is None or self.coordinator.available is False:
if not state or state == LiquidStateValue.UNKNOWN or self.coordinator.available is False:
return ICON_UNAVAILABLE
if state == LiquidStateValue.EMPTY:
return ICON_EMPTY
Expand All @@ -96,9 +96,8 @@ def icon(self) -> str:
@property
def native_value(self) -> str | None:
"""Return liquid state key."""
if state := super().native_value:
return LIQUID_STATE_MAPPING[state].value
return None
raw_value = super().native_value
return LIQUID_STATE_MAPPING[raw_value].value

@property
def extra_state_attributes(self) -> dict[str, Any]:
Expand Down
3 changes: 2 additions & 1 deletion custom_components/ember_mug/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@
"state": {
"name": "State",
"state": {
"unknown": "Unknown",
"empty": "Empty",
"filling": "Filling",
"cold_no_control": "Cold (No control)",
"cooling": "Cooling",
"heating": "Heating",
"perfect": "Perfect",
"standby": "Standby",
"unknown": "Unknown",
"warm_no_control": "Warm (No control)"
},
"state_attributes": {
Expand Down
3 changes: 2 additions & 1 deletion custom_components/ember_mug/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@
"state": {
"name": "State",
"state": {
"unknown": "Unknown",
"empty": "Empty",
"filling": "Filling",
"cold_no_control": "Cold (No control)",
"cooling": "Cooling",
"heating": "Heating",
"perfect": "Perfect",
"standby": "Standby",
"unknown": "Unknown",
"warm_no_control": "Warm (No control)"
},
"state_attributes": {
Expand Down
3 changes: 2 additions & 1 deletion custom_components/ember_mug/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@
"state": {
"name": "Estado",
"state": {
"unknown": "Desconocido",
"empty": "Vacío",
"filling": "Llenando",
"cold_no_control": "Frío (Sin control)",
"cooling": "Enfriando",
"heating": "Calentamiento",
"perfect": "Perfecto",
"standby": "De espera",
"unknown": "Desconocido",
"warm_no_control": "Cálido (sin control)"
},
"state_attributes": {
Expand Down
3 changes: 2 additions & 1 deletion custom_components/ember_mug/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@
"state": {
"name": "État",
"state": {
"unknown": "Inconnu",
"empty": "Vide",
"filling": "Remplissage",
"cold_no_control": "Froid (sans contrôle)",
"cooling": "Refroidissement",
"heating": "Chauffage",
"perfect": "Parfait",
"standby": "En veille",
"unknown": "Inconnu",
"warm_no_control": "Chaud (sans contrôle)"
},
"state_attributes": {
Expand Down
3 changes: 2 additions & 1 deletion custom_components/ember_mug/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@
"state": {
"name": "状態",
"state": {
"unknown": "未知数です",
"empty": "空です",
"filling": "埋まっている",
"cold_no_control": "寒い(管理ない)",
"cooling": "冷めている",
"heating": "加熱している",
"perfect": "うってつけです",
"standby": "スタンバイ",
"unknown": "未知数です",
"warm_no_control": "暑い(管理ない)"
},
"state_attributes": {
Expand Down
3 changes: 2 additions & 1 deletion custom_components/ember_mug/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@
"state": {
"name": "Stan",
"state": {
"unknown": "Nieznany",
"empty": "Pussty",
"filling": "Napełniając",
"cold_no_control": "Zimno (bez kontroli)",
"cooling": "Chłodzić",
"heating": "Ogrzać",
"perfect": "Idealny",
"standby": "Czuwania",
"unknown": "Nieznany",
"warm_no_control": "Ciepło (bez kontroli)"
},
"state_attributes": {
Expand Down

0 comments on commit 6e48b32

Please sign in to comment.