Change trigger platform key to trigger (#124357)

* fix

* Fix

* Fix

* Update homeassistant/helpers/config_validation.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Fix

* Fix

* Fix

* Fix

* Add more tests

* Fix

* Fix tests

* Add tests

* Let's see what the CI does

* It fails on the code that tested the thing ofc

* It fails on the code that tested the thing ofc

* Revert test thingy

* Now the test works again, lovely

* Another one

* Fix websocket thingy

* Only copy when needed

* Improve comment

* Remove test

* Fix docstring

* I think this now also work since this transforms trigger to platform

* Add comment

* Update homeassistant/helpers/config_validation.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/helpers/config_validation.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update homeassistant/helpers/config_validation.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Check for mapping

* Add test

* Update homeassistant/helpers/config_validation.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

* Update test to also test for trigger keys

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
Joost Lekkerkerker 2024-09-25 14:19:58 +02:00 committed by GitHub
parent 9d29307532
commit a1906b434f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 185 additions and 58 deletions

View file

@ -481,8 +481,11 @@ async def websocket_device_automation_get_condition_capabilities(
@websocket_api.websocket_command(
{
vol.Required("type"): "device_automation/trigger/capabilities",
vol.Required("trigger"): DEVICE_TRIGGER_BASE_SCHEMA.extend(
{}, extra=vol.ALLOW_EXTRA
# The frontend responds with `trigger` as key, while the
# `DEVICE_TRIGGER_BASE_SCHEMA` expects `platform1` as key.
vol.Required("trigger"): vol.All(
cv._backward_compat_trigger_schema, # noqa: SLF001
DEVICE_TRIGGER_BASE_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA),
),
}
)