Skip to content

Instantly share code, notes, and snippets.

@mikesmitty
Last active April 25, 2023 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikesmitty/7888f4c80f3e0b6e0a10aa6f57d46d89 to your computer and use it in GitHub Desktop.
Save mikesmitty/7888f4c80f3e0b6e0a10aa6f57d46d89 to your computer and use it in GitHub Desktop.
Home Assistant Basic Layout
---
- alias: Climate - Bathroom - House Mode/Presence
description: ''
trigger:
- entity_id:
- input_select.house_mode
- input_select.presence
platform: state
action:
- choose:
# Turn off
- conditions: >
{{- not (is_state('input_select.house_mode', 'morning')
or is_state('input_select.house_mode', 'evening'))
or is_state('input_select.presence', 'away') }}
sequence:
- data:
entity_id: climate.bathroom_heater
preset_mode: 'Energy heat'
service: climate.set_preset_mode
# Turn on
- conditions: >
{{- (is_state('input_select.house_mode', 'morning')
or is_state('input_select.house_mode', 'evening'))
and is_state('input_select.presence', 'home') }}
sequence:
- data:
entity_id: climate.bathroom_heater
preset_mode: 'none'
service: climate.set_preset_mode
---
###################################################
# Home/Away states
###################################################
- alias: State - Home/Away - Away
description: ''
trigger:
- entity_id: group.household
platform: state
to: not_home
condition: []
action:
- data:
entity_id: input_select.presence
option: away
service: input_select.select_option
- alias: State - Home/Away - Home
description: ''
trigger:
- entity_id: group.household
platform: state
to: home
condition: []
action:
- data:
entity_id: input_select.presence
option: home
service: input_select.select_option
###################################################
# Parts of day states
###################################################
- alias: State - House Mode - Morning
description: ''
trigger:
- at: '05:00'
platform: time
- at: '08:00'
platform: time
condition: >
{%- set hour = now().strftime("%H") |int -%}
{{- is_state('binary_sensor.workday_sensor', 'on') or hour == 8 -}}
action:
- data:
entity_id: input_select.house_mode
option: morning
service: input_select.select_option
- alias: State - House Mode - Day
description: ''
trigger:
- at: '10:00'
platform: time
- at: '12:00'
platform: time
condition: >
{%- set hour = now().strftime("%H") |int -%}
{{- is_state('binary_sensor.workday_sensor', 'on') or hour == 12 -}}
action:
- data:
entity_id: input_select.house_mode
option: day
service: input_select.select_option
- alias: State - House Mode - Evening
description: ''
trigger:
- at: '22:30'
platform: time
condition: []
action:
- data:
entity_id: input_select.house_mode
option: evening
service: input_select.select_option
- alias: State - House Mode - Night
description: ''
trigger:
- at: '23:30'
platform: time
- at: '23:59'
platform: time
condition: >
{{- is_state('binary_sensor.workday_tomorrow', 'on')
or now().strftime('%H:%M') == '23:59' -}}
action:
- data:
entity_id: input_select.house_mode
option: night
service: input_select.select_option
---
- platform: workday
country: US
- name: Workday Tomorrow
platform: workday
country: US
days_offset: 1
[...]
automation: !include_dir_merge_list automation
binary_sensor: !include binary_sensor.yaml
[...]
input_select: !include input_select.yaml
[...]
house_mode:
name: House mode
options:
- morning
- day
- evening
- night
presence:
name: Presence
options:
- home
- away
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment