Liebes Forum, könntet ihr euch vielleicht mal folgenden Code anschauen? Ich habe zwei iPhones im Haushalt und würde die Automation gerne so steuern, dass die Heizung nur dann ausschaltet, wenn wirklich beide Smartphones die Zone Home verlassen. Aktuell ist es so, dass die Automation auch dann ausgelöst wird, wenn nur ein iPhone die Zone verlässt.
Dankeschön.
alias: Heizung auf Abwesend bei Verlassen
description: >-
Schaltet die Heizung auf Abwesenheitsmodus, wenn eines der iPhones die Zone
'Home' verlässt
trigger:
- platform: state
entity_id:
- device_tracker.2
- device_tracker.1
from: home
to: not_home
action:
- device_id: Abc
domain: climate
entity_id: Abc
type: set_preset_mode
preset_mode: away
- device_id: Abc
domain: climate
entity_id: Abc
type: set_preset_mode
preset_mode: away
- device_id: Abc
domain: climate
entity_id: Abc
type: set_preset_mode
preset_mode: away
- device_id: Abc
domain: climate
entity_id: Abc
type: set_preset_mode
preset_mode: away
- device_id: abc
domain: climate
entity_id: abc
type: set_preset_mode
preset_mode: away
- device_id: abc
domain: climate
entity_id: abc
type: set_preset_mode
preset_mode: away
- action: notify.mobile_app_iphone
metadata: {}
data:
message: Heizung wird heruntergefahren
title: 🥶
mode: single
condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.a
state: home
- condition: not
conditions:
- condition: state
entity_id: person.b
state: home
Im Bearbeitungsmodus der Automation oben rechts auf die drei Punkte. Dann auf Als YAML bearbeiten. Dort steht dann im Text condition: []. Dieses mit dem obigen code ersetzen. In der GUI kannst du dir das natürlich auch nachbauen. Die beiden Tracker natürlich durch deine ersetzen.
Lieber Günter,
vielen Dank für deine schnelle Antwort.
Ich habe auch mal Chat gpt gefragt, wo der Schnipsel rein muss, der fügte ihn auch dort ein. Da HA mir beim Speichern der Animation einen Fehler melden, hab ich die Möglichkeit verworfen.
Da hat sich wohl ein Fehler in meiner Version eingeschlichen. Habe dies nun korrigiert:
condition:
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.a
state: home
- condition: not
conditions:
- condition: state
entity_id: person.b
state: home
Komplett dann so:
alias: Heizung auf Abwesend bei Verlassen
description: >-
Schaltet die Heizung auf Abwesenheitsmodus, wenn eines der iPhones die Zone
'Home' verlässt
trigger:
- platform: state
entity_id:
- device_tracker.2
- device_tracker.1
from: home
to: not_home
condition:
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.a
state: home
- condition: not
conditions:
- condition: state
entity_id: person.b
state: home
action:
- device_id: Abc
domain: climate
entity_id: Abc
type: set_preset_mode
preset_mode: away
- device_id: Abc
domain: climate
entity_id: Abc
type: set_preset_mode
preset_mode: away
- device_id: Abc
domain: climate
entity_id: Abc
type: set_preset_mode
preset_mode: away
- device_id: Abc
domain: climate
entity_id: Abc
type: set_preset_mode
preset_mode: away
- device_id: abc
domain: climate
entity_id: abc
type: set_preset_mode
preset_mode: away
- device_id: abc
domain: climate
entity_id: abc
type: set_preset_mode
preset_mode: away
- action: notify.mobile_app_iphone
metadata: {}
data:
message: Heizung wird heruntergefahren
title: 🥶
mode: single
Getestet und geht durch. Die Geräte in den Aktionen und die beiden Tracker müssen natürlich auf dich angepasst werden.
Alternativ kannst du folgenden Weg in der bestehenden Automation durchführen:
und dann diesen Code eingeben:
condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.a
state: home
- condition: not
conditions:
- condition: state
entity_id: person.b
state: home
Warum Löst die nicht aus?
alias: Heizung auf Abwesend bei Verlassen
description: >-
Schaltet die Heizung auf Abwesenheitsmodus, wenn eines der iPhones die Zone
'Home' verlässt
triggers:
- entity_id:
- device_tracker.iphone
- device_tracker.s24_thomas
from: home
to: not_home
trigger: state
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.kerstin
state: home
- condition: not
conditions:
- condition: state
entity_id: person.thomas_winkler
state: home
- condition: time
actions:
- action: climate.set_temperature
metadata: {}
data:
temperature: 15
target:
device_id: 1f3b4d63e98d2a83a8a7abebb012f7a8
- action: notify.pushover
data:
target: galaxys24
message: Heizung wird heruntergefahren
mode: single
description: >-
Schaltet die Heizung auf Abwesenheitsmodus, wenn eines der iPhones die Zone
'Home' verlässt
triggers:
- entity_id:
- device_tracker.iphone
- device_tracker.s24_thomas
from: home
to: not_home
trigger: state
conditions:
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.a
state: home
- condition: not
conditions:
- condition: state
entity_id: person.b
state: home
actions:
- action: climate.set_temperature
metadata: {}
data:
temperature: 15
target:
device_id: 1f3b4d63e98d2a83a8a7abebb012f7a8
- action: notify.pushover
data:
target: galaxys24
message: Heizung wird heruntergefahren
mode: single
Bekommt man das jetzt noch so hin das wenn eine Person
wieder eintritt die Heizung wieder hochgefahren wird oder
mache ich das mit einer Zweiten Automation.
Leider Funktioniert der Auslöser immer noch nicht.
Beide Handys sind aus der Homezon raus, bekomme jeweils
eine Benachrichtigung, und trotzdem wird die Automatisierung
nicht ausgelöst.