From 446ebd08f8c8a4c8be8aa649ba49410f5b30997b Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 2 Sep 2024 15:17:38 +0200 Subject: [PATCH] Add dev blog about entity service schema validation (#2289) * Add dev blog about entity service schema validation * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update 2024-08-27-entity-service-schema-validation.md * correct link * Adjust * Update links to PRs --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- ...24-08-27-entity-service-schema-validation.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 blog/2024-08-27-entity-service-schema-validation.md diff --git a/blog/2024-08-27-entity-service-schema-validation.md b/blog/2024-08-27-entity-service-schema-validation.md new file mode 100644 index 00000000..4e91405c --- /dev/null +++ b/blog/2024-08-27-entity-service-schema-validation.md @@ -0,0 +1,17 @@ +--- +author: Erik Montnemery +authorURL: https://github.com/emontnemery +title: "Validation of entity action schemas" +--- + +A warning will now be logged when registering an entity action with a custom schema which does not meet at least one of these criteria: +- A validator returned by `cv.make_entity_service_schema` +- A validator returned by `cv.make_entity_service_schema`, wrapped in a `vol.Schema` +- A validator returned by `cv.make_entity_service_schema`, wrapped in a `vol.All` + +In Home Assistant Core 2025.10, it will no longer be possible to register an entity action with a custom schema not meeting this requirement. + +It's still possible to register an entity action with no schema, or with a dict representing the additional action call parameters. +The reason for the change is that if `cv.make_entity_service_schema` is not used, the service will not automatically support all possible ways of targeting entities. + +More details can be found in the [developer documentation](/docs/dev_101_services/#entity-service-actions) and in core PRs [#124102](https://github.com/home-assistant/core/pull/124102) and [#125057](https://github.com/home-assistant/core/pull/125057).