Add mode info attributes to script and automation (#37815)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
1 parent
ac0dbb17af
commit
7d77fa92c2
8 files changed
+53
-80
No files matched your search
@@ -306,25 +306,6 @@ async def test_script(hass):
|
||||
assert appliance["displayCategories"][0] == "ACTIVITY_TRIGGER"
|
||||
assert appliance["friendlyName"] == "Test script"
|
||||
|
||||
capabilities = assert_endpoint_capabilities(
|
||||
appliance, "Alexa.SceneController", "Alexa"
|
||||
)
|
||||
scene_capability = get_capability(capabilities, "Alexa.SceneController")
|
||||
assert not scene_capability["supportsDeactivation"]
|
||||
|
||||
await assert_scene_controller_works("script#test", "script.turn_on", None, hass)
|
||||
|
||||
|
||||
async def test_cancelable_script(hass):
|
||||
"""Test cancalable script discovery."""
|
||||
device = (
|
||||
"script.test_2",
|
||||
"off",
|
||||
{"friendly_name": "Test script 2", "can_cancel": True},
|
||||
)
|
||||
appliance = await discovery_test(device, hass)
|
||||
|
||||
assert appliance["endpointId"] == "script#test_2"
|
||||
capabilities = assert_endpoint_capabilities(
|
||||
appliance, "Alexa.SceneController", "Alexa"
|
||||
)
|
||||
@@ -332,7 +313,7 @@ async def test_cancelable_script(hass):
|
||||
assert scene_capability["supportsDeactivation"]
|
||||
|
||||
await assert_scene_controller_works(
|
||||
"script#test_2", "script.turn_on", "script.turn_off", hass
|
||||
"script#test", "script.turn_on", "script.turn_off", hass
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ from homeassistant.components.homekit.type_switches import (
|
||||
Switch,
|
||||
Valve,
|
||||
)
|
||||
from homeassistant.components.script import ATTR_CAN_CANCEL
|
||||
from homeassistant.components.vacuum import (
|
||||
DOMAIN as VACUUM_DOMAIN,
|
||||
SERVICE_RETURN_TO_BASE,
|
||||
@@ -80,7 +79,7 @@ async def test_outlet_set_state(hass, hk_driver, events):
|
||||
("automation.test", {}),
|
||||
("input_boolean.test", {}),
|
||||
("remote.test", {}),
|
||||
("script.test", {ATTR_CAN_CANCEL: True}),
|
||||
("script.test", {}),
|
||||
("switch.test", {}),
|
||||
],
|
||||
)
|
||||
@@ -240,19 +239,12 @@ async def test_vacuum_set_state(hass, hk_driver, events):
|
||||
assert events[-1].data[ATTR_VALUE] is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"entity_id, attrs",
|
||||
[
|
||||
("scene.test", {}),
|
||||
("script.test", {}),
|
||||
("script.test", {ATTR_CAN_CANCEL: False}),
|
||||
],
|
||||
)
|
||||
async def test_reset_switch(hass, hk_driver, entity_id, attrs, events):
|
||||
async def test_reset_switch(hass, hk_driver, events):
|
||||
"""Test if switch accessory is reset correctly."""
|
||||
domain = split_entity_id(entity_id)[0]
|
||||
domain = "scene"
|
||||
entity_id = "scene.test"
|
||||
|
||||
hass.states.async_set(entity_id, None, attrs)
|
||||
hass.states.async_set(entity_id, None)
|
||||
await hass.async_block_till_done()
|
||||
acc = Switch(hass, hk_driver, "Switch", entity_id, 2, None)
|
||||
await acc.run_handler()
|
||||
@@ -295,12 +287,8 @@ async def test_reset_switch_reload(hass, hk_driver, events):
|
||||
await acc.run_handler()
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert acc.activate_only is True
|
||||
|
||||
hass.states.async_set(entity_id, None, {ATTR_CAN_CANCEL: True})
|
||||
await hass.async_block_till_done()
|
||||
assert acc.activate_only is False
|
||||
|
||||
hass.states.async_set(entity_id, None, {ATTR_CAN_CANCEL: False})
|
||||
hass.states.async_set(entity_id, None)
|
||||
await hass.async_block_till_done()
|
||||
assert acc.activate_only is True
|
||||
assert acc.char_on.value is False
|
||||
Reference in new issue
Block a user