ha-ai-mcp-server 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ export interface SkillDefinition {
2
+ name: string;
3
+ description: string;
4
+ content: string;
5
+ }
6
+ export declare const EMBEDDED_SKILLS: Record<string, string>;
7
+ export declare function getTargetSkillsDirectories(customDir?: string): string[];
8
+ export declare function syncSkills(customDir?: string, silent?: boolean): {
9
+ installedCount: number;
10
+ targetDirs: string[];
11
+ };
12
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6dlD,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CA6BvE;AAED,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAkC/G"}
@@ -0,0 +1,537 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import * as os from "node:os";
4
+ export const EMBEDDED_SKILLS = {
5
+ "ha-device-controller": `---
6
+ name: ha-device-controller
7
+ description: SOP for safely discovering entities, calling Home Assistant services, controlling smart devices, and verifying state transitions.
8
+ ---
9
+
10
+ # Home Assistant Device Controller Skill
11
+
12
+ ## Overview
13
+
14
+ The \`ha-device-controller\` skill defines the Standard Operating Procedure (SOP) for querying real-time smart device states, invoking Home Assistant domain services (lights, switches, climate, media players, covers), and validating that the target hardware correctly transitions state.
15
+
16
+ ---
17
+
18
+ ## Workflow & Steps
19
+
20
+ \`\`\`mermaid
21
+ flowchart TD
22
+ A[Step 1: Discover Entity & Current State] --> B[Step 2: Validate Domain & Payload Schema]
23
+ B --> C[Step 3: Execute Service Call]
24
+ C --> D[Step 4: Verify Post-Execution State]
25
+ D --> E{State Verified?}
26
+ E -- Yes --> F[Success & Report Confirmation]
27
+ E -- No --> G[Inspect System Logs & Diagnose]
28
+ \`\`\`
29
+
30
+ ### Step 1: Discover Entity & Current State
31
+ Before sending control commands or invoking services, locate the exact target entity ID and inspect its current attributes.
32
+ - Use \`ha_system_list_entities\` with \`domain_filter\` (e.g. \`light\`, \`switch\`, \`climate\`) or \`search_query\`.
33
+ - Verify the current \`state\` (e.g., \`off\` vs \`on\`), supported color modes, preset modes, or available features.
34
+
35
+ \`\`\`json
36
+ // Example call: ha_system_list_entities
37
+ {
38
+ "domain_filter": "light",
39
+ "search_query": "office"
40
+ }
41
+ \`\`\`
42
+
43
+ ### Step 2: Validate Domain & Payload Schema
44
+ Construct the service invocation payload matching Home Assistant Core service specifications.
45
+ - Common services include:
46
+ - \`light.turn_on\`, \`light.turn_off\`, \`light.toggle\` (with \`brightness\`, \`rgb_color\`, \`color_temp_kelvin\`)
47
+ - \`switch.turn_on\`, \`switch.turn_off\`, \`switch.toggle\`
48
+ - \`climate.set_temperature\`, \`climate.set_hvac_mode\` (with \`temperature\`, \`hvac_mode\`)
49
+ - \`cover.open_cover\`, \`cover.close_cover\`, \`cover.set_cover_position\`
50
+ - \`homeassistant.update_entity\`, \`homeassistant.reload_all\`
51
+
52
+ ### Step 3: Execute Service Call
53
+ Invoke the service using \`ha_system_call_service\`.
54
+ - Provide the \`domain\`, \`service\`, and \`service_data\` payload.
55
+
56
+ \`\`\`json
57
+ // Example call: ha_system_call_service
58
+ {
59
+ "domain": "light",
60
+ "service": "turn_on",
61
+ "service_data": {
62
+ "entity_id": "light.office_light",
63
+ "brightness": 200
64
+ }
65
+ }
66
+ \`\`\`
67
+
68
+ ### Step 4: Verify Post-Execution State
69
+ Confirm that the physical device or software entity acknowledged the command and changed state.
70
+ - Re-query \`ha_system_list_entities\` with \`search_query\` targeting the entity.
71
+ - Compare \`last_changed\` and \`state\` against expected outcome.
72
+ - If the entity remains unchanged or reports \`unavailable\`, tail recent logs with \`ha_system_get_logs\` to diagnose integration communication errors.
73
+
74
+ ---
75
+
76
+ ## Tool Reference
77
+
78
+ | Tool | Purpose | Key Parameters |
79
+ | :--- | :--- | :--- |
80
+ | \`ha_system_list_entities\` | Discover entities and inspect live states | \`domain_filter\`, \`search_query\` |
81
+ | \`ha_system_call_service\` | Call any Home Assistant domain service | \`domain\`, \`service\`, \`service_data\` |
82
+ | \`ha_system_get_logs\` | Inspect system error logs on failures | \`lines_count\`, \`source\` |
83
+ | \`ha_system_health\` | Verify API and integration connectivity | *(none)* |
84
+
85
+ ---
86
+
87
+ ## Safety Rules & Best Practices
88
+
89
+ 1. **Verify Before Execution**: Always confirm entity identity with \`ha_system_list_entities\` before triggering destructive or high-energy actions (heaters, locks, garage doors).
90
+ 2. **Post-State Validation**: Never assume a service call succeeded solely based on HTTP 200; verify the entity \`state\` afterwards.
91
+ 3. **Graceful Error Handling**: If a device fails to respond, inspect \`ha_system_get_logs\` for Zigbee/Z-Wave/Wi-Fi timeout errors before retrying in a loop.
92
+ `,
93
+ "ha-dashboard-designer": `---
94
+ name: ha-dashboard-designer
95
+ description: SOP for creating, previewing, and visually iterating Home Assistant Lovelace dashboards using MCP tools and Playwright screenshots.
96
+ ---
97
+
98
+ # Home Assistant Dashboard Designer Skill
99
+
100
+ ## Overview
101
+
102
+ The \`ha-dashboard-designer\` skill provides a complete Standard Operating Procedure (SOP) for creating, modifying, and polishing Home Assistant Lovelace dashboards with AI-driven visual validation. By combining entity discovery, configuration management with automatic snapshot safety, and headless Playwright screenshot rendering, this skill ensures dashboards are aesthetically refined, responsive across devices, and functional.
103
+
104
+ ---
105
+
106
+ ## Workflow & Steps
107
+
108
+ \`\`\`mermaid
109
+ flowchart TD
110
+ A[Step 1: Discover Entities] --> B[Step 2: Inspect Dashboard Config]
111
+ B --> C[Step 3: Propose Layout & Cards]
112
+ C --> D[Step 4: Save Lovelace YAML]
113
+ D --> E[Step 5: Capture Screenshots]
114
+ E --> F{Step 6: Visual Inspection Loop}
115
+ F -- Issues Found --> C
116
+ F -- Approved --> G[Finalize & Present]
117
+ \`\`\`
118
+
119
+ ### Step 1: Query Available Entities
120
+ Before designing or modifying any dashboard cards, discover the available entities, their domains, states, friendly names, and device classes.
121
+ - Use \`ha_system_list_entities\` with domain filters (e.g. \`light\`, \`climate\`, \`sensor\`, \`switch\`, \`media_player\`) or search terms.
122
+ - Verify entity availability and state types (e.g. numeric sensors, binary on/off states, list attributes).
123
+
124
+ \`\`\`json
125
+ // Example call: ha_system_list_entities
126
+ {
127
+ "domain_filter": "climate",
128
+ "search_query": "living_room"
129
+ }
130
+ \`\`\`
131
+
132
+ ### Step 2: Inspect Existing Dashboard Configuration
133
+ Inspect the current dashboard configuration to maintain theme consistency, title naming conventions, badge configurations, and view hierarchy.
134
+ - Use \`ha_dashboard_get_config\` with the target \`dashboard_slug\` (e.g. \`lovelace\` for default or custom slugs like \`dashboard-energy\`).
135
+ - Analyze existing views, card types, custom themes, and column layouts.
136
+
137
+ \`\`\`json
138
+ // Example call: ha_dashboard_get_config
139
+ {
140
+ "dashboard_slug": "lovelace"
141
+ }
142
+ \`\`\`
143
+
144
+ ### Step 3: Propose Card Layout & Design
145
+ Design card layouts tailored to the user requirements and device constraints:
146
+ - **Card Selection**:
147
+ - **Tile Card**: Modern HA standard for lights, switches, media players with feature controls.
148
+ - **Mushroom Cards**: Minimalist, touch-friendly UI for room summaries, chips, and climate.
149
+ - **Grid & Stacks**: \`grid\`, \`horizontal-stack\`, and \`vertical-stack\` for structured alignment.
150
+ - **Glance & Entities**: Compact summaries for sensors (temperatures, battery levels).
151
+ - **ApexCharts & Gauges**: Historical trends, energy metrics, and analog gauges.
152
+ - **Conditional Cards**: Dynamic cards that appear only when specific states match (e.g. doors open, low battery).
153
+ - **Responsive Guidelines**:
154
+ - Use 2-4 columns on desktop layouts.
155
+ - Ensure single-column or wrapping behavior on mobile screens.
156
+ - Group cards logically by room or domain.
157
+
158
+ ### Step 4: Save Lovelace YAML Configuration
159
+ Apply the updated dashboard configuration safely.
160
+ - Use \`ha_dashboard_save_config\` supplying the YAML configuration, target \`dashboard_slug\`, and a descriptive \`label\`.
161
+ - Note: \`ha_dashboard_save_config\` automatically creates a safety snapshot before applying modifications and performs YAML schema validation.
162
+
163
+ \`\`\`json
164
+ // Example call: ha_dashboard_save_config
165
+ {
166
+ "dashboard_slug": "lovelace",
167
+ "label": "Add living room climate tile and energy gauge",
168
+ "config_yaml": "title: Home\\nviews:\\n - title: Main\\n path: main\\n cards:\\n - type: tile\\n entity: light.living_room\\n"
169
+ }
170
+ \`\`\`
171
+
172
+ ### Step 5: Capture Rendered Screenshots
173
+ Verify the visual rendering of the updated dashboard using the headless Playwright browser.
174
+ - Use \`ha_dashboard_render_screenshot\` with the target \`url_path\` (e.g. \`lovelace/0\`, \`dashboard-energy\`).
175
+ - Always test across multiple device presets:
176
+ - \`desktop\` (1920x1080)
177
+ - \`mobile\` (375x812)
178
+ - \`tablet\` (768x1024)
179
+ - Test both light and dark modes when relevant using \`dark_mode: true\`.
180
+ - Use \`element_selector\` when focusing on a specific card component.
181
+
182
+ \`\`\`json
183
+ // Example call: ha_dashboard_render_screenshot
184
+ {
185
+ "url_path": "lovelace/0",
186
+ "device_preset": "desktop",
187
+ "dark_mode": false
188
+ }
189
+ \`\`\`
190
+
191
+ ### Step 6: Visual Inspection Loop & Iteration
192
+ Analyze the captured screenshot image using multimodal vision inspection:
193
+ 1. **Alignment & Grid Symmetry**: Are card borders aligned? Are heights balanced across columns?
194
+ 2. **Typography & Readability**: Are labels truncated? Is text overflowing container bounds?
195
+ 3. **Icons & States**: Are MDI icons rendering correctly? Are active entity states visually distinct?
196
+ 4. **Color & Contrast**: Do accent colors match the background theme in both light and dark mode?
197
+ 5. **Mobile Responsiveness**: Do horizontal stacks wrap cleanly without clipping horizontal scrollbars?
198
+
199
+ *If any visual flaw or layout inconsistency is detected, return to Step 3, adjust the Lovelace YAML, re-save, and re-capture until the dashboard achieves optimal visual fidelity.*
200
+
201
+ ---
202
+
203
+ ## Tool Reference
204
+
205
+ | Tool | Purpose | Key Parameters |
206
+ | :--- | :--- | :--- |
207
+ | \`ha_system_list_entities\` | Discover entities & states | \`domain_filter\`, \`search_query\` |
208
+ | \`ha_dashboard_get_config\` | Fetch Lovelace dashboard YAML/JSON | \`dashboard_slug\` |
209
+ | \`ha_dashboard_save_config\` | Snapshot, validate, and write dashboard | \`config_yaml\`, \`dashboard_slug\`, \`label\` |
210
+ | \`ha_dashboard_render_screenshot\` | Headless Playwright visual capture | \`url_path\`, \`device_preset\`, \`dark_mode\`, \`element_selector\` |
211
+
212
+ ---
213
+
214
+ ## Safety Rules & Best Practices
215
+
216
+ 1. **Automatic Snapshot Preservation**: Never edit Lovelace files directly outside of \`ha_dashboard_save_config\`, ensuring an automatic snapshot ID is always generated for rollback.
217
+ 2. **Multi-Viewport Testing**: Every dashboard modification must be verified on both \`desktop\` and \`mobile\` presets before marking complete.
218
+ 3. **Graceful Entity Fallbacks**: Use conditional cards or friendly names so cards remain visually appealing even when sensors are temporarily unavailable.
219
+ 4. **Non-Destructive View Updates**: When adding new features, prefer creating dedicated views or sub-views rather than overwriting existing user dashboards without request.
220
+ `,
221
+ "ha-automation-builder": `---
222
+ name: ha-automation-builder
223
+ description: SOP for drafting, validating, testing, and debugging Home Assistant automations and scripts safely.
224
+ ---
225
+
226
+ # Home Assistant Automation Builder Skill
227
+
228
+ ## Overview
229
+
230
+ The \`ha-automation-builder\` skill provides an end-to-end Standard Operating Procedure (SOP) for drafting, writing, validating, and testing Home Assistant automations and scripts. It enforces best practices such as unique ID assignment, syntax validation, automated snapshot generation before disk modification, live entity validation, and post-deployment trigger execution verification.
231
+
232
+ ---
233
+
234
+ ## Workflow & Steps
235
+
236
+ \`\`\`mermaid
237
+ flowchart TD
238
+ A[Step 1: Discover Entities & Services] --> B[Step 2: Read Existing Automations]
239
+ B --> C[Step 3: Construct Safe YAML Block]
240
+ C --> D[Step 4: Write Automation & Auto-Reload]
241
+ D --> E[Step 5: Test Trigger & Inspect Logs]
242
+ E --> F{Verification Check}
243
+ F -- Error in Logs --> C
244
+ F -- Success --> G[Complete]
245
+ \`\`\`
246
+
247
+ ### Step 1: Discover Entity IDs & Services
248
+ Before authoring automation logic, discover all target entities, their current states, supported attributes, and service domains.
249
+ - Use \`ha_system_list_entities\` to look up sensor names, switch entity IDs, zone entities, or input helpers.
250
+ - Verify entity domains (e.g. \`binary_sensor.front_door\`, \`light.hallway\`, \`climate.thermostat\`).
251
+
252
+ \`\`\`json
253
+ // Example call: ha_system_list_entities
254
+ {
255
+ "domain_filter": "binary_sensor",
256
+ "search_query": "motion"
257
+ }
258
+ \`\`\`
259
+
260
+ ### Step 2: Read Existing Automations & Avoid Collisions
261
+ Examine existing automations to avoid duplicate aliases, conflicting triggers, or ID collisions.
262
+ - Use \`ha_automation_list\` with domain \`automation\` (or \`script\` / \`scene\`) to view active entity IDs, friendly names, and trigger times.
263
+ - Use \`ha_automation_read\` with a specific automation ID or alias to inspect existing YAML structure and conventions.
264
+
265
+ \`\`\`json
266
+ // Example call: ha_automation_list
267
+ {
268
+ "domain": "automation"
269
+ }
270
+
271
+ // Example call: ha_automation_read
272
+ {
273
+ "automation_id": "night_light_auto_off"
274
+ }
275
+ \`\`\`
276
+
277
+ ### Step 3: Construct Safe YAML Automation Blocks
278
+ Structure the automation with clear metadata, robust triggers, defensive conditions, and appropriate execution modes.
279
+ - **Unique Identifier**: Always assign a deterministic or timestamped \`id\` (e.g. \`id: '1725100000123'\` or \`id: auto_living_room_motion\`).
280
+ - **Alias & Description**: Provide a clear human-readable \`alias\` and \`description\`.
281
+ - **Triggers**: Define precise triggers with thresholds or duration (e.g. \`for: { minutes: 5 }\`).
282
+ - **Conditions**: Use conditions to filter execution (e.g. sun elevation, state conditions, time ranges).
283
+ - **Actions**: Utilize official Home Assistant service targets (\`action:\` / \`service:\`) and avoid deprecated syntax.
284
+ - **Execution Mode**: Choose the appropriate \`mode\`:
285
+ - \`single\`: Default, drops concurrent triggers.
286
+ - \`restart\`: Ideal for motion timers (resets timer on new motion).
287
+ - \`queued\`: Enqueues triggers up to \`max\`.
288
+ - \`parallel\`: Executes independently up to \`max\`.
289
+
290
+ \`\`\`yaml
291
+ - id: "auto_hallway_motion_light"
292
+ alias: "Hallway: Motion-Activated Nightlight"
293
+ description: "Turn on hallway light on motion after sunset and turn off after 3 minutes of no motion."
294
+ mode: restart
295
+ trigger:
296
+ - platform: state
297
+ entity_id: binary_sensor.hallway_motion
298
+ to: "on"
299
+ condition:
300
+ - condition: state
301
+ entity_id: sun.sun
302
+ state: "below_horizon"
303
+ action:
304
+ - action: light.turn_on
305
+ target:
306
+ entity_id: light.hallway
307
+ data:
308
+ brightness_pct: 30
309
+ - wait_for_trigger:
310
+ - platform: state
311
+ entity_id: binary_sensor.hallway_motion
312
+ to: "off"
313
+ for:
314
+ minutes: 3
315
+ - action: light.turn_off
316
+ target:
317
+ entity_id: light.hallway
318
+ \`\`\`
319
+
320
+ ### Step 4: Write Automation with Auto-Reload & Snapshot
321
+ Write the automation block to \`automations.yaml\` safely.
322
+ - Use \`ha_automation_write\` providing the \`automation_id\`, \`yaml_code\`, and a descriptive \`label\`.
323
+ - Note: \`ha_automation_write\` automatically creates a safety snapshot in the Addon storage, validates YAML syntax, appends or updates the target automation block, and triggers \`automation.reload\`.
324
+
325
+ \`\`\`json
326
+ // Example call: ha_automation_write
327
+ {
328
+ "automation_id": "auto_hallway_motion_light",
329
+ "label": "Add hallway nightlight motion automation",
330
+ "yaml_code": "- id: 'auto_hallway_motion_light'\\n alias: 'Hallway: Motion-Activated Nightlight'\\n mode: restart\\n trigger:\\n - platform: state\\n entity_id: binary_sensor.hallway_motion\\n to: 'on'\\n action:\\n - action: light.turn_on\\n target:\\n entity_id: light.hallway\\n"
331
+ }
332
+ \`\`\`
333
+
334
+ ### Step 5: Test Trigger & Inspect Execution Logs
335
+ Validate that the newly registered automation triggers properly and executes its action sequence without runtime errors.
336
+ - Use \`ha_automation_trigger\` with \`entity_id\` (e.g. \`automation.hallway_motion_activated_nightlight\`).
337
+ - Use \`ha_system_get_logs\` to tail the latest logs and confirm clean execution with zero template errors or missing service faults.
338
+
339
+ \`\`\`json
340
+ // Example call: ha_automation_trigger
341
+ {
342
+ "entity_id": "automation.hallway_motion_activated_nightlight"
343
+ }
344
+
345
+ // Example call: ha_system_get_logs
346
+ {
347
+ "lines_count": 50
348
+ }
349
+ \`\`\`
350
+
351
+ ---
352
+
353
+ ## Tool Reference
354
+
355
+ | Tool | Purpose | Key Parameters |
356
+ | :--- | :--- | :--- |
357
+ | \`ha_system_list_entities\` | Query entity IDs, states, attributes | \`domain_filter\`, \`search_query\` |
358
+ | \`ha_automation_list\` | List automations, scripts, or scenes | \`domain\` |
359
+ | \`ha_automation_read\` | Fetch YAML block of an automation | \`automation_id\` |
360
+ | \`ha_automation_write\` | Validate, snapshot, write YAML & reload | \`automation_id\`, \`yaml_code\`, \`label\` |
361
+ | \`ha_automation_trigger\` | Execute automation trigger manually | \`entity_id\` |
362
+ | \`ha_system_get_logs\` | Retrieve sanitized core log lines | \`lines_count\` |
363
+
364
+ ---
365
+
366
+ ## Safety Rules & Best Practices
367
+
368
+ 1. **Unique ID Requirement**: Every automation block MUST have an explicit \`id\` field to enable UI editing and targeted updates.
369
+ 2. **Deterministic Reloading**: Never rely on full Home Assistant restarts for automation testing; use \`ha_automation_write\`'s built-in service reload.
370
+ 3. **Log Verification Gate**: Never declare an automation complete without checking \`ha_system_get_logs\` for template or service execution warnings.
371
+ 4. **Appropriate Mode Selection**: Use \`mode: restart\` for motion/timer automations and \`mode: single\` or \`mode: queued\` for security/alert automations.
372
+ `,
373
+ "ha-troubleshooter": `---
374
+ name: ha-troubleshooter
375
+ description: SOP for diagnosing Home Assistant errors, reviewing sanitized system logs, and executing safety rollbacks.
376
+ ---
377
+
378
+ # Home Assistant Troubleshooter Skill
379
+
380
+ ## Overview
381
+
382
+ The \`ha-troubleshooter\` skill establishes a structured, safety-first Standard Operating Procedure (SOP) for diagnosing system faults, analyzing sanitized log traces, detecting configuration syntax errors or integration crashes, and performing instant, non-destructive snapshot rollbacks in Home Assistant.
383
+
384
+ ---
385
+
386
+ ## Workflow & Steps
387
+
388
+ \`\`\`mermaid
389
+ flowchart TD
390
+ A[Step 1: System Healthcheck] --> B[Step 2: Tail & Analyze Logs]
391
+ B --> C{Fault / Regression Detected?}
392
+ C -- No Fault --> D[System Operational]
393
+ C -- Yes --> E[Step 3: Execute Safety Rollback]
394
+ E --> F[Step 4: Verify Post-Restore Health]
395
+ F --> G[Log Post-Mortem & Fix Root Cause]
396
+ \`\`\`
397
+
398
+ ### Step 1: System Healthcheck
399
+ Initiate diagnostics by checking the operational status of both the Home Assistant Core API and the AI Addon helper daemon.
400
+ - Use \`ha_system_health\` to evaluate connectivity, component reachability, and API response latencies.
401
+ - Determine whether Home Assistant is running in normal, degraded, or recovery state.
402
+
403
+ \`\`\`json
404
+ // Example call: ha_system_health
405
+ {}
406
+ \`\`\`
407
+
408
+ ### Step 2: Tail & Analyze Sanitized Logs
409
+ Inspect system logs to identify tracebacks, deprecation warnings, unhandled exceptions, template rendering faults, or integration connection failures.
410
+ - Use \`ha_system_get_logs\` specifying \`lines_count\` (e.g. 50-200 lines) and optionally \`source\` (\`core\`, \`supervisor\`, \`all\`).
411
+ - Note: System logs are automatically sanitized by the Addon backend to redact sensitive tokens, passwords, and authorization headers.
412
+ - Categorize observed errors:
413
+ - **YAML / Syntax Errors**: Invalid keys, missing indentation, or schema validation failures in \`configuration.yaml\`, \`automations.yaml\`, or dashboards.
414
+ - **Entity / Device Unavailable**: Missing integrations, offline Zigbee/Z-Wave nodes, or changed entity IDs.
415
+ - **Service Call Failures**: Invocation of nonexistent services or missing target parameters.
416
+
417
+ \`\`\`json
418
+ // Example call: ha_system_get_logs
419
+ {
420
+ "lines_count": 100,
421
+ "source": "all"
422
+ }
423
+ \`\`\`
424
+
425
+ ### Step 3: Execute Safety Rollback or Manual Backup
426
+ When an edit, automation change, or dashboard update leads to instability, regression, or syntax errors, perform an immediate safety rollback.
427
+ - If performing experimental diagnostics before a fix, create a pre-fix checkpoint using \`ha_system_create_backup\` with a descriptive \`label\`.
428
+ - If an issue was introduced by a previous tool call, locate the corresponding \`snapshot_id\` from the tool response or snapshot history.
429
+ - Use \`ha_system_restore_backup\` with \`snapshot_id\` to restore the file atomically. The Addon automatically creates a safety backup of current disk state before restoring.
430
+
431
+ \`\`\`json
432
+ // Example call: ha_system_create_backup
433
+ {
434
+ "label": "Pre-troubleshooting configuration checkpoint"
435
+ }
436
+
437
+ // Example call: ha_system_restore_backup
438
+ {
439
+ "snapshot_id": "snap_20260831_093000_automations_yaml"
440
+ }
441
+ \`\`\`
442
+
443
+ ### Step 4: Verify Post-Restore System Health
444
+ After executing a rollback or applying a corrective patch, verify that the system has returned to full operational capacity.
445
+ - Re-run \`ha_system_health\` to verify that API and daemon health check reports are \`ok\`.
446
+ - Tail recent logs with \`ha_system_get_logs\` to ensure error loops and exception tracebacks have cleared.
447
+
448
+ \`\`\`json
449
+ // Example call: ha_system_health
450
+ {}
451
+
452
+ // Example call: ha_system_get_logs
453
+ {
454
+ "lines_count": 50
455
+ }
456
+ \`\`\`
457
+
458
+ ---
459
+
460
+ ## Tool Reference
461
+
462
+ | Tool | Purpose | Key Parameters |
463
+ | :--- | :--- | :--- |
464
+ | \`ha_system_health\` | Query HA Core API & Addon daemon health | *(none)* |
465
+ | \`ha_system_get_logs\` | Fetch sanitized tail of HA core & supervisor logs | \`lines_count\`, \`source\` |
466
+ | \`ha_system_create_backup\` | Create named manual snapshot backup | \`label\` |
467
+ | \`ha_system_restore_backup\` | Restore configuration from snapshot ID | \`snapshot_id\` |
468
+
469
+ ---
470
+
471
+ ## Safety Rules & Best Practices
472
+
473
+ 1. **Non-Destructive Restoration**: All restore operations conducted via \`ha_system_restore_backup\` automatically preserve the overwritten version in a safety snapshot.
474
+ 2. **Sanitized Output Awareness**: \`ha_system_get_logs\` redacts secrets; never attempt to bypass log sanitization to inspect raw credentials.
475
+ 3. **Rollback Over Patching Broken States**: When an unverified configuration breaks critical automations, roll back to the last known good snapshot before attempting redesigns.
476
+ 4. **Mandatory Post-Restore Verification**: Always verify both \`ha_system_health\` and \`ha_system_get_logs\` after any restore or configuration repair.
477
+ `
478
+ };
479
+ export function getTargetSkillsDirectories(customDir) {
480
+ if (customDir) {
481
+ return [path.resolve(customDir)];
482
+ }
483
+ const homedir = os.homedir();
484
+ const candidates = [];
485
+ const geminiSkills = path.join(homedir, ".gemini", "config", "skills");
486
+ if (fs.existsSync(geminiSkills)) {
487
+ candidates.push(geminiSkills);
488
+ }
489
+ const claudeSkills = path.join(homedir, ".claude", "skills");
490
+ if (fs.existsSync(claudeSkills)) {
491
+ candidates.push(claudeSkills);
492
+ }
493
+ const opencodeSkills = path.join(homedir, ".opencode", "skills");
494
+ if (fs.existsSync(opencodeSkills)) {
495
+ candidates.push(opencodeSkills);
496
+ }
497
+ // If none exist, default to gemini skills path
498
+ if (candidates.length === 0) {
499
+ candidates.push(geminiSkills);
500
+ }
501
+ return candidates;
502
+ }
503
+ export function syncSkills(customDir, silent = false) {
504
+ const targetDirs = getTargetSkillsDirectories(customDir);
505
+ let installedCount = 0;
506
+ for (const baseDir of targetDirs) {
507
+ if (!fs.existsSync(baseDir)) {
508
+ try {
509
+ fs.mkdirSync(baseDir, { recursive: true });
510
+ }
511
+ catch {
512
+ continue;
513
+ }
514
+ }
515
+ for (const [skillName, content] of Object.entries(EMBEDDED_SKILLS)) {
516
+ try {
517
+ const skillDir = path.join(baseDir, skillName);
518
+ if (!fs.existsSync(skillDir)) {
519
+ fs.mkdirSync(skillDir, { recursive: true });
520
+ }
521
+ const skillPath = path.join(skillDir, "SKILL.md");
522
+ fs.writeFileSync(skillPath, content, "utf8");
523
+ installedCount++;
524
+ if (!silent) {
525
+ console.log(`✓ Synchronized skill: ${skillName} -> ${skillPath}`);
526
+ }
527
+ }
528
+ catch (err) {
529
+ if (!silent) {
530
+ console.warn(`⚠️ Failed writing skill ${skillName} to ${baseDir}:`, err.message);
531
+ }
532
+ }
533
+ }
534
+ }
535
+ return { installedCount, targetDirs };
536
+ }
537
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAQ9B,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,sBAAsB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuFzB;IAEC,uBAAuB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+H1B;IAEC,uBAAuB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuJ1B;IAEC,mBAAmB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAAE,CAAC;AACxC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,5 +6,6 @@ export declare function createServer(providedClients?: ToolClients): {
6
6
  server: McpServer;
7
7
  clients: ToolClients;
8
8
  };
