Hey guys and gals,
I am having issues trying to perfect my ceiling fan automation in the living room.
What I want is that it fires the automation when me or my wife are home and the temp is higher then 24 degrees, but when we turn it off manually (by switching the fan of through a button on the board/widget on the phone or through the remote of the fan), to pause the automation for an hour and turn of the fan when we are not home and turn it back on when we get home and the temp is 24+.
What I have now is the following, but I notice that it sometimes not works like it should (I also still have notifications to my phone in here to troubleshoot the automation which let me know when the trigger was manual or by the automation):
alias: TV Fan Automation
description: ""
trigger:
- platform: state
entity_id: fan.tv_fan
- platform: state
entity_id:
- climate.woonkamer
attribute: current_temperature
enabled: true
- platform: state
entity_id:
- person.fgod
to: not_home
- platform: state
entity_id:
- person.samantha
to: not_home
- platform: state
entity_id:
- person.samantha
to: home
- platform: state
entity_id:
- person.fgod
to: home
condition:
- condition: time
after: "07:00:00"
before: "23:00:00"
- condition: or
conditions:
- condition: state
entity_id: person.fgod
state: home
- condition: state
entity_id: person.samantha
state: home
- condition: and
conditions:
- condition: state
entity_id: person.fgod
state: not_home
- condition: state
entity_id: person.samantha
state: not_home
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.to_state.context.parent_id == none }}"
- condition: template
value_template: "{{ trigger.to_state.context.user_id == none }}"
- condition: template
value_template: "{{ trigger.to_state.context.id != none }}"
sequence:
- service: notify.mobile_app_moto_g200_5g
data:
message: "ParentID: None || UserID: None || ID: CONTENT"
title: Likely Physical Switched
- delay:
hours: 1
minutes: 0
seconds: 0
milliseconds: 0
enabled: true
- choose:
- conditions:
- condition: and
conditions:
- condition: numeric_state
entity_id: climate.woonkamer
above: 24
attribute: current_temperature
- condition: or
conditions:
- condition: state
entity_id: person.fgod
state: home
- condition: state
entity_id: person.samantha
state: home
- condition: or
conditions:
- condition: state
entity_id: fan.tv_fan
state: "off"
sequence:
- if:
- condition: state
entity_id: fan.tv_fan
state: "off"
then:
- type: turn_on
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: fan.tv_fan
domain: fan
- service: fan.set_percentage
data:
percentage: 25
target:
entity_id: fan.tv_fan
- conditions:
- condition: and
conditions:
- condition: or
conditions:
- condition: state
entity_id: fan.tv_fan
state: "on"
- condition: and
conditions:
- condition: state
entity_id: person.fgod
state: not_home
- condition: state
entity_id: person.samantha
state: not_home
sequence:
- type: turn_off
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: c2a476a49b1a8c63f897ecf704e27395
domain: fan
- conditions:
- condition: numeric_state
entity_id: climate.woonkamer
below: 22
attribute: current_temperature
sequence:
- if:
- condition: state
entity_id: fan.tv_fan
state: "on"
then:
- type: turn_off
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: fan.tv_fan
domain: fan
- conditions:
- condition: template
value_template: "{{ trigger.to_state.context.parent_id != none }}"
enabled: true
- condition: template
value_template: "{{ trigger.to_state.context.user_id == none }}"
enabled: true
- condition: template
value_template: "{{ trigger.to_state.context.id != none }}"
enabled: true
sequence:
- service: notify.mobile_app_moto_g200_5g
data:
title: Likely Automation switched
message: "ParentID: CONTENT || UserID: None || ID: CONTENT"
- choose:
- conditions:
- condition: and
conditions:
- condition: numeric_state
entity_id: climate.woonkamer
above: 24
attribute: current_temperature
- condition: or
conditions:
- condition: state
entity_id: person.fgod
state: home
- condition: state
entity_id: person.samantha
state: home
- condition: or
conditions:
- condition: state
entity_id: fan.tv_fan
state: "off"
sequence:
- if:
- condition: state
entity_id: fan.tv_fan
state: "off"
then:
- type: turn_on
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: fan.tv_fan
domain: fan
- service: fan.set_percentage
data:
percentage: 25
target:
entity_id: fan.tv_fan
- conditions:
- condition: and
conditions:
- condition: or
conditions:
- condition: state
entity_id: fan.tv_fan
state: "on"
- condition: and
conditions:
- condition: state
entity_id: person.fgod
state: not_home
- condition: state
entity_id: person.samantha
state: not_home
sequence:
- type: turn_off
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: c2a476a49b1a8c63f897ecf704e27395
domain: fan
- conditions:
- condition: numeric_state
entity_id: climate.woonkamer
below: 22
attribute: current_temperature
sequence:
- if:
- condition: state
entity_id: fan.tv_fan
state: "on"
then:
- type: turn_off
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: fan.tv_fan
domain: fan
- conditions:
- condition: template
value_template: "{{ trigger.to_state.context.parent_id == none }}"
- condition: template
value_template: "{{ trigger.to_state.context.user_id != none }}"
- condition: template
value_template: "{{ trigger.to_state.context.id != none }}"
sequence:
- service: notify.mobile_app_moto_g200_5g
data:
title: Likely UI switched
message: "ParentID: None || UserID: CONTENT || ID: CONTENT"
- delay:
hours: 1
minutes: 0
seconds: 0
milliseconds: 0
- choose:
- conditions:
- condition: and
conditions:
- condition: numeric_state
entity_id: climate.woonkamer
above: 24
attribute: current_temperature
- condition: or
conditions:
- condition: state
entity_id: person.fgod
state: home
- condition: state
entity_id: person.samantha
state: home
- condition: or
conditions:
- condition: state
entity_id: fan.tv_fan
state: "off"
sequence:
- if:
- condition: state
entity_id: fan.tv_fan
state: "off"
then:
- type: turn_on
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: fan.tv_fan
domain: fan
- service: fan.set_percentage
data:
percentage: 25
target:
entity_id: fan.tv_fan
- conditions:
- condition: and
conditions:
- condition: or
conditions:
- condition: state
entity_id: fan.tv_fan
state: "on"
- condition: and
conditions:
- condition: state
entity_id: person.fgod
state: not_home
- condition: state
entity_id: person.samantha
state: not_home
sequence:
- type: turn_off
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: c2a476a49b1a8c63f897ecf704e27395
domain: fan
- conditions:
- condition: numeric_state
entity_id: climate.woonkamer
below: 22
attribute: current_temperature
sequence:
- if:
- condition: state
entity_id: fan.tv_fan
state: "on"
then:
- type: turn_off
device_id: 9ec08cb2d0a4c1b644f060ef30ee8fff
entity_id: fan.tv_fan
domain: fan
default: []
mode: single
ultimately it would also be very nice if I can let it set the fan speed to higher values if the nest thermostat is exceeding for example 26 degrees.
Anyway, tips and help are very welcome on how to improve this automation to work as intended.