Files
Home-Assistant-Configs/packages/climate.yaml

304 lines
9.2 KiB
YAML

sensor:
- platform: template
sensors:
master_bedroom_current_temp:
friendly_name: "Master Bedroom Current Temp"
value_template: >
{{ state_attr('climate.master_bedroom_aircon','current_temperature') | float }}
master_bedroom_outdoor_temp:
friendly_name: "Master Bedroom Outdoor Temp"
value_template: >
{{ state_attr('climate.master_bedroom_aircon','outdoor_temperature') | float }}
master_bedroom_target_temp:
friendly_name: "Master Bedroom Target Temp"
value_template: >
{{ state_attr('climate.master_bedroom_aircon','temperature') | float }}
master_bedroom_aircon_eco_mode:
friendly_name: "Master Bedroom Eco Mode"
value_template: >-
{% if is_state_attr('climate.master_bedroom_aircon','preset_mode','eco') %}
On
{% elif is_state_attr('climate.master_bedroom_aircon','preset_mode','none') %}
Off
{% else %}
Off
{% endif %}
icon_template: >-
{% if is_state_attr('climate.master_bedroom_aircon','preset_mode','eco') %}
mdi:home-lightning-bolt
{% elif is_state_attr('climate.master_bedroom_aircon','preset_mode','none') %}
mdi:home-lightning-bolt-outline
{% else %}
mdi:home-lightning-bolt-outline
{% endif %}
availability_template: >-
{% if is_state('input_boolean.master_bedroom_aircon_installed','on') %}
true
{% else %}
false
{% endif %}
master_bedroom_aircon_fan_mode:
friendly_name: "Master Bedroom Aircon Fan Mode"
value_template: >
{{ state_attr('climate.master_bedroom_aircon','fan_mode') }}
icon_template: >
{% if is_state_attr('climate.master_bedroom_aircon','fan_mode','Auto') %}
mdi:fan-auto
{% elif is_state_attr('climate.master_bedroom_aircon','fan_mode','Low') %}
mdi:fan-speed-1
{% elif is_state_attr('climate.master_bedroom_aircon','fan_mode','Medium') %}
mdi:fan-speed-2
{% elif is_state_attr('climate.master_bedroom_aircon','fan_mode','High') %}
mdi:fan-speed-3
{% else %}
mdi:fan-off
{% endif %}
input_boolean:
master_bedroom_nighttime_protocol:
name: Master Bedroom Nighttime Protocol
icon: mdi:lightbulb-night
kallen_bedtime_protocol:
name: Kallen Bedtime Protocol
icon: mdi:lightbulb-night
# Turn on when master bedroom air conditioner is installed, turn off in winter when we take it out, for smarter automations
master_bedroom_aircon_installed:
name: Master Bedroom Aircon Installed
icon: mdi:tools
# Same thing, but for Emma's bedroom air conditioner
emma_bedroom_aircon_installed:
name: Emma Bedroom Aircon Installed
icon: mdi:tools
# Used internally for automations to know if cooling time has passed or not
master_bedroom_cooling_on:
name: Master Bedroom Cooling On
# Activated if the day will be excessively hot. For use with automations for daytime climate control.
hot_day:
name: Hot Day
icon: mdi:heat-wave
input_select:
scheduled_climate_mode_master_bedroom_aircon:
name: Scheduled Climate Mode - Master Bedroom Aircon
options:
- AC
- Fan
- N/A
icon: mdi:home-thermometer
scheduled_climate_mode_master_bedroom_fan:
name: Scheduled Climate Mode - Master Bedroom Fan
options:
- Fan
- N/A
icon: mdi:home-thermometer
scheduled_climate_mode_emma_aircon:
name: Scheduled Climate Mode - Emma Aircon
options:
- AC
- White Noise
- N/A
icon: mdi:home-thermometer
scheduled_climate_mode_kallen_fan:
name: Scheduled Climate Mode - Kallen Fan
options:
- Fan
- White Noise
- N/A
icon: mdi:home-thermometer
input_number:
master_bedroom_daytime_temp:
name: Master Bedroom Daytime Temp
min: 65
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
master_bedroom_night_temp:
name: Master Bedroom Night Temp
min: 65
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
master_bedroom_bedtime_temp:
name: Master Bedroom Bedtime Temp
min: 65
max: 80
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
master_bedroom_aircon_run_threshold:
name: Master Bedroom Aircon Run Threshold
min: 40
max: 70
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
master_bedroom_aircon_mode_threshold:
name: Master Bedroom Aircon Mode Threshold
min: 40
max: 70
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
master_bedroom_fan_threshold:
name: Master Bedroom Fan Threshold
min: 40
max: 70
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
master_bedroom_daytime_threshold:
name: Master Bedroom Daytime Threshold
min: 60
max: 90
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
emma_aircon_threshold:
name: Emma Aircon Threshold
min: 40
max: 70
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
kallen_fan_threshold:
name: Kallen Fan Threshold
min: 40
max: 70
step: 1
unit_of_measurement: °F
icon: mdi:thermometer
hot_day_threshold:
name: Hot Day Threshold
min: 70
max: 90
step: 1
unit_of_measurement: °F
automation:
- id: '1655415573165'
alias: Emma Bedroom Handling
description: "For scheduled operations in Emma's bedroom"
trigger:
- platform: time
at: input_datetime.emma_wakeup
id: emma-wakeup
- platform: time
at: input_datetime.emma_bedtime
id: emma-bedtime
condition:
- condition: state
entity_id: input_boolean.vacation_mode
state: 'off'
action:
- if:
- condition: trigger
id: emma-wakeup
then:
- service: script.emma_wakeup
- if:
- condition: trigger
id: emma-bedtime
then:
- choose:
- conditions:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: AC
sequence:
- service: fan.turn_on
target:
entity_id: fan.emma_air_conditioner
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "The air conditioner in Emma's Bedroom has been activated."
- conditions:
- condition: state
entity_id: input_select.scheduled_climate_mode_emma_aircon
state: White Noise
sequence:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.white_noise_emma_bedroom
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "White noise has been activated in Emma's Bedroom."
default:
- service: script.text_notify
data:
who: "parents"
title: "Emma Climate Schedule"
message: "No option selected for Emma's climate mode. No devices will be activated."
mode: restart
script:
emma_wakeup:
alias: "Emma Wakeup"
mode: restart
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.early_night_mode
state: 'on'
sequence:
- service: input_select.select_option
target:
entity_id: input_select.emma_bedroom_scenes
data:
option: Nightlight
- service: light.turn_on
target:
entity_id: light.hallway_overhead
- delay:
seconds: 2
- service: input_select.select_option
target:
entity_id:
- input_select.upstairs_hallway_scenes
- input_select.master_bedroom_scenes
data:
option: Adaptive
- conditions:
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.morning
state: 'on'
- condition: state
entity_id: binary_sensor.late_morning
state: 'on'
sequence:
- service: light.turn_on
target:
entity_id: light.emma_bedroom_light
- service: input_select.select_option
target:
entity_id: input_select.emma_bedroom_scenes
data:
option: Adaptive
- delay:
minutes: 5
- service: input_boolean.turn_off
target:
entity_id: input_boolean.white_noise_emma_bedroom
- if:
- condition: template
value_template: >-
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
{% if is_state('input_boolean.hot_day','off') and ct < state_attr('input_datetime.emma_bedtime','timestamp') and ct >= state_attr('input_datetime.emma_wakeup','timestamp') %}
true
{% else %}
false
{% endif %}
then:
- service: fan.turn_off
target:
entity_id: fan.emma_air_conditioner