From 2dcbb22be038e830dd976d0bb1154d44b4e1f4e3 Mon Sep 17 00:00:00 2001 From: abmantis Date: Tue, 25 Nov 2025 19:33:53 +0000 Subject: [PATCH 1/2] Document get_triggers_for_target websocket api --- docs/api/websocket.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/docs/api/websocket.md b/docs/api/websocket.md index 315015cfb70..3f58ba9d160 100644 --- a/docs/api/websocket.md +++ b/docs/api/websocket.md @@ -580,6 +580,47 @@ The response includes: When `expand_group` is set to `true`, group entities will be expanded to include their member entities instead of the group entity itself. +## Get triggers for target + +This command allows you to get all applicable triggers for entities within a given target. +```json +{ + "id": 20, + "type": "get_triggers_for_target", + "target": { + "entity_id": ["light.kitchen", "light.living_room"], + "device_id": ["device_abc123"], + "area_id": ["bedroom"], + "label_id": ["smart_lights"] + }, + // Optional: expand group entities to their members (default: true) + "expand_group": true +} +``` + +The target parameter follows the same structure as service call targets. + +The server will respond with a set of trigger identifiers that are applicable to any of the entities in the target: + +```json +{ + "id": 20, + "type": "result", + "success": true, + "result": [ + "homeassistant.event", + "homeassistant.state", + "light.turned_on", + "light.turned_off", + "light.toggle" + ] +} +``` + +The response includes trigger identifiers in the format `domain.trigger_name`. + +When `expand_group` is set to `true` (default), group entities will be expanded to include their member entities, and triggers applicable to any member will be included in the results. Otherwise, only triggers applicable to the group entities themselves will be included. + ## Error handling If an error occurs, the `success` key in the `result` message will be set to `false`. It will contain an `error` key containing an object with two keys: `code` and `message`. From dc6400a7d14c40914210ccd09954879bca18298a Mon Sep 17 00:00:00 2001 From: abmantis Date: Wed, 26 Nov 2025 18:01:18 +0000 Subject: [PATCH 2/2] Update for conditions and services --- docs/api/websocket.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/api/websocket.md b/docs/api/websocket.md index 3f58ba9d160..0731ab4dbae 100644 --- a/docs/api/websocket.md +++ b/docs/api/websocket.md @@ -580,9 +580,10 @@ The response includes: When `expand_group` is set to `true`, group entities will be expanded to include their member entities instead of the group entity itself. -## Get triggers for target +## Get triggers/conditions/services for target + +The `get_triggers_for_target`, `get_conditions_for_target`, and `get_services_for_target` commands allows you to get all applicable triggers, conditions, and services for entities within a given target. The three services share the same input and output format. -This command allows you to get all applicable triggers for entities within a given target. ```json { "id": 20, @@ -600,7 +601,7 @@ This command allows you to get all applicable triggers for entities within a giv The target parameter follows the same structure as service call targets. -The server will respond with a set of trigger identifiers that are applicable to any of the entities in the target: +The server will respond with a set of trigger/condition/service identifiers that are applicable to any of the entities in the target, in the format `domain.trigger_name`: ```json { @@ -617,8 +618,6 @@ The server will respond with a set of trigger identifiers that are applicable to } ``` -The response includes trigger identifiers in the format `domain.trigger_name`. - When `expand_group` is set to `true` (default), group entities will be expanded to include their member entities, and triggers applicable to any member will be included in the results. Otherwise, only triggers applicable to the group entities themselves will be included. ## Error handling