lab
Home Assistant Scenarios
Home Assistant Scenarios — Lab Jungle Kabal
Automation YAML prêtes-à-l’emploi pour le Lab. Lighting cycles circadian, Frigate-triggered events, voice assistant Kabal hooks, MistKing automation.
Configuration base
/config/configuration.yaml sur Home Assistant (Mac Mini Docker ou Pi 5 dédié).
homeassistant:
name: "Lab Jungle Kabal"
latitude: 13.7563 # Bangkok
longitude: 100.5018
elevation: 5
unit_system: metric
time_zone: Asia/Bangkok
# Frigate integration via HACS
frigate:
host: localhost
port: 5000
# Hue Bridge (auto-discovered si même LAN)
hue:
bridges:
- host: 192.168.1.50
api_version: v2
# MistKing via ESP32 + Tasmota / ESPHome
esphome:
password: !secret esphome_password
# Voice Kabal endpoint
http:
webhook_endpoint: /api/webhook/kabal
Scenarios par espèce
Phidippus regius — cycle quotidien + Frigate-reactive
automation:
# Sunrise — cycle naturel jour
- id: phidippus_sunrise
alias: "Phidippus — sunrise warm"
trigger:
- platform: time
at: "07:00:00"
action:
- service: light.turn_on
target:
entity_id: light.terra_phidippus
data:
color_temp: 2700 # warm amber
brightness_pct: 30
transition: 60
# Daytime full
- id: phidippus_daytime
alias: "Phidippus — daytime"
trigger:
- platform: time
at: "09:00:00"
action:
- service: light.turn_on
target:
entity_id: light.terra_phidippus
data:
color_temp: 4500
brightness_pct: 75
transition: 600 # 10min ramp
# Sunset
- id: phidippus_sunset
alias: "Phidippus — sunset"
trigger:
- platform: time
at: "18:30:00"
action:
- service: light.turn_on
target:
entity_id: light.terra_phidippus
data:
color_temp: 2700
brightness_pct: 25
transition: 1800 # 30min sunset
- id: phidippus_night
alias: "Phidippus — full night"
trigger:
- platform: time
at: "20:00:00"
action:
- service: light.turn_off
target:
entity_id: light.terra_phidippus
data:
transition: 600
# Frigate-triggered : motion détecté pendant journée → boost light pour macro shot
- id: phidippus_activity_boost
alias: "Phidippus — activity boost (Frigate motion)"
trigger:
- platform: webhook
webhook_id: frigate_phidippus_motion
condition:
- condition: state
entity_id: sun.sun
state: "above_horizon"
- condition: state
entity_id: light.terra_phidippus
state: "on"
action:
- service: light.turn_on
target:
entity_id: light.terra_phidippus
data:
brightness_pct: 95
transition: 2
- delay: "00:00:30"
- service: scene.turn_on
target:
entity_id: scene.phidippus_normal_daytime
Tribolonotus gracilis — cycle + ambiance “Red Eye”
automation:
# Twilight ambiance "Red Eye Dragon" brand
- id: tribolonotus_twilight_red
alias: "Tribolonotus — Red Eye twilight"
trigger:
- platform: time
at: "18:00:00"
action:
- service: light.turn_on
target:
entity_id: light.terra_tribolonotus
data:
rgb_color: [180, 30, 40] # rouge sang Red Eye
brightness_pct: 25
transition: 1800
# Frigate-triggered : Tribolonotus égg laying / brooding détecté
- id: tribolonotus_egg_laying_alert
alias: "Tribolonotus — egg laying captured"
trigger:
- platform: webhook
webhook_id: frigate_tribolonotus_oviposit
action:
- service: light.turn_on
target:
entity_id: light.terra_tribolonotus
data:
rgb_color: [212, 175, 55] # gold celebration
brightness_pct: 80
transition: 5
# Notify Kabal voice
- service: rest_command.kabal_speak
data:
message: "Le Tribolonotus dépose ses œufs. Comportement maternel rare capturé."
- delay: "00:01:00"
- service: scene.turn_on
target:
entity_id: scene.tribolonotus_normal_evening
Mystrium camillae — formicarium passive
automation:
# Formicarium ant colonies = lighting indirect, pas dans le formicarium
# Mais on peut trigger éclairage outworld bright quand Mystrium active
- id: mystrium_foraging_event
alias: "Mystrium — foraging burst detected"
trigger:
- platform: webhook
webhook_id: frigate_mystrium_foraging
action:
- service: light.turn_on
target:
entity_id: light.terra_mystrium_outworld
data:
color_temp: 5500
brightness_pct: 70
transition: 8
# Capture photo via Pi Cam
- service: rest_command.pi_cam_snap
data:
camera: "mystrium"
- delay: "00:02:00"
- service: scene.turn_on
target:
entity_id: scene.mystrium_normal
MistKing — Aplopeltura humidity tropical
automation:
# Cycle pluie matin (rain mimic naturel)
- id: aplopeltura_morning_mist
alias: "Aplopeltura — morning mist"
trigger:
- platform: time
at: "07:30:00"
action:
- service: switch.turn_on
target:
entity_id: switch.mistking_aplopeltura
- delay: "00:00:30" # 30s mist
- service: switch.turn_off
target:
entity_id: switch.mistking_aplopeltura
- id: aplopeltura_evening_mist
alias: "Aplopeltura — evening mist"
trigger:
- platform: time
at: "19:00:00"
action:
- service: switch.turn_on
target:
entity_id: switch.mistking_aplopeltura
- delay: "00:00:45"
- service: switch.turn_off
target:
entity_id: switch.mistking_aplopeltura
# Humidity drop alarm
- id: aplopeltura_humidity_alarm
alias: "Aplopeltura — humidity drop alert"
trigger:
- platform: numeric_state
entity_id: sensor.terra_aplopeltura_humidity
below: 60
for: "00:30:00"
action:
- service: notify.mobile_app_kabal
data:
message: "Humidité Aplopeltura < 60% pendant 30min. Vérifier MistKing + ventilation."
- service: rest_command.kabal_speak
data:
message: "Inquiétude. L'humidité du terra Aplopeltura descend. Vérifie quand tu peux."
Voice assistant Kabal hooks
REST commands — Kabal speak
/config/rest_command.yaml :
rest_command:
kabal_speak:
url: "http://kabal-pi.local:5000/speak"
method: POST
headers:
content-type: application/json
payload: '{"message": "{{ message }}", "voice_id": "{{ voice_id | default(\"kabal-default\") }}"}'
pi_cam_snap:
url: "http://pi-cam-{{ camera }}.local:8080/snapshot"
method: GET
Frigate event → Kabal speak
automation:
- id: kabal_announces_mue
alias: "Kabal — announce mue"
trigger:
- platform: webhook
webhook_id: frigate_mue_detected
action:
- service: rest_command.kabal_speak
data:
message: >
Le {{ trigger.json.specimen }} vient de muer.
Photo capturée à {{ now().strftime('%H:%M') }}.
Cuticule complète.
- id: kabal_announces_feed_accepted
alias: "Kabal — announce feed accepted"
trigger:
- platform: state
entity_id: input_boolean.feed_event_accepted
to: "on"
action:
- service: rest_command.kabal_speak
data:
message: >
{{ states('input_text.last_specimen_fed') }} a accepté la proie à {{ now().strftime('%H:%M') }}.
Daily Lab status — morning briefing
automation:
- id: morning_lab_briefing
alias: "Kabal — morning briefing"
trigger:
- platform: time
at: "08:00:00"
action:
- service: rest_command.kabal_speak
data:
message: >
Bonjour. Aujourd'hui dans le Lab :
{% if states('sensor.feeds_overdue') | int > 0 %}
{{ states('sensor.feeds_overdue') }} feeds en retard.
{% endif %}
{% if states('sensor.molts_expected_today') | int > 0 %}
{{ states('sensor.molts_expected_today') }} mues attendues.
{% endif %}
Activity caméras : {{ states('sensor.frigate_events_24h') }} events ces 24 dernières heures.
Bonne journée, gardien.
Sensors custom
sensor:
- platform: rest
name: "Feeds overdue"
resource: "http://lab-data.local:3000/api/feeds-overdue"
value_template: "{{ value_json.count }}"
scan_interval: 600
- platform: rest
name: "Molts expected today"
resource: "http://lab-data.local:3000/api/molts-today"
value_template: "{{ value_json.count }}"
scan_interval: 1800
- platform: rest
name: "Frigate events 24h"
resource: "http://localhost:5000/api/events?after={{ (now() - timedelta(hours=24)).timestamp() }}"
value_template: "{{ value_json | length }}"
scan_interval: 900
Liens
- Home Assistant docs
- Hue integration
- Frigate HASS integration
- Voir templates Frigate :
/research/lab-frigate-config-templates - Voir lighting cycles :
/research/lab-hue-lighting-cycles-per-species - Voir Kabal voice setup :
/research/lab-voice-assistant-kabal
💡 Edit source:
docs/lab/home-assistant-scenarios.md · sync: npm run docs:sync