9
- export declare const createMcpServer: typeof createServer;
9
+ import { syncSkills } from "./cli/skills.js";
10
+ export { syncSkills };
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAcpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,wBAAgB,aAAa,IAAI,WAAW,CAY3C;AAED,wBAAgB,YAAY,CAAC,eAAe,CAAC,EAAE,WAAW,GAAG;IAC3D,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;CACtB,CAaA;AAGD,eAAO,MAAM,eAAe,qBAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAcpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,wBAAgB,aAAa,IAAI,WAAW,CAY3C;AAED,wBAAgB,YAAY,CAAC,eAAe,CAAC,EAAE,WAAW,GAAG;IAC3D,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;CACtB,CAaA;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -35,9 +35,26 @@ export function createServer(providedClients) {
35
35
  registerSystemTools(server, clients);
36
36
  return { server, clients };
37
37
  }
38
- // Backward-compatible alias
39
- export const createMcpServer = createServer;
38
+ import { syncSkills } from "./cli/skills.js";
39
+ export { syncSkills };
40
40
  async function main() {
41
+ const args = process.argv.slice(2);
42
+ if (args.includes("install-skills") || args.includes("update-skills") || args.includes("sync-skills")) {
43
+ const customDir = args.find((a) => a.startsWith("--dir="))?.split("=")[1];
44
+ console.log("🚀 Synchronizing Home Assistant AI Skills...");
45
+ const result = syncSkills(customDir, false);
46
+ console.log(`✨ Successfully synchronized ${result.installedCount} skill files across ${result.targetDirs.length} directories.`);
47
+ process.exit(0);
48
+ }
49
+ // Background auto-sync skills if enabled or if standard skills folder exists
50
+ if (process.env.AUTO_SYNC_SKILLS !== "false") {
51
+ try {
52
+ syncSkills(undefined, true);
53
+ }
54
+ catch {
55
+ // Non-blocking auto-sync
56
+ }
57
+ }
41
58
  const { server, clients } = createServer();
42
59
  const transport = new StdioServerTransport();
43
60
  const cleanup = async () => {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,mBAAmB,E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EAAE,CAAC;QACxE,OAAO,CACL,eAAe,KAAK,kBAAkB;YACtC,aAAa,CAAC,QAAQ,CAAC,eAAe,CAAC;YACvC,aAAa,CAAC,QAAQ,CAAC,cAAc,CAAC,CACvC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,IAAI,kBAAkB,EAAE,EAAE,CAAC;IACzB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,aAAa,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -21,7 +21,7 @@ export const getLogsSchema = {
21
21
  .enum(["core", "supervisor", "all"])
22
22
  .optional()
23
23
  .default("all")
24
- .describe("Log source to query ('core' for HA Core events, 'supervisor' for Docker/Add-on lifecycle, 'all' for combined)"),
24
+ .describe("Log source to query ('core' for HA Core events, 'supervisor' for Docker/App lifecycle, 'all' for combined)"),
25
25
  };
26
26
  export const createBackupSchema = {
27
27
  label: z
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/tools/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,6EAA6E,CAAC;IAC1F,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,mDAAmD,CAAC;CACjE,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,WAAW,EAAE,CAAC;SACX,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,EAAE;SAC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CAAC,OAAO,CAAC,CACxC,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,yBAAyB,EACzB;QACE,WAAW,EAAE,gGAAgG;QAC7G,WAAW,EAAE,kBAAkB;KAChC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,CACxD,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,wBAAwB,EACxB;QACE,WAAW,EAAE,qGAAqG;QAClH,WAAW,EAAE,iBAAiB;KAC/B,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,IAAI,CAAC,CACvD,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,WAAW,EAAE,2DAA2D;QACxE,WAAW,EAAE,aAAa;KAC3B,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,CACnD,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,yBAAyB,EACzB;QACE,WAAW,EAAE,wDAAwD;QACrE,WAAW,EAAE,kBAAkB;KAChC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,CACxD,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,0BAA0B,EAC1B;QACE,WAAW,EAAE,6EAA6E;QAC1F,WAAW,EAAE,mBAAmB;KACjC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,OAAO,EAAE,IAAI,CAAC,CACzD,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "ha-ai-mcp-server",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Model Context Protocol server for Home Assistant with Playwright visual feedback",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
8
- "ha-ai-mcp": "./dist/index.js"
8
+ "ha-ai-mcp": "./dist/index.js",
9
+ "ha-ai-mcp-server": "./dist/index.js"
9
10
  },
10
11
  "scripts": {
11
12
  "build": "tsc",
@@ -35,5 +36,14 @@
35
36
  "lovelace",
36
37
  "ai-agents"
37
38
  ],
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/sserhii-tech/home-assistant-mcp.git",
42
+ "directory": "mcp-server"
43
+ },
44
+ "homepage": "https://github.com/sserhii-tech/home-assistant-mcp#readme",
45
+ "bugs": {
46
+ "url": "https://github.com/sserhii-tech/home-assistant-mcp/issues"
47
+ },
38
48
  "license": "Apache-2.0"
39
49
  }
