diff --git a/custom_components/midea_ac_lan/midea_devices.py b/custom_components/midea_ac_lan/midea_devices.py index 8f737923..0832db6f 100644 --- a/custom_components/midea_ac_lan/midea_devices.py +++ b/custom_components/midea_ac_lan/midea_devices.py @@ -1918,14 +1918,23 @@ 0xED: { "name": "Water Drinking Appliance", "entities": { - EDAttributes.child_lock: {"type": Platform.LOCK, "name": "Child Lock"}, + EDAttributes.child_lock: { + "type": Platform.LOCK, + "has_entity_name": True, + "translation_key": "child_lock", + "name": "Child Lock", + }, EDAttributes.power: { "type": Platform.SWITCH, + "has_entity_name": True, + "translation_key": "power", "name": "Power", "icon": "mdi:power", }, EDAttributes.filter1: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "filter1_days", "name": "Filter1 Available Days", "icon": "mdi:air-filter", "unit": UnitOfTime.DAYS, @@ -1933,6 +1942,8 @@ }, EDAttributes.filter2: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "filter2_days", "name": "Filter2 Available Days", "icon": "mdi:air-filter", "unit": UnitOfTime.DAYS, @@ -1940,6 +1951,8 @@ }, EDAttributes.filter3: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "filter3_days", "name": "Filter3 Available Days", "icon": "mdi:air-filter", "unit": UnitOfTime.DAYS, @@ -1947,6 +1960,8 @@ }, EDAttributes.life1: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "filter1_life", "name": "Filter1 Life Level", "icon": "mdi:percent", "unit": PERCENTAGE, @@ -1954,6 +1969,8 @@ }, EDAttributes.life2: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "filter2_life", "name": "Filter2 Life Level", "icon": "mdi:percent", "unit": PERCENTAGE, @@ -1961,6 +1978,8 @@ }, EDAttributes.life3: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "filter3_life", "name": "Filter3 Life Level", "icon": "mdi:percent", "unit": PERCENTAGE, @@ -1968,6 +1987,8 @@ }, EDAttributes.in_tds: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "in_tds", "name": "In TDS", "icon": "mdi:water", "unit": CONCENTRATION_PARTS_PER_MILLION, @@ -1975,6 +1996,8 @@ }, EDAttributes.out_tds: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "out_tds", "name": "Out TDS", "icon": "mdi:water-plus", "unit": CONCENTRATION_PARTS_PER_MILLION, @@ -1982,6 +2005,8 @@ }, EDAttributes.water_consumption: { "type": Platform.SENSOR, + "has_entity_name": True, + "translation_key": "water_consumption", "name": "Water Consumption", "icon": "mdi:water-pump", "unit": UnitOfVolume.LITERS, diff --git a/custom_components/midea_ac_lan/midea_entity.py b/custom_components/midea_ac_lan/midea_entity.py index de19197d..05c9a2c5 100644 --- a/custom_components/midea_ac_lan/midea_entity.py +++ b/custom_components/midea_ac_lan/midea_entity.py @@ -35,6 +35,15 @@ def __init__(self, device: MideaDevice, entity_key: str) -> None: self.entity_id = self._unique_id self._device_name = self._device.name + self._attr_translation_key = self._config.get("translation_key") + self._attr_has_entity_name = self._config.get("has_entity_name", False) + if not self.has_entity_name: # old behavior + self._attr_name = ( + f"{self._device_name} {self._config.get('name')}" + if "name" in self._config + else self._device_name + ) + @property def device(self) -> MideaDevice: """Return device structure.""" @@ -62,15 +71,6 @@ def should_poll(self) -> bool: """Return true is integration should poll.""" return False - @property - def name(self) -> str: - """Return entity name.""" - return ( - f"{self._device_name} {self._config.get('name')}" - if "name" in self._config - else self._device_name - ) - @property def available(self) -> bool: """Return entity availability.""" diff --git a/custom_components/midea_ac_lan/translations/de.json b/custom_components/midea_ac_lan/translations/de.json index aff30843..e83484c5 100644 --- a/custom_components/midea_ac_lan/translations/de.json +++ b/custom_components/midea_ac_lan/translations/de.json @@ -61,6 +61,47 @@ } } }, + "entity": { + "lock": { + "child_lock": { + "name": "Child Lock" + } + }, + "sensor": { + "filter1_days": { + "name": "Filter1 Available Days" + }, + "filter2_days": { + "name": "Filter2 Available Days" + }, + "filter3_days": { + "name": "Filter3 Available Days" + }, + "filter1_life": { + "name": "Filter1 Life Level" + }, + "filter2_life": { + "name": "Filter2 Life Level" + }, + "filter3_life": { + "name": "Filter3 Life Level" + }, + "in_tds": { + "name": "In TDS" + }, + "out_tds": { + "name": "Out TDS" + }, + "water_consumption": { + "name": "Water Consumption" + } + }, + "switch": { + "power": { + "name": "Power" + } + } + }, "options": { "step": { "init": { diff --git a/custom_components/midea_ac_lan/translations/en.json b/custom_components/midea_ac_lan/translations/en.json index c772aadd..298ec964 100644 --- a/custom_components/midea_ac_lan/translations/en.json +++ b/custom_components/midea_ac_lan/translations/en.json @@ -61,6 +61,47 @@ } } }, + "entity": { + "lock": { + "child_lock": { + "name": "Child Lock" + } + }, + "sensor": { + "filter1_days": { + "name": "Filter1 Available Days" + }, + "filter2_days": { + "name": "Filter2 Available Days" + }, + "filter3_days": { + "name": "Filter3 Available Days" + }, + "filter1_life": { + "name": "Filter1 Life Level" + }, + "filter2_life": { + "name": "Filter2 Life Level" + }, + "filter3_life": { + "name": "Filter3 Life Level" + }, + "in_tds": { + "name": "In TDS" + }, + "out_tds": { + "name": "Out TDS" + }, + "water_consumption": { + "name": "Water Consumption" + } + }, + "switch": { + "power": { + "name": "Power" + } + } + }, "options": { "step": { "init": { diff --git a/custom_components/midea_ac_lan/translations/fr.json b/custom_components/midea_ac_lan/translations/fr.json index 498bc261..7be801ea 100644 --- a/custom_components/midea_ac_lan/translations/fr.json +++ b/custom_components/midea_ac_lan/translations/fr.json @@ -61,6 +61,47 @@ } } }, + "entity": { + "lock": { + "child_lock": { + "name": "Child Lock" + } + }, + "sensor": { + "filter1_days": { + "name": "Filter1 Available Days" + }, + "filter2_days": { + "name": "Filter2 Available Days" + }, + "filter3_days": { + "name": "Filter3 Available Days" + }, + "filter1_life": { + "name": "Filter1 Life Level" + }, + "filter2_life": { + "name": "Filter2 Life Level" + }, + "filter3_life": { + "name": "Filter3 Life Level" + }, + "in_tds": { + "name": "In TDS" + }, + "out_tds": { + "name": "Out TDS" + }, + "water_consumption": { + "name": "Water Consumption" + } + }, + "switch": { + "power": { + "name": "Power" + } + } + }, "options": { "step": { "init": { diff --git a/custom_components/midea_ac_lan/translations/hu.json b/custom_components/midea_ac_lan/translations/hu.json index d33ac81d..0149faa5 100644 --- a/custom_components/midea_ac_lan/translations/hu.json +++ b/custom_components/midea_ac_lan/translations/hu.json @@ -61,6 +61,47 @@ } } }, + "entity": { + "lock": { + "child_lock": { + "name": "Child Lock" + } + }, + "sensor": { + "filter1_days": { + "name": "Filter1 Available Days" + }, + "filter2_days": { + "name": "Filter2 Available Days" + }, + "filter3_days": { + "name": "Filter3 Available Days" + }, + "filter1_life": { + "name": "Filter1 Life Level" + }, + "filter2_life": { + "name": "Filter2 Life Level" + }, + "filter3_life": { + "name": "Filter3 Life Level" + }, + "in_tds": { + "name": "In TDS" + }, + "out_tds": { + "name": "Out TDS" + }, + "water_consumption": { + "name": "Water Consumption" + } + }, + "switch": { + "power": { + "name": "Power" + } + } + }, "options": { "step": { "init": { diff --git a/custom_components/midea_ac_lan/translations/ru.json b/custom_components/midea_ac_lan/translations/ru.json index 465b06cd..a9567e72 100644 --- a/custom_components/midea_ac_lan/translations/ru.json +++ b/custom_components/midea_ac_lan/translations/ru.json @@ -61,6 +61,47 @@ } } }, + "entity": { + "lock": { + "child_lock": { + "name": "Child Lock" + } + }, + "sensor": { + "filter1_days": { + "name": "Filter1 Available Days" + }, + "filter2_days": { + "name": "Filter2 Available Days" + }, + "filter3_days": { + "name": "Filter3 Available Days" + }, + "filter1_life": { + "name": "Filter1 Life Level" + }, + "filter2_life": { + "name": "Filter2 Life Level" + }, + "filter3_life": { + "name": "Filter3 Life Level" + }, + "in_tds": { + "name": "In TDS" + }, + "out_tds": { + "name": "Out TDS" + }, + "water_consumption": { + "name": "Water Consumption" + } + }, + "switch": { + "power": { + "name": "Power" + } + } + }, "options": { "step": { "init": { diff --git a/custom_components/midea_ac_lan/translations/sk.json b/custom_components/midea_ac_lan/translations/sk.json index 288f7d14..7a2a947a 100644 --- a/custom_components/midea_ac_lan/translations/sk.json +++ b/custom_components/midea_ac_lan/translations/sk.json @@ -61,6 +61,47 @@ } } }, + "entity": { + "lock": { + "child_lock": { + "name": "Child Lock" + } + }, + "sensor": { + "filter1_days": { + "name": "Filter1 Available Days" + }, + "filter2_days": { + "name": "Filter2 Available Days" + }, + "filter3_days": { + "name": "Filter3 Available Days" + }, + "filter1_life": { + "name": "Filter1 Life Level" + }, + "filter2_life": { + "name": "Filter2 Life Level" + }, + "filter3_life": { + "name": "Filter3 Life Level" + }, + "in_tds": { + "name": "In TDS" + }, + "out_tds": { + "name": "Out TDS" + }, + "water_consumption": { + "name": "Water Consumption" + } + }, + "switch": { + "power": { + "name": "Power" + } + } + }, "options": { "step": { "init": { diff --git a/custom_components/midea_ac_lan/translations/zh-Hans.json b/custom_components/midea_ac_lan/translations/zh-Hans.json index 3a6a5e9b..b752bcb3 100644 --- a/custom_components/midea_ac_lan/translations/zh-Hans.json +++ b/custom_components/midea_ac_lan/translations/zh-Hans.json @@ -61,6 +61,47 @@ } } }, + "entity": { + "lock": { + "child_lock": { + "name": "童锁" + } + }, + "sensor": { + "filter1_days": { + "name": "滤芯1可用天数" + }, + "filter2_days": { + "name": "滤芯2可用天数" + }, + "filter3_days": { + "name": "滤芯3可用天数" + }, + "filter1_life": { + "name": "滤芯1剩余寿命" + }, + "filter2_life": { + "name": "滤芯2剩余寿命" + }, + "filter3_life": { + "name": "滤芯3剩余寿命" + }, + "in_tds": { + "name": "进水TDS" + }, + "out_tds": { + "name": "出水TDS" + }, + "water_consumption": { + "name": "总耗水量" + } + }, + "switch": { + "power": { + "name": "电源开关" + } + } + }, "options": { "step": { "init": {