ich habe eine Automation mit 2 Triggern die sich gegenseitig bedingen. Wenn Person 1 nicht zu Hause und Person 2 kommt heim dann … und umgedreht,
Allerdings funktioniert das nicht wenn beide Personen zur haargenau selben Zeit nach Hause kommen. Hab gedacht sowas passiert nicht, aber anscheinend gibt die Fritzbox die Daten zum exakt gleichen Zeitpunkt an HA.
Diese Automation soll also nur auslösen wenn vorher niemand zu Hause ist und dann die erste Person nach hause kommt.
Wie kann ich es besser lösen? Meine Gedanken hängen fest
Hier die derzeitige Automations Option:
- conditions:
- condition: and
conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: trigger
id:
- Person2 Zu Hause
enabled: true
- condition: state
entity_id: person.person1
state: not_home
alias: Person2 als erste da
- condition: and
conditions:
- condition: trigger
id:
- Person1 Zu Hause
- condition: state
entity_id: person.person2
state: not_home
alias: Person1 als erste da
- condition: time
after: "07:00:10"
before: "16:59:50"
sequence:
- action: fan.set_percentage
target:
entity_id: fan.kwl
data:
percentage: 50
alias: Wenn der Erste zw. 7:00 und 17:00 nach Hause kommt 50%
by HarryP: Code-/Logzeilen formatiert (bitte immer in </> einbinden)
ja aber wie soll das helfen?
die Automation läuft ja so wie jetzt trotzdem an und stellt fest das der andere da ist, und regelt nicht wie vorgesehen weil keiner der Erste ist (also der Andere nicht abwesend ist zum Zeitpunkt des Durchlaufes)
irgendwie muss ich vorher eine Abfrage machen das keiner da war wenn einer heim kommt …
oh, ok, wird etwas umfangreicher…
(und danke für den Tip mit den </>)
alias: Lüftungsanlage nach Anwesenheit regeln
description: ""
triggers:
- trigger: state
entity_id:
- person.person1
to: not_home
id: person1 Ausser Haus
- trigger: state
entity_id:
- person.person2
to: not_home
id: person2 Ausser Haus
- trigger: state
entity_id:
- person.person1
to: home
id: person1 Zu Hause
- trigger: state
entity_id:
- person.person2
to: home
id: person2 Zu Hause
- trigger: time
at: "07:00:00"
id: Es ist 7:00 Uhr
- trigger: time
at: "09:00:00"
id: Es ist 9:00 Uhr
- trigger: time
at: "17:00:00"
id: es ist 17:00
- trigger: time
at: "21:00:00"
id: es ist 21 Uhr
conditions: []
actions:
- choose:
- conditions:
- condition: and
conditions:
- condition: trigger
id:
- Es ist 7:00 Uhr
enabled: true
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: person.person2
state: not_home
- condition: state
entity_id: person.person1
state: not_home
sequence:
- action: fan.set_percentage
target:
entity_id: fan.kwl
data:
percentage: 100
alias: Mo-Fr 7:00 wenn keiner da auf 100%
- conditions:
- condition: and
conditions:
- condition: time
after: "07:00:15"
before: "16:50:00"
- alias: wenn der letzte das Haus verlässt
condition: or
conditions:
- condition: and
conditions:
- condition: trigger
id:
- person1 Ausser Haus
- condition: state
entity_id: person.person2
state: not_home
- condition: and
conditions:
- condition: trigger
id:
- person2 Ausser Haus
enabled: true
- condition: state
entity_id: person.person1
state: not_home
sequence:
- action: fan.set_percentage
target:
entity_id: fan.kwl
data:
percentage: 75
alias: Wenn der letzte zw. 7:00 und 17:00 das Haus verlässt 75%
- conditions:
- condition: and
conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: trigger
id:
- person2 Zu Hause
enabled: true
- condition: state
entity_id: person.person1
state: not_home
alias: person2 als erste da
- condition: and
conditions:
- condition: trigger
id:
- person1 Zu Hause
- condition: state
entity_id: person.person2
state: not_home
alias: person1 als erster da
- condition: time
after: "07:00:10"
before: "16:59:50"
sequence:
- action: fan.set_percentage
target:
entity_id: fan.kwl
data:
percentage: 50
alias: Wenn der erste zw. 7:00 und 17:00 nach Hause kommt 50%
- conditions:
- condition: trigger
id:
- Es ist 9:00 Uhr
enabled: true
sequence:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: person.person2
state: home
- condition: state
entity_id: person.person1
state: home
alias: wenn jemand zu hause ist
sequence:
- action: fan.set_percentage
target:
entity_id: fan.kwl
data:
percentage: 50
- conditions:
- condition: and
conditions:
- condition: state
entity_id: person.person2
state: not_home
- condition: state
entity_id: person.person1
state: not_home
alias: wenn keiner zu hause ist
sequence:
- action: fan.set_percentage
target:
entity_id: fan.kwl
data:
percentage: 75
alias: tgl. 9:00 wenn jemand zu Hause ist auf 50% sonst 75%
- conditions:
- condition: trigger
id:
- es ist 17:00
enabled: true
sequence:
- action: fan.set_percentage
target:
entity_id: fan.kwl
data:
percentage: 50
alias: tgl. 17:00 auf 50%
- conditions:
- condition: trigger
id:
- es ist 21 Uhr
enabled: true
sequence:
- action: fan.set_percentage
target:
entity_id: fan.kwl
data:
percentage: 25
alias: tgl. 21:00 auf 25%
mode: single
Die Automation läuft bisher wie sie soll.
Doch heute wo beide Personen zur exakt selben Zeit laut HA nach Hause gekommen sind, lief sie auch für beide Personen durch, aber da zum selben Zeitpunkt die andere Person ja auch gerade da war, führte sie die Aktion auf 50% Schalten nicht durch weil die andere Person ja nicht gleichzeitig abwesend war.
Ich würde eher mit dem numeric_state der zone.home arbeiten.
Also wenn sich zone.home von 0 ändert, kommt jemand oder mehrere nach Hause.
Wenn zone.home sich zu 0 ändert, sind alle weg.