@@ -0,0 +1,555 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import * as os from "node:os";
4
+
5
+ export interface SkillDefinition {
6
+ name: string;
7
+ description: string;
8
+ content: string;
9
+ }
10
+
11
+ export const EMBEDDED_SKILLS: Record<string, string> = {
12
+ "ha-device-controller": `---
13
+ name: ha-device-controller
14
+ description: SOP for safely discovering entities, calling Home Assistant services, controlling smart devices, and verifying state transitions.
15
+ ---
16
+
17
+ # Home Assistant Device Controller Skill
18
+
19
+ ## Overview
20
+
21
+ The \`ha-device-controller\` skill defines the Standard Operating Procedure (SOP) for querying real-time smart device states, invoking Home Assistant domain services (lights, switches, climate, media players, covers), and validating that the target hardware correctly transitions state.
22
+
23
+ ---
24
+
25
+ ## Workflow & Steps
26
+
27
+ \`\`\`mermaid
28
+ flowchart TD
29
+ A[Step 1: Discover Entity & Current State] --> B[Step 2: Validate Domain & Payload Schema]
30
+ B --> C[Step 3: Execute Service Call]
31
+ C --> D[Step 4: Verify Post-Execution State]
32
+ D --> E{State Verified?}
33
+ E -- Yes --> F[Success & Report Confirmation]
34
+ E -- No --> G[Inspect System Logs & Diagnose]
35
+ \`\`\`
36
+
37
+ ### Step 1: Discover Entity & Current State
38
+ Before sending control commands or invoking services, locate the exact target entity ID and inspect its current attributes.
39
+ - Use \`ha_system_list_entities\` with \`domain_filter\` (e.g. \`light\`, \`switch\`, \`climate\`) or \`search_query\`.
40
+ - Verify the current \`state\` (e.g., \`off\` vs \`on\`), supported color modes, preset modes, or available features.
41
+
42
+ \`\`\`json
43
+ // Example call: ha_system_list_entities
44
+ {
45
+ "domain_filter": "light",
46
+ "search_query": "office"
47
+ }
48
+ \`\`\`
49
+
50
+ ### Step 2: Validate Domain & Payload Schema
51
+ Construct the service invocation payload matching Home Assistant Core service specifications.
52
+ - Common services include:
53
+ - \`light.turn_on\`, \`light.turn_off\`, \`light.toggle\` (with \`brightness\`, \`rgb_color\`, \`color_temp_kelvin\`)
54
+ - \`switch.turn_on\`, \`switch.turn_off\`, \`switch.toggle\`
55
+ - \`climate.set_temperature\`, \`climate.set_hvac_mode\` (with \`temperature\`, \`hvac_mode\`)
56
+ - \`cover.open_cover\`, \`cover.close_cover\`, \`cover.set_cover_position\`
57
+ - \`homeassistant.update_entity\`, \`homeassistant.reload_all\`
58
+
59
+ ### Step 3: Execute Service Call
60
+ Invoke the service using \`ha_system_call_service\`.
61
+ - Provide the \`domain\`, \`service\`, and \`service_data\` payload.
62
+
63
+ \`\`\`json
64
+ // Example call: ha_system_call_service
65
+ {
66
+ "domain": "light",
67
+ "service": "turn_on",
68
+ "service_data": {
69
+ "entity_id": "light.office_light",
70
+ "brightness": 200
71
+ }
72
+ }
73
+ \`\`\`
74
+
75
+ ### Step 4: Verify Post-Execution State
76
+ Confirm that the physical device or software entity acknowledged the command and changed state.
77
+ - Re-query \`ha_system_list_entities\` with \`search_query\` targeting the entity.
78
+ - Compare \`last_changed\` and \`state\` against expected outcome.
79
+ - If the entity remains unchanged or reports \`unavailable\`, tail recent logs with \`ha_system_get_logs\` to diagnose integration communication errors.
80
+
81
+ ---
82
+
83
+ ## Tool Reference
84
+
85
+ | Tool | Purpose | Key Parameters |
86
+ | :--- | :--- | :--- |
87
+ | \`ha_system_list_entities\` | Discover entities and inspect live states | \`domain_filter\`, \`search_query\` |
88
+ | \`ha_system_call_service\` | Call any Home Assistant domain service | \`domain\`, \`service\`, \`service_data\` |
89
+ | \`ha_system_get_logs\` | Inspect system error logs on failures | \`lines_count\`, \`source\` |
90
+ | \`ha_system_health\` | Verify API and integration connectivity | *(none)* |
91
+
92
+ ---
93
+
94
+ ## Safety Rules & Best Practices
95
+
96
+ 1. **Verify Before Execution**: Always confirm entity identity with \`ha_system_list_entities\` before triggering destructive or high-energy actions (heaters, locks, garage doors).
97
+ 2. **Post-State Validation**: Never assume a service call succeeded solely based on HTTP 200; verify the entity \`state\` afterwards.
98
+ 3. **Graceful Error Handling**: If a device fails to respond, inspect \`ha_system_get_logs\` for Zigbee/Z-Wave/Wi-Fi timeout errors before retrying in a loop.
99
+ `,
100
+
101
+ "ha-dashboard-designer": `---
102
+ name: ha-dashboard-designer
103
+ description: SOP for creating, previewing, and visually iterating Home Assistant Lovelace dashboards using MCP tools and Playwright screenshots.
104
+ ---
105
+
106
+ # Home Assistant Dashboard Designer Skill
107
+
108
+ ## Overview
109
+
110
+ The \`ha-dashboard-designer\` skill provides a complete Standard Operating Procedure (SOP) for creating, modifying, and polishing Home Assistant Lovelace dashboards with AI-driven visual validation. By combining entity discovery, configuration management with automatic snapshot safety, and headless Playwright screenshot rendering, this skill ensures dashboards are aesthetically refined, responsive across devices, and functional.
111
+
112
+ ---
113
+
114
+ ## Workflow & Steps
115
+
116
+ \`\`\`mermaid
117
+ flowchart TD
118
+ A[Step 1: Discover Entities] --> B[Step 2: Inspect Dashboard Config]
119
+ B --> C[Step 3: Propose Layout & Cards]
120
+ C --> D[Step 4: Save Lovelace YAML]
121
+ D --> E[Step 5: Capture Screenshots]
122
+ E --> F{Step 6: Visual Inspection Loop}
123
+ F -- Issues Found --> C
124
+ F -- Approved --> G[Finalize & Present]
125
+ \`\`\`
126
+
127
+ ### Step 1: Query Available Entities
128
+ Before designing or modifying any dashboard cards, discover the available entities, their domains, states, friendly names, and device classes.
129
+ - Use \`ha_system_list_entities\` with domain filters (e.g. \`light\`, \`climate\`, \`sensor\`, \`switch\`, \`media_player\`) or search terms.
130
+ - Verify entity availability and state types (e.g. numeric sensors, binary on/off states, list attributes).
131
+
132
+ \`\`\`json
133
+ // Example call: ha_system_list_entities
134
+ {
135
+ "domain_filter": "climate",
136
+ "search_query": "living_room"
137
+ }
138
+ \`\`\`
139
+
140
+ ### Step 2: Inspect Existing Dashboard Configuration
141
+ Inspect the current dashboard configuration to maintain theme consistency, title naming conventions, badge configurations, and view hierarchy.
142
+ - Use \`ha_dashboard_get_config\` with the target \`dashboard_slug\` (e.g. \`lovelace\` for default or custom slugs like \`dashboard-energy\`).
143
+ - Analyze existing views, card types, custom themes, and column layouts.
144
+
145
+ \`\`\`json
146
+ // Example call: ha_dashboard_get_config
147
+ {
148
+ "dashboard_slug": "lovelace"
149
+ }
150
+ \`\`\`
151
+
152
+ ### Step 3: Propose Card Layout & Design
153
+ Design card layouts tailored to the user requirements and device constraints:
154
+ - **Card Selection**:
155
+ - **Tile Card**: Modern HA standard for lights, switches, media players with feature controls.
156
+ - **Mushroom Cards**: Minimalist, touch-friendly UI for room summaries, chips, and climate.
157
+ - **Grid & Stacks**: \`grid\`, \`horizontal-stack\`, and \`vertical-stack\` for structured alignment.
158
+ - **Glance & Entities**: Compact summaries for sensors (temperatures, battery levels).
159
+ - **ApexCharts & Gauges**: Historical trends, energy metrics, and analog gauges.
160
+ - **Conditional Cards**: Dynamic cards that appear only when specific states match (e.g. doors open, low battery).
161
+ - **Responsive Guidelines**:
162
+ - Use 2-4 columns on desktop layouts.
163
+ - Ensure single-column or wrapping behavior on mobile screens.
164
+ - Group cards logically by room or domain.
165
+
166
+ ### Step 4: Save Lovelace YAML Configuration
167
+ Apply the updated dashboard configuration safely.
168
+ - Use \`ha_dashboard_save_config\` supplying the YAML configuration, target \`dashboard_slug\`, and a descriptive \`label\`.
169
+ - Note: \`ha_dashboard_save_config\` automatically creates a safety snapshot before applying modifications and performs YAML schema validation.
170
+
171
+ \`\`\`json
172
+ // Example call: ha_dashboard_save_config
173
+ {
174
+ "dashboard_slug": "lovelace",
175
+ "label": "Add living room climate tile and energy gauge",
176
+ "config_yaml": "title: Home\\nviews:\\n - title: Main\\n path: main\\n cards:\\n - type: tile\\n entity: light.living_room\\n"
177
+ }
178
+ \`\`\`
179
+
180
+ ### Step 5: Capture Rendered Screenshots
181
+ Verify the visual rendering of the updated dashboard using the headless Playwright browser.
182
+ - Use \`ha_dashboard_render_screenshot\` with the target \`url_path\` (e.g. \`lovelace/0\`, \`dashboard-energy\`).
183
+ - Always test across multiple device presets:
184
+ - \`desktop\` (1920x1080)
185
+ - \`mobile\` (375x812)
186
+ - \`tablet\` (768x1024)
187
+ - Test both light and dark modes when relevant using \`dark_mode: true\`.
188
+ - Use \`element_selector\` when focusing on a specific card component.
189
+
190
+ \`\`\`json
191
+ // Example call: ha_dashboard_render_screenshot
192
+ {
193
+ "url_path": "lovelace/0",
194
+ "device_preset": "desktop",
195
+ "dark_mode": false
196
+ }
197
+ \`\`\`
198
+
199
+ ### Step 6: Visual Inspection Loop & Iteration
200
+ Analyze the captured screenshot image using multimodal vision inspection:
201
+ 1. **Alignment & Grid Symmetry**: Are card borders aligned? Are heights balanced across columns?
202
+ 2. **Typography & Readability**: Are labels truncated? Is text overflowing container bounds?
203
+ 3. **Icons & States**: Are MDI icons rendering correctly? Are active entity states visually distinct?
204
+ 4. **Color & Contrast**: Do accent colors match the background theme in both light and dark mode?
205
+ 5. **Mobile Responsiveness**: Do horizontal stacks wrap cleanly without clipping horizontal scrollbars?
206
+
207
+ *If any visual flaw or layout inconsistency is detected, return to Step 3, adjust the Lovelace YAML, re-save, and re-capture until the dashboard achieves optimal visual fidelity.*
208
+
209
+ ---
210
+
211
+ ## Tool Reference
212
+
213
+ | Tool | Purpose | Key Parameters |
214
+ | :--- | :--- | :--- |
215
+ | \`ha_system_list_entities\` | Discover entities & states | \`domain_filter\`, \`search_query\` |
216
+ | \`ha_dashboard_get_config\` | Fetch Lovelace dashboard YAML/JSON | \`dashboard_slug\` |
217
+ | \`ha_dashboard_save_config\` | Snapshot, validate, and write dashboard | \`config_yaml\`, \`dashboard_slug\`, \`label\` |
218
+ | \`ha_dashboard_render_screenshot\` | Headless Playwright visual capture | \`url_path\`, \`device_preset\`, \`dark_mode\`, \`element_selector\` |
219
+
220
+ ---
221
+
222
+ ## Safety Rules & Best Practices
223
+
224
+ 1. **Automatic Snapshot Preservation**: Never edit Lovelace files directly outside of \`ha_dashboard_save_config\`, ensuring an automatic snapshot ID is always generated for rollback.
225
+ 2. **Multi-Viewport Testing**: Every dashboard modification must be verified on both \`desktop\` and \`mobile\` presets before marking complete.
226
+ 3. **Graceful Entity Fallbacks**: Use conditional cards or friendly names so cards remain visually appealing even when sensors are temporarily unavailable.
227
+ 4. **Non-Destructive View Updates**: When adding new features, prefer creating dedicated views or sub-views rather than overwriting existing user dashboards without request.
228
+ `,
229
+
230
+ "ha-automation-builder": `---
231
+ name: ha-automation-builder
232
+ description: SOP for drafting, validating, testing, and debugging Home Assistant automations and scripts safely.
233
+ ---
234
+
235
+ # Home Assistant Automation Builder Skill
236
+
237
+ ## Overview
238
+
239
+ The \`ha-automation-builder\` skill provides an end-to-end Standard Operating Procedure (SOP) for drafting, writing, validating, and testing Home Assistant automations and scripts. It enforces best practices such as unique ID assignment, syntax validation, automated snapshot generation before disk modification, live entity validation, and post-deployment trigger execution verification.
240
+
241
+ ---
242
+
243
+ ## Workflow & Steps
244
+
245
+ \`\`\`mermaid
246
+ flowchart TD
247
+ A[Step 1: Discover Entities & Services] --> B[Step 2: Read Existing Automations]
248
+ B --> C[Step 3: Construct Safe YAML Block]
249
+ C --> D[Step 4: Write Automation & Auto-Reload]
250
+ D --> E[Step 5: Test Trigger & Inspect Logs]
251
+ E --> F{Verification Check}
252
+ F -- Error in Logs --> C
253
+ F -- Success --> G[Complete]
254
+ \`\`\`
255
+
256
+ ### Step 1: Discover Entity IDs & Services
257
+ Before authoring automation logic, discover all target entities, their current states, supported attributes, and service domains.
258
+ - Use \`ha_system_list_entities\` to look up sensor names, switch entity IDs, zone entities, or input helpers.
259
+ - Verify entity domains (e.g. \`binary_sensor.front_door\`, \`light.hallway\`, \`climate.thermostat\`).
260
+
261
+ \`\`\`json
262
+ // Example call: ha_system_list_entities
263
+ {
264
+ "domain_filter": "binary_sensor",
265
+ "search_query": "motion"
266
+ }
267
+ \`\`\`
268
+
269
+ ### Step 2: Read Existing Automations & Avoid Collisions
270
+ Examine existing automations to avoid duplicate aliases, conflicting triggers, or ID collisions.
271
+ - Use \`ha_automation_list\` with domain \`automation\` (or \`script\` / \`scene\`) to view active entity IDs, friendly names, and trigger times.
272
+ - Use \`ha_automation_read\` with a specific automation ID or alias to inspect existing YAML structure and conventions.
273
+
274
+ \`\`\`json
275
+ // Example call: ha_automation_list
276
+ {
277
+ "domain": "automation"
278
+ }
279
+
280
+ // Example call: ha_automation_read
281
+ {
282
+ "automation_id": "night_light_auto_off"
283
+ }
284
+ \`\`\`
285
+
286
+ ### Step 3: Construct Safe YAML Automation Blocks
287
+ Structure the automation with clear metadata, robust triggers, defensive conditions, and appropriate execution modes.
288
+ - **Unique Identifier**: Always assign a deterministic or timestamped \`id\` (e.g. \`id: '1725100000123'\` or \`id: auto_living_room_motion\`).
289
+ - **Alias & Description**: Provide a clear human-readable \`alias\` and \`description\`.
290
+ - **Triggers**: Define precise triggers with thresholds or duration (e.g. \`for: { minutes: 5 }\`).
291
+ - **Conditions**: Use conditions to filter execution (e.g. sun elevation, state conditions, time ranges).
292
+ - **Actions**: Utilize official Home Assistant service targets (\`action:\` / \`service:\`) and avoid deprecated syntax.
293
+ - **Execution Mode**: Choose the appropriate \`mode\`:
294
+ - \`single\`: Default, drops concurrent triggers.
295
+ - \`restart\`: Ideal for motion timers (resets timer on new motion).
296
+ - \`queued\`: Enqueues triggers up to \`max\`.
297
+ - \`parallel\`: Executes independently up to \`max\`.
298
+
299
+ \`\`\`yaml
300
+ - id: "auto_hallway_motion_light"
301
+ alias: "Hallway: Motion-Activated Nightlight"
302
+ description: "Turn on hallway light on motion after sunset and turn off after 3 minutes of no motion."
303
+ mode: restart
304
+ trigger:
305
+ - platform: state
306
+ entity_id: binary_sensor.hallway_motion
307
+ to: "on"
308
+ condition:
309
+ - condition: state
310
+ entity_id: sun.sun
311
+ state: "below_horizon"
312
+ action:
313
+ - action: light.turn_on
314
+ target:
315
+ entity_id: light.hallway
316
+ data:
317
+ brightness_pct: 30
318
+ - wait_for_trigger:
319
+ - platform: state
320
+ entity_id: binary_sensor.hallway_motion
321
+ to: "off"
322
+ for:
323
+ minutes: 3
324
+ - action: light.turn_off
325
+ target:
326
+ entity_id: light.hallway
327
+ \`\`\`
328
+
329
+ ### Step 4: Write Automation with Auto-Reload & Snapshot
330
+ Write the automation block to \`automations.yaml\` safely.
331
+ - Use \`ha_automation_write\` providing the \`automation_id\`, \`yaml_code\`, and a descriptive \`label\`.
332
+ - Note: \`ha_automation_write\` automatically creates a safety snapshot in the Addon storage, validates YAML syntax, appends or updates the target automation block, and triggers \`automation.reload\`.
333
+
334
+ \`\`\`json
335
+ // Example call: ha_automation_write
336
+ {
337
+ "automation_id": "auto_hallway_motion_light",
338
+ "label": "Add hallway nightlight motion automation",
339
+ "yaml_code": "- id: 'auto_hallway_motion_light'\\n alias: 'Hallway: Motion-Activated Nightlight'\\n mode: restart\\n trigger:\\n - platform: state\\n entity_id: binary_sensor.hallway_motion\\n to: 'on'\\n action:\\n - action: light.turn_on\\n target:\\n entity_id: light.hallway\\n"
340
+ }
341
+ \`\`\`
342
+
343
+ ### Step 5: Test Trigger & Inspect Execution Logs
344
+ Validate that the newly registered automation triggers properly and executes its action sequence without runtime errors.
345
+ - Use \`ha_automation_trigger\` with \`entity_id\` (e.g. \`automation.hallway_motion_activated_nightlight\`).
346
+ - Use \`ha_system_get_logs\` to tail the latest logs and confirm clean execution with zero template errors or missing service faults.
347
+
348
+ \`\`\`json
349
+ // Example call: ha_automation_trigger
350
+ {
351
+ "entity_id": "automation.hallway_motion_activated_nightlight"
352
+ }
353
+
354
+ // Example call: ha_system_get_logs
355
+ {
356
+ "lines_count": 50
357
+ }
358
+ \`\`\`
359
+
360
+ ---
361
+
362
+ ## Tool Reference
363
+
364
+ | Tool | Purpose | Key Parameters |
365
+ | :--- | :--- | :--- |
366
+ | \`ha_system_list_entities\` | Query entity IDs, states, attributes | \`domain_filter\`, \`search_query\` |
367
+ | \`ha_automation_list\` | List automations, scripts, or scenes | \`domain\` |
368
+ | \`ha_automation_read\` | Fetch YAML block of an automation | \`automation_id\` |
369
+ | \`ha_automation_write\` | Validate, snapshot, write YAML & reload | \`automation_id\`, \`yaml_code\`, \`label\` |
370
+ | \`ha_automation_trigger\` | Execute automation trigger manually | \`entity_id\` |
371
+ | \`ha_system_get_logs\` | Retrieve sanitized core log lines | \`lines_count\` |
372
+
373
+ ---
374
+
375
+ ## Safety Rules & Best Practices
376
+
377
+ 1. **Unique ID Requirement**: Every automation block MUST have an explicit \`id\` field to enable UI editing and targeted updates.
378
+ 2. **Deterministic Reloading**: Never rely on full Home Assistant restarts for automation testing; use \`ha_automation_write\`'s built-in service reload.
379
+ 3. **Log Verification Gate**: Never declare an automation complete without checking \`ha_system_get_logs\` for template or service execution warnings.
380
+ 4. **Appropriate Mode Selection**: Use \`mode: restart\` for motion/timer automations and \`mode: single\` or \`mode: queued\` for security/alert automations.
381
+ `,
382
+
383
+ "ha-troubleshooter": `---
384
+ name: ha-troubleshooter
385
+ description: SOP for diagnosing Home Assistant errors, reviewing sanitized system logs, and executing safety rollbacks.
386
+ ---
387
+
388
+ # Home Assistant Troubleshooter Skill
389
+
390
+ ## Overview
391
+
392
+ The \`ha-troubleshooter\` skill establishes a structured, safety-first Standard Operating Procedure (SOP) for diagnosing system faults, analyzing sanitized log traces, detecting configuration syntax errors or integration crashes, and performing instant, non-destructive snapshot rollbacks in Home Assistant.
393
+
394
+ ---
395
+
396
+ ## Workflow & Steps
397
+
398
+ \`\`\`mermaid
399
+ flowchart TD
400
+ A[Step 1: System Healthcheck] --> B[Step 2: Tail & Analyze Logs]
401
+ B --> C{Fault / Regression Detected?}
402
+ C -- No Fault --> D[System Operational]
403
+ C -- Yes --> E[Step 3: Execute Safety Rollback]
404
+ E --> F[Step 4: Verify Post-Restore Health]
405
+ F --> G[Log Post-Mortem & Fix Root Cause]
406
+ \`\`\`
407
+
408
+ ### Step 1: System Healthcheck
409
+ Initiate diagnostics by checking the operational status of both the Home Assistant Core API and the AI Addon helper daemon.
410
+ - Use \`ha_system_health\` to evaluate connectivity, component reachability, and API response latencies.
411
+ - Determine whether Home Assistant is running in normal, degraded, or recovery state.
412
+
413
+ \`\`\`json
414
+ // Example call: ha_system_health
415
+ {}
416
+ \`\`\`
417
+
418
+ ### Step 2: Tail & Analyze Sanitized Logs
419
+ Inspect system logs to identify tracebacks, deprecation warnings, unhandled exceptions, template rendering faults, or integration connection failures.
420
+ - Use \`ha_system_get_logs\` specifying \`lines_count\` (e.g. 50-200 lines) and optionally \`source\` (\`core\`, \`supervisor\`, \`all\`).
421
+ - Note: System logs are automatically sanitized by the Addon backend to redact sensitive tokens, passwords, and authorization headers.
422
+ - Categorize observed errors:
423
+ - **YAML / Syntax Errors**: Invalid keys, missing indentation, or schema validation failures in \`configuration.yaml\`, \`automations.yaml\`, or dashboards.
424
+ - **Entity / Device Unavailable**: Missing integrations, offline Zigbee/Z-Wave nodes, or changed entity IDs.
425
+ - **Service Call Failures**: Invocation of nonexistent services or missing target parameters.
426
+
427
+ \`\`\`json
428
+ // Example call: ha_system_get_logs
429
+ {
430
+ "lines_count": 100,
431
+ "source": "all"
432
+ }
433
+ \`\`\`
434
+
435
+ ### Step 3: Execute Safety Rollback or Manual Backup
436
+ When an edit, automation change, or dashboard update leads to instability, regression, or syntax errors, perform an immediate safety rollback.
437
+ - If performing experimental diagnostics before a fix, create a pre-fix checkpoint using \`ha_system_create_backup\` with a descriptive \`label\`.
438
+ - If an issue was introduced by a previous tool call, locate the corresponding \`snapshot_id\` from the tool response or snapshot history.
439
+ - Use \`ha_system_restore_backup\` with \`snapshot_id\` to restore the file atomically. The Addon automatically creates a safety backup of current disk state before restoring.
440
+
441
+ \`\`\`json
442
+ // Example call: ha_system_create_backup
443
+ {
444
+ "label": "Pre-troubleshooting configuration checkpoint"
445
+ }
446
+
447
+ // Example call: ha_system_restore_backup
448
+ {
449
+ "snapshot_id": "snap_20260831_093000_automations_yaml"
450
+ }
451
+ \`\`\`
452
+
453
+ ### Step 4: Verify Post-Restore System Health
454
+ After executing a rollback or applying a corrective patch, verify that the system has returned to full operational capacity.
455
+ - Re-run \`ha_system_health\` to verify that API and daemon health check reports are \`ok\`.
456
+ - Tail recent logs with \`ha_system_get_logs\` to ensure error loops and exception tracebacks have cleared.
457
+
458
+ \`\`\`json
459
+ // Example call: ha_system_health
460
+ {}
461
+
462
+ // Example call: ha_system_get_logs
463
+ {
464
+ "lines_count": 50
465
+ }
466
+ \`\`\`
467
+
468
+ ---
469
+
470
+ ## Tool Reference
471
+
472
+ | Tool | Purpose | Key Parameters |
473
+ | :--- | :--- | :--- |
474
+ | \`ha_system_health\` | Query HA Core API & Addon daemon health | *(none)* |
475
+ | \`ha_system_get_logs\` | Fetch sanitized tail of HA core & supervisor logs | \`lines_count\`, \`source\` |
476
+ | \`ha_system_create_backup\` | Create named manual snapshot backup | \`label\` |
477
+ | \`ha_system_restore_backup\` | Restore configuration from snapshot ID | \`snapshot_id\` |
478
+
479
+ ---
480
+
481
+ ## Safety Rules & Best Practices
482
+
483
+ 1. **Non-Destructive Restoration**: All restore operations conducted via \`ha_system_restore_backup\` automatically preserve the overwritten version in a safety snapshot.
484
+ 2. **Sanitized Output Awareness**: \`ha_system_get_logs\` redacts secrets; never attempt to bypass log sanitization to inspect raw credentials.
485
+ 3. **Rollback Over Patching Broken States**: When an unverified configuration breaks critical automations, roll back to the last known good snapshot before attempting redesigns.
486
+ 4. **Mandatory Post-Restore Verification**: Always verify both \`ha_system_health\` and \`ha_system_get_logs\` after any restore or configuration repair.
487
+ `
488
+ };
489
+
490
+ export function getTargetSkillsDirectories(customDir?: string): string[] {
491
+ if (customDir) {
492
+ return [path.resolve(customDir)];
493
+ }
494
+
495
+ const homedir = os.homedir();
496
+ const candidates: string[] = [];
497
+
498
+ const geminiSkills = path.join(homedir, ".gemini", "config", "skills");
499
+ if (fs.existsSync(geminiSkills)) {
500
+ candidates.push(geminiSkills);
501
+ }
502
+
503
+ const claudeSkills = path.join(homedir, ".claude", "skills");
504
+ if (fs.existsSync(claudeSkills)) {
505
+ candidates.push(claudeSkills);
506
+ }
507
+
508
+ const opencodeSkills = path.join(homedir, ".opencode", "skills");
509
+ if (fs.existsSync(opencodeSkills)) {
510
+ candidates.push(opencodeSkills);
511
+ }
512
+
513
+ // If none exist, default to gemini skills path
514
+ if (candidates.length === 0) {
515
+ candidates.push(geminiSkills);
516
+ }
517
+
518
+ return candidates;
519
+ }
520
+
521
+ export function syncSkills(customDir?: string, silent = false): { installedCount: number; targetDirs: string[] } {
522
+ const targetDirs = getTargetSkillsDirectories(customDir);
523
+ let installedCount = 0;
524
+
525
+ for (const baseDir of targetDirs) {
526
+ if (!fs.existsSync(baseDir)) {
527
+ try {
528
+ fs.mkdirSync(baseDir, { recursive: true });
529
+ } catch {
530
+ continue;
531
+ }
532
+ }
533
+
534
+ for (const [skillName, content] of Object.entries(EMBEDDED_SKILLS)) {
535
+ try {
536
+ const skillDir = path.join(baseDir, skillName);
537
+ if (!fs.existsSync(skillDir)) {
538
+ fs.mkdirSync(skillDir, { recursive: true });
539
+ }
540
+ const skillPath = path.join(skillDir, "SKILL.md");
541
+ fs.writeFileSync(skillPath, content, "utf8");
542
+ installedCount++;
543
+ if (!silent) {
544
+ console.log(`✓ Synchronized skill: ${skillName} -> ${skillPath}`);
545
+ }
546
+ } catch (err: any) {
547
+ if (!silent) {
548
+ console.warn(`⚠️ Failed writing skill ${skillName} to ${baseDir}:`, err.message);
549
+ }
550
+ }
551
+ }
552
+ }
553
+
554
+ return { installedCount, targetDirs };
555
+ }
package/src/index.ts CHANGED
@@ -48,10 +48,29 @@ export function createServer(providedClients?: ToolClients): {
48
48
  return { server, clients };
49
49
  }
50
50
 
51
- // Backward-compatible alias
52
- export const createMcpServer = createServer;
51
+ import { syncSkills } from "./cli/skills.js";
52
+
53
+ export { syncSkills };
53
54
 
54
55
  async function main(): Promise<void> {
56
+ const args = process.argv.slice(2);
57
+ if (args.includes("install-skills") || args.includes("update-skills") || args.includes("sync-skills")) {
58
+ const customDir = args.find((a) => a.startsWith("--dir="))?.split("=")[1];
59
+ console.log("🚀 Synchronizing Home Assistant AI Skills...");
60
+ const result = syncSkills(customDir, false);
61
+ console.log(`✨ Successfully synchronized ${result.installedCount} skill files across ${result.targetDirs.length} directories.`);
62
+ process.exit(0);
63
+ }
64
+
65
+ // Background auto-sync skills if enabled or if standard skills folder exists
66
+ if (process.env.AUTO_SYNC_SKILLS !== "false") {
67
+ try {
68
+ syncSkills(undefined, true);
69
+ } catch {
70
+ // Non-blocking auto-sync
71
+ }
72
+ }
73
+
55
74
  const { server, clients } = createServer();
56
75
  const transport = new StdioServerTransport();
57
76