Files
homeAssistant/automations.yaml
2019-06-27 09:57:01 -04:00

234 lines
6.2 KiB
YAML

- alias: 'Come home lights on if dark'
trigger:
- platform: state
entity_id: device_tracker.dan_dansphone
to: 'home'
condition:
condition: and
conditions:
- condition: state
entity_id: device_tracker.dan_dansphone
state: 'home'
- condition: sun
after: sunset
after_offset: '-01:00:00'
action:
- service: light.turn_on
entity_id: group.lightautomation
- service: notify.notify_dan
data:
title: 'Lights on'
message: 'All lights turned on'
- delay: '00:05:00'
- service: light.turn_off
entity_id: light.sengled_e11g13_030b3e1d_1
- service: notify.notify_dan
data:
title: 'EntryWay Light Off - Beacon'
message: 'Entryway light turned off. Welcome Home.'
- alias: 'Leave and lights turn off'
trigger:
platform: state
entity_id: device_tracker.dan_dansphone
to: 'not_home'
condition:
condition: state
entity_id: group.all_lights
state: 'on'
action:
- service: light.turn_off
entity_id: group.all_lights
- service: notify.notify_dan
data:
title: 'Lights off'
message: 'All lights have been turned off'
- alias: 'Switch on'
trigger:
platform: sun
event: sunset
offset: '-01:00:00'
action:
service: switch.turn_on
entity_id: switch.linear_ps15z2_plugin_appliance_module_switch
- alias: 'Switch off'
trigger:
platform: time
at: '00:00:00'
action:
service: switch.turn_off
entity_id: switch.linear_ps15z2_plugin_appliance_module_switch
#- alias: 'Lights_On_Beacon'
# trigger:
# - platform: state
# entity_id: sensor.Dan, sensor.Guest
# from: 'not_home'
# condition:
# condition: and
# conditions:
# - condition: sun
# after: sunset
# after_offset: "-1:00:00"
# - condition: state
# entity_id: group.lightautomation
# state: 'off'
# action:
# - service: light.turn_on
# entity_id: group.lightautomation
# - service: notify.notify_dan
# data:
# title: 'Lights on - Beacon'
# message: 'All lights turned on via beacon'
#
#- alias: 'Entryway_Off_Beacon'
# trigger:
# - platform: state
# entity_id: sensor.Dan
# from: 'EntryWay - HB'
# to: 'Bedroom'
# condition:
# condition: state
# entity_id: light.sengled_e11g13_030b3e1d_1
# state: 'on'
# action:
# - service: light.turn_off
# entity_id: light.sengled_e11g13_030b3e1d_1
# - service: notify.notify_dan
# data:
# title: 'EntryWay Light Off - Beacon'
# message: 'Entryway light turned off. Welcome Home.'
#
#- alias: 'Lights_off_Beacon'
# trigger:
# platform: state
# entity_id: sensor.Dan, sensor.Guest
# to: 'not_home'
# condition:
# condition: state
# entity_id: group.all_lights
# state: 'on'
# action:
# - service: light.turn_off
# entity_id: group.all_lights
# - service: notify.notify_dan
# data:
# title: 'Lights off - Beacon'
# message: 'All lights have been turned off via beacon'
- alias: 'Lights on when home'
trigger:
- platform: sun
event: sunset
offset: '-01:00:00'
condition:
condition: and
conditions:
- condition: template
##value_template: "{% if not is_state('sensor.dan', 'not_home') or not is_state('sensor.guest', 'not_home') or is_state('device_tracker.dan_dansphone', 'home') %}true{% endif %}"
value_template: "{% if is_state('device_tracker.dan_dansphone', 'home') %}true{% endif %}"
- condition: state
entity_id: group.lightlivingroom
state: 'off'
action:
- service: light.turn_on
entity_id: group.lightlivingroom
- service: notify.notify_dan
data:
title: 'Living Room Lights on - Sunset'
message: 'Living Room Lights turned on. But you probably know that.'
- alias: 'IFTT'
trigger:
platform: event
event_type: ifttt_webhook_received
event_data:
action: call_service
action:
service_template: '{{ trigger.event.data.service }}'
data_template:
entity_id: '{{ trigger.event.data.entity_id }}'
#########Climate Automations######
- alias: 'Set Away Mode'
trigger:
platform: state
entity_id: device_tracker.dan_dansphone
to: 'not_home'
from: 'home'
condition:
condition: template
value_template: "{% if not is_state('climate.home', 'off') %}true{% endif %}"
action:
- service: climate.set_away_mode
entity_id: climate.home
data:
away_mode: 'on'
- service: notify.notify_dan
data:
title: 'Left House - Set thermostate to Away'
message: 'Thermostat set to away mode'
- service: input_boolean.turn_on
data:
entity_id: input_boolean.thermostat_mode
- alias: 'Leave Work Set Home Mode'
trigger:
platform: state
entity_id: device_tracker.dan_dansphone
to: 'not_home'
from: 'Work'
condition:
- condition: template
value_template: "{% if not is_state('climate.home', 'off') %}true{% endif %}"
- condition: time
weekday:
- mon
- tue
- wed
- thu
action:
- service: climate.set_away_mode
entity_id: climate.home
data:
away_mode: 'off'
- service: notify.notify_dan
data:
title: 'Left Work - Set thermostate to Home'
message: 'Thermostat set to home mode'
- service: input_boolean.turn_off
data:
entity_id: input_boolean.thermostat_mode
- alias: 'Set Home Mode'
trigger:
platform: state
entity_id: device_tracker.dan_dansphone
to: 'home'
from: 'not_home'
condition:
- condition: template
value_template: "{% if not is_state('climate.home', 'off') %}true{% endif %}"
- condition: state
entity_id: input_boolean.thermostat_mode
state: 'on'
action:
- service: climate.set_away_mode
entity_id: climate.home
data:
away_mode: 'off'
- service: notify.notify_dan
data:
title: 'Back Home - Set thermostate to Home'
message: 'Thermostat set to home mode'
- service: input_boolean.turn_off
data:
entity_id: input_boolean.thermostat_mode