You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(home-assistant): add WebSocket-only registry and automation actions
The REST API serves entity states but not the registries behind them, so an
agent could read light.living_room without learning which device, area, or
floor it belongs to. Those registries, related-item search, per-device
automation capabilities, script execution, and config validation are only
reachable over the WebSocket API.
Add five actions covering that gap. Each is a one-shot command, so it maps
onto the existing request/response executor model without change;
subscription commands are deliberately left out because the action model has
no streaming and every Home Assistant subscription that carries an initial
snapshot already has a one-shot equivalent.
get_registries sends all five registry commands over a single connection.
The handshake costs two round trips before any command can be sent, so
batching matters more here than it would over HTTP.
"List the Home Assistant entity, device, area, floor, and label registries in one call. These registries expose the device and room structure behind entity ids, which the REST API does not serve.",
184
+
inputSchema: s.actionInput(
185
+
{
186
+
include: s.array(
187
+
"The registries to fetch. Defaults to all five when omitted or empty.",
188
+
s.stringEnum("One Home Assistant registry name.",registryNames),
189
+
),
190
+
},
191
+
[],
192
+
"Input parameters for selecting which Home Assistant registries to fetch.",
193
+
),
194
+
outputSchema: s.actionOutput(
195
+
{
196
+
entities: registryListSchema(
197
+
"The entity registry entries, including the device and area each entity belongs to.",
198
+
),
199
+
devices: registryListSchema("The device registry entries, including manufacturer, model, and area."),
200
+
areas: registryListSchema("The area registry entries."),
"The requested Home Assistant registries. Registries excluded from the request are null.",
205
+
),
206
+
}),
207
+
defineProviderAction(service,{
208
+
name: "search_related",
209
+
description:
210
+
"Find the Home Assistant items related to one entity, device, area, automation, or config entry, such as the automations that reference a given light.",
211
+
inputSchema: s.actionInput(
212
+
{
213
+
itemType: s.stringEnum("The Home Assistant item type to search from.",searchItemTypes),
214
+
itemId: s.nonEmptyString(
215
+
"The identifier of the item to search from, for example light.living_room for an entity.",
216
+
),
217
+
},
218
+
["itemType","itemId"],
219
+
"Input parameters for one Home Assistant related-items search.",
220
+
),
221
+
outputSchema: s.actionOutput(
222
+
{
223
+
related: s.looseObject("The related Home Assistant item identifiers, keyed by item type."),
224
+
},
225
+
"The Home Assistant items related to the requested item.",
226
+
),
227
+
}),
228
+
defineProviderAction(service,{
229
+
name: "list_device_automations",
230
+
description:
231
+
"List the triggers, conditions, and actions one Home Assistant device supports, for building automations against that device.",
232
+
inputSchema: s.actionInput(
233
+
{
234
+
deviceId: s.nonEmptyString("The Home Assistant device registry identifier."),
235
+
},
236
+
["deviceId"],
237
+
"Input parameters for listing one Home Assistant device's automation capabilities.",
238
+
),
239
+
outputSchema: s.actionOutput(
240
+
{
241
+
triggers: s.array("The device triggers.",s.looseObject("One Home Assistant device trigger.")),
242
+
conditions: s.array("The device conditions.",s.looseObject("One Home Assistant device condition.")),
243
+
actions: s.array("The device actions.",s.looseObject("One Home Assistant device action.")),
244
+
},
245
+
"The automation capabilities for the requested Home Assistant device.",
246
+
),
247
+
}),
248
+
defineProviderAction(service,{
249
+
name: "execute_script",
250
+
description:
251
+
"Run a Home Assistant script sequence, which can chain several service calls, delays, and conditions in one request instead of one service call at a time.",
252
+
inputSchema: s.actionInput(
253
+
{
254
+
sequence: s.array(
255
+
"The Home Assistant script steps to run, in the same format as a script's sequence.",
256
+
s.looseObject("One Home Assistant script step."),
257
+
),
258
+
variables: s.looseObject("Optional variables made available to the script sequence."),
259
+
},
260
+
["sequence"],
261
+
"Input parameters for running one Home Assistant script sequence.",
262
+
),
263
+
outputSchema: s.actionOutput(
264
+
{
265
+
context: s.nullable(s.looseObject("The Home Assistant context for the script run.")),
266
+
response: s.nullable(s.looseObject("The optional script response variable returned by Home Assistant.")),
267
+
},
268
+
"The Home Assistant script execution result.",
269
+
),
270
+
}),
271
+
defineProviderAction(service,{
272
+
name: "validate_config",
273
+
description:
274
+
"Validate Home Assistant trigger, condition, and action configurations before storing them in an automation.",
275
+
inputSchema: s.actionInput(
276
+
{
277
+
triggers: s.array("The trigger configurations to validate.",s.looseObject("One Home Assistant trigger.")),
278
+
conditions: s.array(
279
+
"The condition configurations to validate.",
280
+
s.looseObject("One Home Assistant condition."),
281
+
),
282
+
actions: s.array("The action configurations to validate.",s.looseObject("One Home Assistant action.")),
283
+
},
284
+
[],
285
+
"Input parameters for validating Home Assistant automation configuration. At least one list is required.",
286
+
),
287
+
outputSchema: s.actionOutput(
288
+
{
289
+
validation: s.looseObject(
290
+
"The validation result keyed by triggers, conditions, and actions, each with valid and error fields.",
291
+
),
292
+
},
293
+
"The Home Assistant configuration validation result.",
294
+
),
295
+
}),
144
296
];
145
297
146
-
exporttypeHomeAssistantActionName=
298
+
exporttypeHomeAssistantRestActionName=
147
299
|"get_config"
148
300
|"list_states"
149
301
|"get_state"
@@ -152,3 +304,10 @@ export type HomeAssistantActionName =
0 commit comments