t3chnaztea/home-assistant-skills/ha-external-triggers
Claude Code and agent skill by t3chnaztea/home-assistant-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when a Home Assistant automation's "if" is not a device: react to a utility's real-time electricity price (load shedding, price-spike alerts, demand response), or use an LLM as a sensor via ai_task and a camera snapshot for judgment calls (person vs cat vs shadow, "is the garage door actually open in this image"). Covers the save/bump/shed/restore thermostat loop with hysteresis, threshold helpers, the armed-sentinel restore guard, ai_task.generate_data with structured output and camera attachments, and branching automations on LLM fields. Not for basic automation mechanics (ha-automations) or connecting (ha-connect).
Install
npx vskill@latest install t3chnaztea/home-assistant-skills/ha-external-triggersSKILL.md
HA External Triggers
The trigger doesn't have to be a device. Two patterns where the "if" comes from outside the house: a market price, and a model's judgment. Both build on the loop and verify doctrine from ha-automations; these are the automations where silent failure is most expensive, because you'll only notice on the electric bill or the missed intruder.
Pattern A: price-driven load shedding
If your utility exposes real-time or hourly pricing (mine does; yours may be a different utility or a dynamic tariff like Octopus Agile; anything that lands in HA as a price sensor works), you can automate the response to price spikes: alert, pre-cool less aggressively, and shut down discretionary load until the price falls.
The pieces
pre_spike_setpoint is both storage and state machine: at its minimum it means "no shed in progress" (disarmed); any higher value is the saved setpoint to restore. This survives restarts, which a variable in an automation would not.
Engage: save → bump → shed
Release: restore, guarded
(If a numeric_state template trigger fights your HA version, put the margin check in a template trigger or condition instead; the rule is what matters: release threshold < engage threshold.)
The doctrine, learned the annoying way
- Hysteresis on both edges.
for:on engage and release; a margin
between the two thresholds. Price feeds jitter and 5-minute prices cross thresholds constantly.
- Save/restore through a helper, guarded by a sentinel. Restoring
blindly overwrites human adjustments made mid-shed; restoring without the armed check "restores" a setpoint that was never saved.
- Shed is off-only. Turn things off on the spike; on release, restore
the thermostat and nothing else. Re-energizing loads automatically (TV pops on at 2am when the price drops) is how a clever automation becomes a banned one.
- Stay out of other automations' lanes. If something else also manages
the thermostat (eco-when-away, a schedule), add conditions so shed and release only act when those aren't in control; two automations fighting over one setpoint is undebuggable from the history graph.
- Alert separately from acting. A push notification when the price
crosses the alert threshold (lower than the shed threshold) keeps the human in the loop; clear it silently when the price falls rather than sending a second notification.
Pattern B: the LLM as a sensor
Cameras give you person detected. They don't give you "is that a person, or the cat on the fence, or a headlight shadow?": the judgment call that decides whether a 3am notification is warranted. ai_task.generate_data (HA's AI Task entity, backed by whatever LLM integration you run) takes a camera snapshot and returns structured fields your automation can branch on.
Fields come back typed per their selector (text → string, select → one of the options, boolean/number likewise) at ai.data.<field>: no JSON parsing, no regex over prose.
Test it without waiting for a prowler
Run it in daylight, at night, and against a deliberately boring frame before trusting it at 3am.
The doctrine
- Instruct the empty scene explicitly. Vision models pattern-match hard;
shown a dark empty yard and asked "what's the threat", some will find one. The prompt must give the model an explicit, honorable exit ("if the scene is empty... say so, threat_level low") before the classification ask.
- The LLM is the judgment, not the trigger. Cheap deterministic signals
(motion sensor, time window) decide when to ask; the model only answers the question code can't. Never poll an LLM on a timer to "check" a camera; cost, latency, and hallucination all scale with pointless calls.
- Constrain outputs with selectors, then branch only on the constrained
field. Branching on prose ('person' in ai.data.description) reintroduces everything structure exists to prevent.
- Fail toward the cheap side. If the ai_task call errors (LLM down,
quota), decide per-automation what the default branch is: for a security notify, fall back to notifying; for a comfort tweak, fall back to nothing.
- Judgment calls only. "Is the sun up" is an astronomical fact
(sun.sun), not a vision task. If a template or a sensor can answer, don't spend a model call; the LLM-as-sensor pattern earns its keep exactly where deterministic signals run out.
Where else this goes
The same two shapes cover most "external if" ideas: a feed (pollen index, grid CO2 intensity, surf report) driving thresholds with hysteresis and off-only actions, or a judgment (package on the porch? grill left on? garage door actually closed?) driving a snapshot + structure + one choose: block. Build either on top of ha-automations' verify loop and they stay debuggable.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ha-external-triggers/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 3
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/t3chnaztea/home-assistant-skills/ha-external-triggers)