diff --git a/homeassistant/components/device_automation/__init__.py b/homeassistant/components/device_automation/__init__.py index e3aca4884b5..74582f0f77b 100644 --- a/homeassistant/components/device_automation/__init__.py +++ b/homeassistant/components/device_automation/__init__.py @@ -316,7 +316,9 @@ async def websocket_device_automation_get_action_capabilities(hass, connection, @websocket_api.websocket_command( { vol.Required("type"): "device_automation/condition/capabilities", - vol.Required("condition"): dict, + vol.Required("condition"): cv.DEVICE_CONDITION_BASE_SCHEMA.extend( + {}, extra=vol.ALLOW_EXTRA + ), } ) @websocket_api.async_response @@ -333,7 +335,9 @@ async def websocket_device_automation_get_condition_capabilities(hass, connectio @websocket_api.websocket_command( { vol.Required("type"): "device_automation/trigger/capabilities", - vol.Required("trigger"): dict, + vol.Required("trigger"): DEVICE_TRIGGER_BASE_SCHEMA.extend( + {}, extra=vol.ALLOW_EXTRA + ), } ) @websocket_api.async_response diff --git a/tests/components/device_automation/test_init.py b/tests/components/device_automation/test_init.py index 93d64e97959..563611b99ad 100644 --- a/tests/components/device_automation/test_init.py +++ b/tests/components/device_automation/test_init.py @@ -341,7 +341,7 @@ async def test_websocket_get_bad_condition_capabilities( { "id": 1, "type": "device_automation/condition/capabilities", - "condition": {"domain": "beer"}, + "condition": {"condition": "device", "domain": "beer", "device_id": "1234"}, } ) msg = await client.receive_json() @@ -364,7 +364,11 @@ async def test_websocket_get_no_condition_capabilities( { "id": 1, "type": "device_automation/condition/capabilities", - "condition": {"domain": "deconz"}, + "condition": { + "condition": "device", + "domain": "deconz", + "device_id": "abcd", + }, } ) msg = await client.receive_json() @@ -531,7 +535,7 @@ async def test_websocket_get_bad_trigger_capabilities( { "id": 1, "type": "device_automation/trigger/capabilities", - "trigger": {"domain": "beer"}, + "trigger": {"platform": "device", "domain": "beer", "device_id": "abcd"}, } ) msg = await client.receive_json() @@ -554,7 +558,7 @@ async def test_websocket_get_no_trigger_capabilities( { "id": 1, "type": "device_automation/trigger/capabilities", - "trigger": {"domain": "deconz"}, + "trigger": {"platform": "device", "domain": "deconz", "device_id": "abcd"}, } ) msg = await client.receive_json()