Alexa thermostat fails to properly parse 'value' field for climate (#13958)

* Fix thermostat payload issue

* fix test payload

* style issue

* handle both string and value object
This commit is contained in:
Michael Wei authored and Paulus Schoutsen committed 2018-04-18 14:19:05 -04:00
1 parent c5cb28d41f
commit 0eb3e49880
2 files changed
+11 -2

No files matched your search

+10 -2
View File
@@ -807,15 +807,23 @@ async def test_thermostat(hass):
'Alexa.ThermostatController', 'SetThermostatMode',
'climate#test_thermostat', 'climate.set_operation_mode',
hass,
payload={'thermostatMode': 'HEAT'}
payload={'thermostatMode': {'value': 'HEAT'}}
)
assert call.data['operation_mode'] == 'heat'
call, _ = await assert_request_calls_service(
'Alexa.ThermostatController', 'SetThermostatMode',
'climate#test_thermostat', 'climate.set_operation_mode',
hass,
payload={'thermostatMode': 'HEAT'}
)
assert call.data['operation_mode'] == 'heat'
msg = await assert_request_fails(
'Alexa.ThermostatController', 'SetThermostatMode',
'climate#test_thermostat', 'climate.set_operation_mode',
hass,
payload={'thermostatMode': 'INVALID'}
payload={'thermostatMode': {'value': 'INVALID'}}
)
assert msg['event']['payload']['type'] == 'UNSUPPORTED_THERMOSTAT_MODE'