Fix TTS google_translate→google_ai_tts, robust garage automation

- Replace broken media_player.play_media/google_translate TTS with tts.speak/google_ai_tts
  in doerklokke_for.yaml (4x), doerklokke_bag2.yaml (3x), doorbell.yaml (1x)
- Garage automation: add GPS debounce, dual trigger (phone+car), cover.toggle,
  post-delay re-check, last_changed guard against false opens
- Remove duplicate doerklokke_bag.yaml (replaced by doerklokke_bag2.yaml)
This commit is contained in:
2026-04-19 18:40:14 +02:00
parent fcb290a1aa
commit d39e0051db
5 changed files with 590 additions and 1153 deletions
@@ -1,15 +1,30 @@
- id: garage_auto_claus_presence
alias: Garage auto Claus
description: >
Åbn garage ved ankomst i bil, luk ved afrejse.
Trigger på både telefon og bil-tracker for at fange begge signaler.
trigger:
# Telefon ankommer hjem (debounce 10s mod GPS-flimmer)
- platform: state
entity_id: device_tracker.claus_iphone_15pro
to: "home"
for:
seconds: 10
id: arriving
# Bil ankommer hjem (fanger tilfælde hvor telefon allerede var "home" via WiFi)
- platform: state
entity_id: device_tracker.snowywhite_location_tracker
to: "home"
id: arriving
# Telefon forlader hjemmet (debounce 10s mod GPS-flimmer)
- platform: state
entity_id: device_tracker.claus_iphone_15pro
from: "home"
for:
seconds: 10
id: leaving
condition:
@@ -20,7 +35,7 @@
action:
- choose:
# ÅBN (kun hvis bil er aktiv)
# ÅBN: garage lukket + telefon hjemme + bil netop ankommet
- conditions:
- condition: trigger
id: arriving
@@ -29,9 +44,21 @@
entity_id: binary_sensor.garageport
state: "off"
# Telefon skal være hjemme
- condition: state
entity_id: device_tracker.claus_iphone_15pro
state: "home"
# Bil skal være hjemme
- condition: state
entity_id: device_tracker.snowywhite_location_tracker
state: "home"
# Bilen skal have skiftet til "home" for nylig (< 5 min)
# Forhindrer åbning hvis du går hjem og bilen allerede stod i garagen
- condition: template
value_template: >
{{ state_attr('device_tracker.snowywhite_location_tracker', 'speed') not in [None, 'unknown'] }}
{{ (now() - states.device_tracker.snowywhite_location_tracker.last_changed).total_seconds() < 300 }}
sequence:
- service: cover.toggle
@@ -40,9 +67,9 @@
- service: notify.mobile_app_claus_iphone_15pro
data:
message: "Garage opened (arrival by car)"
message: "Garage åbnet (ankomst i bil)"
# LUK (kun hvis bil er aktiv)
# LUK: garage åben + forlader hjemmet + bil kører
- conditions:
- condition: trigger
id: leaving
@@ -51,12 +78,18 @@
entity_id: binary_sensor.garageport
state: "on"
# Bil skal faktisk have fart (> 0), ikke bare "speed eksisterer"
- condition: template
value_template: >
{{ state_attr('device_tracker.snowywhite_location_tracker', 'speed') not in [None, 'unknown'] }}
{{ (state_attr('device_tracker.snowywhite_location_tracker', 'speed') | float(0)) > 0 }}
sequence:
- delay: "00:00:20" # giver tid til at du faktisk er kørt ud
- delay: "00:00:30"
# Dobbelttjek at garagen stadig er åben efter forsinkelsen
- condition: state
entity_id: binary_sensor.garageport
state: "on"
- service: cover.toggle
target:
@@ -64,5 +97,7 @@
- service: notify.mobile_app_claus_iphone_15pro
data:
message: "Garage closed (departure by car)"
message: "Garage lukket (afrejse i bil)"
mode: single
max_exceeded: silent