Skip to content

feat(ha): trigger Home Assistant automations from the badge - #610

Open
badbread wants to merge 1 commit into
mainfrom
fix/ha-automation-trigger
Open

feat(ha): trigger Home Assistant automations from the badge#610
badbread wants to merge 1 commit into
mainfrom
fix/ha-automation-trigger

Conversation

@badbread

Copy link
Copy Markdown
Owner

What

Adds triggering Home Assistant automations from the on-video badgeautomation.trigger. This is the one piece of HA control that wasn't already in main.

Context

HA control already shipped in v0.2.0 (the POST /cameras/:id/ha/action endpoint, the actuators capability, and value controls for light/cover/fan). The action allowlist covered light, switch, fan, siren, cover, lock, button, input_button, scene, and script, but not automation. So an automation entity could be linked and its state shown, but the clients rendered it read-only. This closes that gap.

Changes

  • Server: ("automation", &[spec("trigger")]) added to HA_ACTION_ALLOWLIST + its exhaustive guard test. The entity picker offers automations for free (control_domains() derives from the allowlist, so the two can't drift).
  • Clients: automationtrigger in each action table — a single tap fires it (immediate, no confirm, like scene/script):
    • desktop ha_actions.dart, Android HaModels.kt, iOS HomeAssistant.swift
  • Docs: docs-site HA page lists automation among the controllable domains.

Gated by the existing default-off actuators capability. No schema change.

Verification (all green, on current main)

Layer Where Result
Rust: fmt + clippy -D warnings + cargo test --workspace dev2 (+ PG) ✅ pass (incl. allowlist guard test)
Android: compileDebugKotlin + unit tests dev2 BUILD SUCCESSFUL
Desktop Flutter: flutter build windows --debug winbuild ✅ built exe
macOS/iOS Swift: xcodebuild (no signing) macmini BUILD SUCCEEDED

Note

Supersedes #609, which I opened by mistake off a stale checkout and have closed. This is the focused, correct change on top of current main.

Adds the automation domain to the HA control path (the one piece of HA control
missing from main). automation.trigger fires the automation's actions
immediately, skipping its trigger conditions.

- server: ("automation", &[spec("trigger")]) in HA_ACTION_ALLOWLIST + guard
  test; the picker offers it for free (control_domains derives from the allowlist)
- clients: automation -> trigger in each action table (single tap, no confirm,
  like scene/script): ha_actions.dart, HaModels.kt, HomeAssistant.swift
- docs-site HA page: automation listed in the controllable domains

Gated by the existing default-off actuators capability; no schema change.

Signed-off-by: badbread <badbread@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant