From 5d3d6f09f8ce6aff134a91feeedd4027b26d6f32 Mon Sep 17 00:00:00 2001 From: Robbe-B <103053873+Robbe-B@users.noreply.github.com> Date: Thu, 8 Feb 2024 22:01:34 +0100 Subject: [PATCH] Add Icons to preset modes of Climate and Fan entities --- custom_components/maestro_mcz/climate.py | 1 + custom_components/maestro_mcz/fan.py | 1 + custom_components/maestro_mcz/icons.json | 32 +++++++++++++++++++ custom_components/maestro_mcz/strings.json | 29 +++++++++++++++++ .../maestro_mcz/translations/en.json | 29 +++++++++++++++++ .../maestro_mcz/translations/nl.json | 29 +++++++++++++++++ 6 files changed, 121 insertions(+) create mode 100644 custom_components/maestro_mcz/icons.json diff --git a/custom_components/maestro_mcz/climate.py b/custom_components/maestro_mcz/climate.py index bd50b4c..94e35b5 100644 --- a/custom_components/maestro_mcz/climate.py +++ b/custom_components/maestro_mcz/climate.py @@ -38,6 +38,7 @@ class MczClimateEntity(CoordinatorEntity, ClimateEntity): _attr_current_temperature = None _attr_target_temperature = None _attr_preset_mode = None + _attr_translation_key: str = "main_climate" _supported_power_sensor: models.MczConfigItem | None = None _supported_thermostat: models.MczConfigItem | None = None diff --git a/custom_components/maestro_mcz/fan.py b/custom_components/maestro_mcz/fan.py index 25738db..ce7fc82 100644 --- a/custom_components/maestro_mcz/fan.py +++ b/custom_components/maestro_mcz/fan.py @@ -46,6 +46,7 @@ class MczFanEntity(CoordinatorEntity, FanEntity): _attr_preset_mode: str | None = None _attr_preset_modes: list[str] | None = None _attr_speed_count: int = 0 + _attr_translation_key: str = "main_fan" # _supported_fan: models.FanMczConfigItem | None = None _fan_configuration: SensorConfigurationMultipleModes | None = None diff --git a/custom_components/maestro_mcz/icons.json b/custom_components/maestro_mcz/icons.json new file mode 100644 index 0000000..0408141 --- /dev/null +++ b/custom_components/maestro_mcz/icons.json @@ -0,0 +1,32 @@ +{ + "entity": { + "climate": { + "main_climate": { + "state_attributes": { + "preset_mode": { + "default": "mdi:confused", + "state": { + "manual": "mdi:hand-back-right", + "auto": "mdi:thermometer-auto", + "overnight": "mdi:weather-night", + "comfort": "mdi:home-heart", + "turbo": "mdi:fire" + } + } + } + } + }, + "fan": { + "main_fan": { + "state_attributes": { + "preset_mode": { + "state": { + "auto": "mdi:fan-auto", + "silent": "mdi:fan-off" + } + } + } + } + } + } + } \ No newline at end of file diff --git a/custom_components/maestro_mcz/strings.json b/custom_components/maestro_mcz/strings.json index 74e3a9a..0d57615 100644 --- a/custom_components/maestro_mcz/strings.json +++ b/custom_components/maestro_mcz/strings.json @@ -25,5 +25,34 @@ } } } + }, + "entity": { + "climate": { + "main_climate": { + "state_attributes": { + "preset_mode": { + "state": { + "manual": "Manual", + "auto": "Auto", + "overnight": "Overnight", + "comfort": "Comfort", + "turbo": "Turbo" + } + } + } + } + }, + "fan": { + "main_fan": { + "state_attributes": { + "preset_mode": { + "state": { + "auto": "Auto", + "silent": "Silent" + } + } + } + } + } } } diff --git a/custom_components/maestro_mcz/translations/en.json b/custom_components/maestro_mcz/translations/en.json index 49fa66a..6e4389a 100644 --- a/custom_components/maestro_mcz/translations/en.json +++ b/custom_components/maestro_mcz/translations/en.json @@ -25,5 +25,34 @@ } } } + }, + "entity": { + "climate": { + "main_climate": { + "state_attributes": { + "preset_mode": { + "state": { + "manual": "Manual", + "auto": "Auto", + "overnight": "Overnight", + "comfort": "Comfort", + "turbo": "Turbo" + } + } + } + } + }, + "fan": { + "main_fan": { + "state_attributes": { + "preset_mode": { + "state": { + "auto": "Auto", + "silent": "Silent" + } + } + } + } + } } } \ No newline at end of file diff --git a/custom_components/maestro_mcz/translations/nl.json b/custom_components/maestro_mcz/translations/nl.json index 2b6145f..7d4bf4c 100644 --- a/custom_components/maestro_mcz/translations/nl.json +++ b/custom_components/maestro_mcz/translations/nl.json @@ -25,5 +25,34 @@ } } } + }, + "entity": { + "climate": { + "main_climate": { + "state_attributes": { + "preset_mode": { + "state": { + "manual": "Manual", + "auto": "Auto", + "overnight": "Overnight", + "comfort": "Comfort", + "turbo": "Turbo" + } + } + } + } + }, + "fan": { + "main_fan": { + "state_attributes": { + "preset_mode": { + "state": { + "auto": "Auto", + "silent": "Silent" + } + } + } + } + } } }