Add translations for Netatmo thermostat preset modes (#128890)

This commit is contained in:
Paul Bottein 2024-10-21 13:00:23 +02:00 committed by GitHub
parent 110751e992
commit 28a8ed62f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 60 additions and 33 deletions

View File

@ -58,9 +58,9 @@ from .entity import NetatmoRoomEntity
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
PRESET_FROST_GUARD = "Frost Guard" PRESET_FROST_GUARD = "frost_guard"
PRESET_SCHEDULE = "Schedule" PRESET_SCHEDULE = "schedule"
PRESET_MANUAL = "Manual" PRESET_MANUAL = "manual"
SUPPORT_FLAGS = ( SUPPORT_FLAGS = (
ClimateEntityFeature.TARGET_TEMPERATURE ClimateEntityFeature.TARGET_TEMPERATURE
@ -188,6 +188,7 @@ class NetatmoThermostat(NetatmoRoomEntity, ClimateEntity):
_attr_supported_features = SUPPORT_FLAGS _attr_supported_features = SUPPORT_FLAGS
_attr_target_temperature_step = PRECISION_HALVES _attr_target_temperature_step = PRECISION_HALVES
_attr_temperature_unit = UnitOfTemperature.CELSIUS _attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_translation_key = "thermostat"
_attr_name = None _attr_name = None
_away: bool | None = None _away: bool | None = None
_connected: bool | None = None _connected: bool | None = None

View File

@ -1,5 +1,18 @@
{ {
"entity": { "entity": {
"climate": {
"thermostat": {
"state_attributes": {
"preset_mode": {
"state": {
"frost_guard": "mdi:snowflake-thermometer",
"schedule": "mdi:clock-outline",
"manual": "mdi:gesture-tap"
}
}
}
}
},
"sensor": { "sensor": {
"temp_trend": { "temp_trend": {
"default": "mdi:trending-up" "default": "mdi:trending-up"

View File

@ -168,6 +168,19 @@
} }
}, },
"entity": { "entity": {
"climate": {
"thermostat": {
"state_attributes": {
"preset_mode": {
"state": {
"frost_guard": "Frost guard",
"schedule": "Schedule",
"manual": "Manual"
}
}
}
}
},
"sensor": { "sensor": {
"temp_trend": { "temp_trend": {
"name": "Temperature trend" "name": "Temperature trend"

View File

@ -14,8 +14,8 @@
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'target_temp_step': 0.5, 'target_temp_step': 0.5,
}), }),
@ -41,7 +41,7 @@
'platform': 'netatmo', 'platform': 'netatmo',
'previous_unique_id': None, 'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
'translation_key': None, 'translation_key': 'thermostat',
'unique_id': '222452125-DeviceType.OTM', 'unique_id': '222452125-DeviceType.OTM',
'unit_of_measurement': None, 'unit_of_measurement': None,
}) })
@ -60,8 +60,8 @@
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
'target_temp_step': 0.5, 'target_temp_step': 0.5,
@ -89,8 +89,8 @@
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'target_temp_step': 0.5, 'target_temp_step': 0.5,
}), }),
@ -116,7 +116,7 @@
'platform': 'netatmo', 'platform': 'netatmo',
'previous_unique_id': None, 'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
'translation_key': None, 'translation_key': 'thermostat',
'unique_id': '2940411577-DeviceType.NRV', 'unique_id': '2940411577-DeviceType.NRV',
'unit_of_measurement': None, 'unit_of_measurement': None,
}) })
@ -135,12 +135,12 @@
]), ]),
'max_temp': 30, 'max_temp': 30,
'min_temp': 7, 'min_temp': 7,
'preset_mode': 'Frost Guard', 'preset_mode': 'frost_guard',
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'selected_schedule': 'Default', 'selected_schedule': 'Default',
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
@ -170,8 +170,8 @@
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'target_temp_step': 0.5, 'target_temp_step': 0.5,
}), }),
@ -197,7 +197,7 @@
'platform': 'netatmo', 'platform': 'netatmo',
'previous_unique_id': None, 'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
'translation_key': None, 'translation_key': 'thermostat',
'unique_id': '1002003001-DeviceType.BNS', 'unique_id': '1002003001-DeviceType.BNS',
'unit_of_measurement': None, 'unit_of_measurement': None,
}) })
@ -215,12 +215,12 @@
]), ]),
'max_temp': 30, 'max_temp': 30,
'min_temp': 7, 'min_temp': 7,
'preset_mode': 'Schedule', 'preset_mode': 'schedule',
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'selected_schedule': 'Default', 'selected_schedule': 'Default',
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
@ -250,8 +250,8 @@
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'target_temp_step': 0.5, 'target_temp_step': 0.5,
}), }),
@ -277,7 +277,7 @@
'platform': 'netatmo', 'platform': 'netatmo',
'previous_unique_id': None, 'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
'translation_key': None, 'translation_key': 'thermostat',
'unique_id': '2833524037-DeviceType.NRV', 'unique_id': '2833524037-DeviceType.NRV',
'unit_of_measurement': None, 'unit_of_measurement': None,
}) })
@ -296,12 +296,12 @@
]), ]),
'max_temp': 30, 'max_temp': 30,
'min_temp': 7, 'min_temp': 7,
'preset_mode': 'Frost Guard', 'preset_mode': 'frost_guard',
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'selected_schedule': 'Default', 'selected_schedule': 'Default',
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
@ -332,8 +332,8 @@
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'target_temp_step': 0.5, 'target_temp_step': 0.5,
}), }),
@ -359,7 +359,7 @@
'platform': 'netatmo', 'platform': 'netatmo',
'previous_unique_id': None, 'previous_unique_id': None,
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,
'translation_key': None, 'translation_key': 'thermostat',
'unique_id': '2746182631-DeviceType.NATherm1', 'unique_id': '2746182631-DeviceType.NATherm1',
'unit_of_measurement': None, 'unit_of_measurement': None,
}) })
@ -382,8 +382,8 @@
'preset_modes': list([ 'preset_modes': list([
'away', 'away',
'boost', 'boost',
'Frost Guard', 'frost_guard',
'Schedule', 'schedule',
]), ]),
'selected_schedule': 'Default', 'selected_schedule': 'Default',
'supported_features': <ClimateEntityFeature: 401>, 'supported_features': <ClimateEntityFeature: 401>,

View File

@ -282,7 +282,7 @@ async def test_service_preset_mode_frost_guard_thermostat(
assert hass.states.get(climate_entity_livingroom).state == "auto" assert hass.states.get(climate_entity_livingroom).state == "auto"
assert ( assert (
hass.states.get(climate_entity_livingroom).attributes["preset_mode"] hass.states.get(climate_entity_livingroom).attributes["preset_mode"]
== "Frost Guard" == "frost_guard"
) )
# Test service setting the preset mode to "frost guard" # Test service setting the preset mode to "frost guard"
@ -779,7 +779,7 @@ async def test_service_preset_mode_already_boost_valves(
assert hass.states.get(climate_entity_entrada).state == "auto" assert hass.states.get(climate_entity_entrada).state == "auto"
assert ( assert (
hass.states.get(climate_entity_entrada).attributes["preset_mode"] hass.states.get(climate_entity_entrada).attributes["preset_mode"]
== "Frost Guard" == "frost_guard"
) )
assert hass.states.get(climate_entity_entrada).attributes["temperature"] == 7 assert hass.states.get(climate_entity_entrada).attributes["temperature"] == 7