mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Fix operation mode for Alexa thermostat (#17972)
This commit is contained in:
parent
af5eacf303
commit
d6913c6914
@ -1,4 +1,5 @@
|
|||||||
"""Support for alexa Smart Home Skill API."""
|
"""Support for alexa Smart Home Skill API."""
|
||||||
|
from collections import OrderedDict
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -37,16 +38,19 @@ API_TEMP_UNITS = {
|
|||||||
TEMP_CELSIUS: 'CELSIUS',
|
TEMP_CELSIUS: 'CELSIUS',
|
||||||
}
|
}
|
||||||
|
|
||||||
API_THERMOSTAT_MODES = {
|
# Needs to be ordered dict for `async_api_set_thermostat_mode` which does a
|
||||||
climate.STATE_HEAT: 'HEAT',
|
# reverse mapping of this dict and we want to map the first occurrance of OFF
|
||||||
climate.STATE_COOL: 'COOL',
|
# back to HA state.
|
||||||
climate.STATE_AUTO: 'AUTO',
|
API_THERMOSTAT_MODES = OrderedDict([
|
||||||
climate.STATE_ECO: 'ECO',
|
(climate.STATE_HEAT, 'HEAT'),
|
||||||
climate.STATE_OFF: 'OFF',
|
(climate.STATE_COOL, 'COOL'),
|
||||||
climate.STATE_IDLE: 'OFF',
|
(climate.STATE_AUTO, 'AUTO'),
|
||||||
climate.STATE_FAN_ONLY: 'OFF',
|
(climate.STATE_ECO, 'ECO'),
|
||||||
climate.STATE_DRY: 'OFF',
|
(climate.STATE_OFF, 'OFF'),
|
||||||
}
|
(climate.STATE_IDLE, 'OFF'),
|
||||||
|
(climate.STATE_FAN_ONLY, 'OFF'),
|
||||||
|
(climate.STATE_DRY, 'OFF')
|
||||||
|
])
|
||||||
|
|
||||||
SMART_HOME_HTTP_ENDPOINT = '/api/alexa/smart_home'
|
SMART_HOME_HTTP_ENDPOINT = '/api/alexa/smart_home'
|
||||||
|
|
||||||
|
@ -902,6 +902,14 @@ async def test_thermostat(hass):
|
|||||||
assert msg['event']['payload']['type'] == 'UNSUPPORTED_THERMOSTAT_MODE'
|
assert msg['event']['payload']['type'] == 'UNSUPPORTED_THERMOSTAT_MODE'
|
||||||
hass.config.units.temperature_unit = TEMP_CELSIUS
|
hass.config.units.temperature_unit = TEMP_CELSIUS
|
||||||
|
|
||||||
|
call, _ = await assert_request_calls_service(
|
||||||
|
'Alexa.ThermostatController', 'SetThermostatMode',
|
||||||
|
'climate#test_thermostat', 'climate.set_operation_mode',
|
||||||
|
hass,
|
||||||
|
payload={'thermostatMode': 'OFF'}
|
||||||
|
)
|
||||||
|
assert call.data['operation_mode'] == 'off'
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def test_exclude_filters(hass):
|
def test_exclude_filters(hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user