alexa: Add handling for covers (#11242)

* alexa: Add handling for covers

Covers don't support either cover.turn_on or homeassistant.turn_on so
use cover.[open|close]_cover.

* alexa: Add tests for covers
This commit is contained in:
Phil Kates 2017-12-24 15:05:56 -08:00 committed by Paulus Schoutsen
parent 3fa45375d9
commit 94ac0b5ed8
2 changed files with 20 additions and 6 deletions

View file

@ -243,7 +243,11 @@ def async_api_turn_on(hass, config, request, entity):
if entity.domain == group.DOMAIN:
domain = ha.DOMAIN
yield from hass.services.async_call(domain, SERVICE_TURN_ON, {
service = SERVICE_TURN_ON
if entity.domain == cover.DOMAIN:
service = cover.SERVICE_OPEN_COVER
yield from hass.services.async_call(domain, service, {
ATTR_ENTITY_ID: entity.entity_id
}, blocking=True)
@ -259,7 +263,11 @@ def async_api_turn_off(hass, config, request, entity):
if entity.domain == group.DOMAIN:
domain = ha.DOMAIN
yield from hass.services.async_call(domain, SERVICE_TURN_OFF, {
service = SERVICE_TURN_OFF
if entity.domain == cover.DOMAIN:
service = cover.SERVICE_CLOSE_COVER
yield from hass.services.async_call(domain, service, {
ATTR_ENTITY_ID: entity.entity_id
}, blocking=True)