feat(homeassistant): add kids_lambs light group and daily automations

Creates a light group combining mpho_lamb and hloni_lamb, and sets up
four daily automations: on at sunset/18:00 (full cool white), warm dim
at 20:30, hloni off at 22:00, mpho off at 06:00 — all with fade transitions.
setup-homeassistant.sh now deploys automations.yaml alongside configuration.yaml.
This commit is contained in:
Brian Pooe 2026-06-28 17:59:26 +02:00
parent e2f62deb2d
commit 8081e0c753
4 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,68 @@
# Home Assistant Automations
# Place this file at: ./appdata/homeassistant/automations.yaml
#
# Managed in the repo — deployed by setup-homeassistant.sh.
# Changes made via the HA UI will write back to the mounted file on the server
# but won't auto-commit to the repo; copy them here to keep the repo in sync.
# Fires at sunset OR 18:00, whichever comes first.
# In winter (sunset ~17:30) the sun trigger fires first.
# In summer (sunset ~18:45) the time trigger fires first and the sun trigger
# later re-applies the same settings — harmless.
- id: kids_lambs_on_sunset_or_1800
alias: "Kids Lambs - On at sunset or 18:00 (full white)"
trigger:
- platform: sun
event: sunset
- platform: time
at: "18:00:00"
action:
- action: light.turn_on
target:
entity_id: light.kids_lambs
data:
brightness_pct: 100
color_temp: 153
transition: 5
mode: single
- id: kids_lambs_warm_20_30
alias: "Kids Lambs - Warm at 20:30"
trigger:
- platform: time
at: "20:30:00"
action:
- action: light.turn_on
target:
entity_id: light.kids_lambs
data:
brightness_pct: 40
color_temp: 454
transition: 30
mode: single
- id: kids_lambs_hloni_off_22_00
alias: "Kids Lambs - Hloni off at 22:00"
trigger:
- platform: time
at: "22:00:00"
action:
- action: light.turn_off
target:
entity_id: light.hloni_lamb
data:
transition: 60
mode: single
- id: kids_lambs_mpho_off_06_00
alias: "Kids Lambs - Mpho off at 06:00"
trigger:
- platform: time
at: "06:00:00"
action:
- action: light.turn_off
target:
entity_id: light.mpho_lamb
data:
transition: 60
mode: single

View file

@ -10,3 +10,13 @@ http:
use_x_forwarded_for: true
trusted_proxies:
- {{CADDY_HOST_IP}}
automation: !include automations.yaml
light:
- platform: group
name: Kids Lambs
unique_id: kids_lambs
entities:
- light.mpho_lamb
- light.hloni_lamb

View file

@ -32,6 +32,7 @@ services:
- /etc/timezone:/etc/timezone:ro
- homeassistant_data:/config
- ./appdata/homeassistant/configuration.yaml:/config/configuration.yaml:ro
- ./appdata/homeassistant/automations.yaml:/config/automations.yaml
depends_on:
mqtt:
condition: service_healthy

View file

@ -78,6 +78,9 @@ write_minimal_env "$TMP_DIR/env.ha" CADDY_HOST_IP
"$TMP_DIR/env.ha"
sudo cp "$TMP_DIR/ha_configuration.yaml" "$APPDATA/homeassistant/configuration.yaml"
sudo chmod 644 "$APPDATA/homeassistant/configuration.yaml"
echo "==> Copying Home Assistant automations"
sudo cp "$STACK_DIR/config/ha_automations.yaml" "$APPDATA/homeassistant/automations.yaml"
sudo chmod 644 "$APPDATA/homeassistant/automations.yaml"
echo "==> Generating docker-compose.homeassistant.yml"
write_minimal_env "$TMP_DIR/env.compose" TZ DOCKERLOGGING_MAXFILE DOCKERLOGGING_MAXSIZE