Skip to content

Commit

Permalink
#18645: Fix climate mode mapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
marchingphoenix authored and balloob committed Dec 10, 2018
1 parent fa9fe40 commit d7459c7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion homeassistant/components/google_assistant/trait.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,10 @@ class TemperatureSettingTrait(_Trait):
climate.STATE_HEAT: 'heat',
climate.STATE_COOL: 'cool',
climate.STATE_OFF: 'off',
climate.STATE_AUTO: 'heatcool',
climate.STATE_AUTO: 'auto',
climate.STATE_FAN_ONLY: 'fan-only',
climate.STATE_DRY: 'dry',
climate.STATE_ECO: 'eco'
}
google_to_hass = {value: key for key, value in hass_to_google.items()}

Expand Down
2 changes: 1 addition & 1 deletion tests/components/google_assistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
'type': 'action.devices.types.THERMOSTAT',
'willReportState': False,
'attributes': {
'availableThermostatModes': 'heat,cool,heatcool,off',
'availableThermostatModes': 'heat,cool,auto,off',
'thermostatTemperatureUnit': 'C',
},
}, {
Expand Down
4 changes: 2 additions & 2 deletions tests/components/google_assistant/test_google_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def test_query_climate_request(hass_fixture, assistant_client, auth_header):
'online': True,
'thermostatTemperatureSetpointHigh': 24,
'thermostatTemperatureAmbient': 23,
'thermostatMode': 'heatcool',
'thermostatMode': 'auto',
'thermostatTemperatureSetpointLow': 21
}
assert devices['climate.hvac'] == {
Expand Down Expand Up @@ -271,7 +271,7 @@ def test_query_climate_request_f(hass_fixture, assistant_client, auth_header):
'online': True,
'thermostatTemperatureSetpointHigh': -4.4,
'thermostatTemperatureAmbient': -5,
'thermostatMode': 'heatcool',
'thermostatMode': 'auto',
'thermostatTemperatureSetpointLow': -6.1,
}
assert devices['climate.hvac'] == {
Expand Down
6 changes: 3 additions & 3 deletions tests/components/google_assistant/test_trait.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,11 @@ async def test_temperature_setting_climate_range(hass):
climate.ATTR_MAX_TEMP: 80
}), BASIC_CONFIG)
assert trt.sync_attributes() == {
'availableThermostatModes': 'off,cool,heat,heatcool',
'availableThermostatModes': 'off,cool,heat,auto',
'thermostatTemperatureUnit': 'F',
}
assert trt.query_attributes() == {
'thermostatMode': 'heatcool',
'thermostatMode': 'auto',
'thermostatTemperatureAmbient': 21.1,
'thermostatHumidityAmbient': 25,
'thermostatTemperatureSetpointLow': 18.3,
Expand All @@ -709,7 +709,7 @@ async def test_temperature_setting_climate_range(hass):
calls = async_mock_service(
hass, climate.DOMAIN, climate.SERVICE_SET_OPERATION_MODE)
await trt.execute(trait.COMMAND_THERMOSTAT_SET_MODE, {
'thermostatMode': 'heatcool',
'thermostatMode': 'auto',
})
assert len(calls) == 1
assert calls[0].data == {
Expand Down

0 comments on commit d7459c7

Please sign in to comment.