You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Home-AssistantConfig/config/automation/Timed_Triggers/sunset_turn_on.yaml

205 lines
8.0 KiB

######################################################################
# @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# -------------------------------------------------------------------
# Sunset Trigger - evening lighting kickoff
# Turns on interior/exterior accents around sunset with safety checks.
# -------------------------------------------------------------------
######################################################################
- alias: 'Sunset Stuff on'
id: d0db568c-0aa2-42cc-b5be-ba546e39b639
mode: queued
trigger:
- platform: sun
event: sunset
offset: "-00:15:00"
condition:
- condition: template
value_template: "{{ states('binary_sensor.powerwall_grid_status') == 'on' }}"
action:
- delay: '00:{{ (range(1, 20)|random|int) }}:00'
- variables:
vacation_presence_delay_minutes: "{{ 90 + (range(15, 31) | random | int) }}"
vacation_presence_runtime_minutes: "{{ 240 + (range(15, 31) | random | int) }}"
vacation_presence_delay: >-
{{ '%02d:%02d:00' | format((vacation_presence_delay_minutes | int) // 60, (vacation_presence_delay_minutes | int) % 60) }}
vacation_presence_runtime: >-
{{ '%02d:%02d:00' | format((vacation_presence_runtime_minutes | int) // 60, (vacation_presence_runtime_minutes | int) % 60) }}
vacation_presence_switch: >-
{{ 'switch.office_accent' if (range(0, 2) | random | int) == 0 else 'switch.front_office_lamp' }}
vacation_presence_light: >-
{{ 'light.upstairs_lamp' if (range(0, 2) | random | int) == 0 else 'light.ikea_1' }}
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: group.family
state: 'home'
- condition: state
entity_id: input_boolean.house_sitter_present
state: 'on'
sequence:
- service: script.speech_engine
data:
call_dark_outside: 1
call_window_check: 1
- service: homeassistant.turn_on
entity_id:
- switch.front_landscaping
# - switch.villaneri
- light.bedroom
- group.outdoor_seasonal
- service: script.monthly_color_scene
- service: light.turn_on
entity_id:
- light.outdoor_bathroom
data:
brightness: >
{% if states.group.family.state == 'home' -%}
10
{% elif is_state('input_boolean.vacation_mode', 'on') and is_state('input_boolean.house_sitter_present', 'off') -%}
35
{% else %}
150
{% endif %}
- choose:
- conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
sequence:
- wait_template: >-
{{ states.group.family.state == 'home' }}
- service: homeassistant.turn_on
entity_id:
- group.master_bathroom_accents
- switch.back_landscaping
- switch.front_door_outlet
- switch.foyer_outlet
- switch.den_outlet
- switch.front_office_lamp
- switch.office_accent
- switch.living_room_outlet
- switch.living_room_tv_outlet
- service: light.turn_on
entity_id:
- light.living_room_accents
- light.upstairs_lamp
- light.ikea_1 #Upstairs Hallyway switchoutlet.
- conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
- condition: state
entity_id: input_boolean.house_sitter_present
state: 'on'
sequence:
- service: homeassistant.turn_on
entity_id:
- group.master_bathroom_accents
- switch.back_landscaping
- switch.front_door_outlet
- switch.foyer_outlet
- switch.den_outlet
- switch.front_office_lamp
- switch.office_accent
- switch.living_room_outlet
- switch.living_room_tv_outlet
- service: light.turn_on
entity_id:
- light.living_room_accents
- light.upstairs_lamp
- light.ikea_1 #Upstairs Hallyway switchoutlet.
- conditions:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
- condition: state
entity_id: input_boolean.house_sitter_present
state: 'off'
sequence:
- delay: "{{ vacation_presence_delay }}"
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
- condition: state
entity_id: input_boolean.house_sitter_present
state: 'off'
- choose:
- conditions:
- condition: template
value_template: "{{ vacation_presence_switch == 'switch.office_accent' }}"
sequence:
- service: homeassistant.turn_on
entity_id:
- switch.front_door_outlet
- switch.foyer_outlet
- switch.living_room_outlet
- switch.office_accent
default:
- service: homeassistant.turn_on
entity_id:
- switch.front_door_outlet
- switch.foyer_outlet
- switch.living_room_outlet
- switch.front_office_lamp
- choose:
- conditions:
- condition: template
value_template: "{{ vacation_presence_light == 'light.upstairs_lamp' }}"
sequence:
- service: light.turn_on
entity_id:
- light.living_room_accents
- light.upstairs_lamp
default:
- service: light.turn_on
entity_id:
- light.living_room_accents
- light.ikea_1
- delay: "{{ vacation_presence_runtime }}"
- condition: state
entity_id: input_boolean.vacation_mode
state: 'on'
- condition: state
entity_id: input_boolean.house_sitter_present
state: 'off'
- choose:
- conditions:
- condition: template
value_template: "{{ vacation_presence_switch == 'switch.office_accent' }}"
sequence:
- service: homeassistant.turn_off
entity_id:
- switch.front_door_outlet
- switch.foyer_outlet
- switch.living_room_outlet
- switch.office_accent
default:
- service: homeassistant.turn_off
entity_id:
- switch.front_door_outlet
- switch.foyer_outlet
- switch.living_room_outlet
- switch.front_office_lamp
- choose:
- conditions:
- condition: template
value_template: "{{ vacation_presence_light == 'light.upstairs_lamp' }}"
sequence:
- service: light.turn_off
entity_id:
- light.living_room_accents
- light.upstairs_lamp
default:
- service: light.turn_off
entity_id:
- light.living_room_accents
- light.ikea_1

Powered by TurnKey Linux.