diff --git a/homeassistant/components/touchline/climate.py b/homeassistant/components/touchline/climate.py index 994e522ec2fa..3b7f8a84f061 100644 --- a/homeassistant/components/touchline/climate.py +++ b/homeassistant/components/touchline/climate.py @@ -9,6 +9,9 @@ import voluptuous as vol from homeassistant.components.climate import ( PLATFORM_SCHEMA as CLIMATE_PLATFORM_SCHEMA, + PRESET_AWAY, + PRESET_NONE, + PRESET_SLEEP, ClimateEntity, ClimateEntityFeature, HVACMode, @@ -38,12 +41,12 @@ class PresetMode(NamedTuple): PRESET_MODES = { - "Normal": PresetMode(mode=0, program=0), - "Night": PresetMode(mode=1, program=0), - "Holiday": PresetMode(mode=2, program=0), - "Pro 1": PresetMode(mode=0, program=1), - "Pro 2": PresetMode(mode=0, program=2), - "Pro 3": PresetMode(mode=0, program=3), + PRESET_NONE: PresetMode(mode=0, program=0), + PRESET_SLEEP: PresetMode(mode=1, program=0), + PRESET_AWAY: PresetMode(mode=2, program=0), + "program_1": PresetMode(mode=0, program=1), + "program_2": PresetMode(mode=0, program=2), + "program_3": PresetMode(mode=0, program=3), } TOUCHLINE_HA_PRESETS = { @@ -140,6 +143,7 @@ class Touchline(ClimateEntity): ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ) _attr_temperature_unit = UnitOfTemperature.CELSIUS + _attr_translation_key = "climate" def __init__(self, touchline_thermostat): """Initialize the Touchline device.""" diff --git a/homeassistant/components/touchline/icons.json b/homeassistant/components/touchline/icons.json new file mode 100644 index 000000000000..d06c3bc30d60 --- /dev/null +++ b/homeassistant/components/touchline/icons.json @@ -0,0 +1,17 @@ +{ + "entity": { + "climate": { + "climate": { + "state_attributes": { + "preset_mode": { + "state": { + "program_1": "mdi:numeric-1", + "program_2": "mdi:numeric-2", + "program_3": "mdi:numeric-3" + } + } + } + } + } + } +} diff --git a/homeassistant/components/touchline/strings.json b/homeassistant/components/touchline/strings.json index 375dfe550477..c6f0726fc5de 100644 --- a/homeassistant/components/touchline/strings.json +++ b/homeassistant/components/touchline/strings.json @@ -18,6 +18,21 @@ } } }, + "entity": { + "climate": { + "climate": { + "state_attributes": { + "preset_mode": { + "state": { + "program_1": "Program 1", + "program_2": "Program 2", + "program_3": "Program 3" + } + } + } + } + } + }, "issues": { "deprecated_yaml_import_issue_cannot_connect": { "description": "Home Assistant could not connect to the Roth Touchline controller while importing your YAML configuration. Remove the YAML configuration for Roth Touchline from configuration.yaml and set up the integration again from the Home Assistant UI.", diff --git a/tests/components/touchline/snapshots/test_climate.ambr b/tests/components/touchline/snapshots/test_climate.ambr index 8bb2939ac96b..bb1d5edcc60c 100644 --- a/tests/components/touchline/snapshots/test_climate.ambr +++ b/tests/components/touchline/snapshots/test_climate.ambr @@ -12,12 +12,12 @@ 'max_temp': 35, 'min_temp': 7, 'preset_modes': list([ - 'Normal', - 'Night', - 'Holiday', - 'Pro 1', - 'Pro 2', - 'Pro 3', + 'none', + 'sleep', + 'away', + 'program_1', + 'program_2', + 'program_3', ]), }), 'config_entry_id': , @@ -45,7 +45,7 @@ 'previous_unique_id': None, 'suggested_object_id': None, 'supported_features': , - 'translation_key': None, + 'translation_key': 'climate', 'unique_id': 'controller-1_0', 'unit_of_measurement': None, }) @@ -60,14 +60,14 @@ ]), 'max_temp': 35, 'min_temp': 7, - 'preset_mode': 'Normal', + 'preset_mode': 'none', 'preset_modes': list([ - 'Normal', - 'Night', - 'Holiday', - 'Pro 1', - 'Pro 2', - 'Pro 3', + 'none', + 'sleep', + 'away', + 'program_1', + 'program_2', + 'program_3', ]), 'supported_features': , 'temperature': 22.0,