diff --git a/automations.yaml b/automations.yaml index dae733e..14771ee 100644 --- a/automations.yaml +++ b/automations.yaml @@ -6309,3 +6309,27 @@ who: all alias: Routing mode: restart +- id: '1765674032722' + alias: Emma Bedroom Heater + description: Turns Emma's bedroom heater on at the scheduled time + triggers: + - trigger: time + at: input_datetime.emma_bedroom_climate + alias: Emma Bedroom Climate + conditions: + - condition: state + entity_id: input_select.scheduled_climate_mode_emma_bedroom + state: + - Heat + - condition: state + entity_id: input_boolean.emma_bedroom_heater_installed + state: + - 'on' + actions: + - action: climate.set_hvac_mode + metadata: {} + target: + entity_id: climate.emma_bedroom_vtherm + data: + hvac_mode: heat + mode: restart diff --git a/packages/climate.yaml b/packages/climate.yaml index 959c29b..8aef6d2 100644 --- a/packages/climate.yaml +++ b/packages/climate.yaml @@ -352,6 +352,20 @@ input_number: step: 1 unit_of_measurement: °F icon: mdi:thermometer + emma_bedroom_heater_run_threshold: + name: Emma Bedroom Heater Run Threshold + min: 40 + max: 80 + step: 1 + unit_of_measurement: °F + icon: mdi:thermometer + emma_bedroom_heater_shutoff_threshold: + name: Emma Bedroom Heater Shutoff Threshold + min: 40 + max: 80 + step: 1 + unit_of_measurement: °F + icon: mdi:thermometer emma_bedroom_aircon_run_threshold: name: Emma Bedroom Aircon Run Threshold min: 40 diff --git a/packages/emmalynn.yaml b/packages/emmalynn.yaml index e28f0b9..d06b67a 100644 --- a/packages/emmalynn.yaml +++ b/packages/emmalynn.yaml @@ -48,8 +48,8 @@ input_datetime: has_date: false has_time: true icon: mdi:fan-auto - emma_bedroom_cooling: - name: Emma Bedroom Cooling + emma_bedroom_climate: + name: Emma Bedroom Climate has_date: false has_time: true icon: mdi:fan-auto @@ -899,3 +899,6 @@ script: - service: input_boolean.turn_off target: entity_id: input_boolean.white_noise_emma_bedroom + - service: climate.turn_off + target: + entity_id: climate.emma_bedroom_vtherm diff --git a/packages/scheduling.yaml b/packages/scheduling.yaml index 9a3e2ca..9b72522 100644 --- a/packages/scheduling.yaml +++ b/packages/scheduling.yaml @@ -710,33 +710,51 @@ script: data: option: > {% set low = states('sensor.overnight_lowest_temperature') | int %} - {% set run_threshold = states('input_number.emma_bedroom_aircon_run_threshold') | int %} - {% set mode_threshold = states('input_number.emma_bedroom_aircon_mode_threshold') | int %} - {% if is_state('input_boolean.emma_bedroom_aircon_installed','off') %} + {% set aircon_run_threshold = states('input_number.emma_bedroom_aircon_run_threshold') | int %} + {% set aircon_mode_threshold = states('input_number.emma_bedroom_aircon_mode_threshold') | int %} + {% set heater_run_threshold = states('input_number.emma_bedroom_heater_run_threshold') | int %} + {% if is_state('input_boolean.emma_bedroom_aircon_installed','off') and is_state('input_boolean.emma_bedroom_heater_installed','off') %} White Noise - {% elif low >= run_threshold %} - {% if low >= mode_threshold %} + {% elif low >= aircon_run_threshold and is_state('input_boolean.emma_bedroom_aircon_installed','on') %} + {% if low >= aircon_mode_threshold %} AC {% else %} Fan {% endif %} + {% elif low < heater_run_threshold and is_state('input_boolean.emma_bedroom_heater_installed','on') %} + Heat {% else %} White Noise {% endif %} + - delay: + milliseconds: 500 - service: input_datetime.set_datetime target: - entity_id: input_datetime.emma_bedroom_cooling + entity_id: input_datetime.emma_bedroom_climate data: time: > {% set high = states('sensor.todays_high_temp') | int %} {% set low = states('sensor.overnight_lowest_temperature') | int %} {% set bedtime = state_attr('input_datetime.emma_bedtime','timestamp') | int %} - {% if is_state('input_boolean.hot_day','on') %} - {{ (bedtime - 5400) | timestamp_custom('%H:%M',false) }} - {% elif high >= 80 or low >= 60 %} - {{ (bedtime - 3600) | timestamp_custom('%H:%M',false) }} + {% set schedmode = states('input_select.scheduled_climate_mode_emma_bedroom') %} + {% if schedmode in ['AC','Fan'] and is_state('input_boolean.emma_bedroom_aircon_installed','on') %} + {% if is_state('input_boolean.hot_day','on') %} + {{ (bedtime - 5400) | timestamp_custom('%H:%M',false) }} + {% elif high >= 80 or low >= 60 %} + {{ (bedtime - 3600) | timestamp_custom('%H:%M',false) }} + {% else %} + {{ (bedtime - 1800) | timestamp_custom('%H:%M',false) }} + {% endif %} + {% elif schedmode == 'Heat' and is_state('input_boolean.emma_bedroom_heater_installed','on') %} + {% if low <= 20 %} + {{ (bedtime - 5400) | timestamp_custom('%H:%M',false) }} + {% elif low <= 32 %} + {{ (bedtime - 3600) | timestamp_custom('%H:%M',false) }} + {% else %} + {{ (bedtime - 1800) | timestamp_custom('%H:%M',false) }} + {% endif %} {% else %} - {{ (bedtime - 1800) | timestamp_custom('%H:%M',false) }} + {{ bedtime | timestamp_custom('%H:%M',false) }} {% endif %} - service: input_boolean.turn_on target: diff --git a/scripts.yaml b/scripts.yaml index f7a3060..0147e0f 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -2591,27 +2591,28 @@ kallen_night_meds: minutes: 0 seconds: 5 milliseconds: 0 - - parallel: - - data: + - alias: Send text notifications + parallel: + - alias: Send to parents + data: who: "{% if states('person.christina_stork') in ['Bob Evans','BobEvans'] %}\n \ tony\n{% else %}\n parents\n{% endif %}\n" type: alert title: Night Meds - message: Kallen needs to take his night meds (melatonin) + message: Kallen needs to take his night meds tag: kallen-night-meds actions: - action: KALLEN_NIGHT_MEDS_TAKEN title: Taken - action: KALLEN_NIGHT_MEDS_SKIPPED title: Skip - alias: Send to parents action: script.text_notify - alias: Send to Kallen data: who: kallen type: alert title: Night Meds - message: You need to take your night meds (melatonin) + message: You need to take your night meds tag: kallen-night-meds actions: - action: KALLEN_NIGHT_MEDS_TAKEN @@ -2619,7 +2620,6 @@ kallen_night_meds: - action: KALLEN_NIGHT_MEDS_SKIPPED title: Skip action: script.text_notify - alias: Send text notifications icon: mdi:medication mode: restart reset_annc_switches: @@ -3071,33 +3071,70 @@ emma_sleep: option: Adaptive alias: Set lights to adaptive action: input_select.select_option - - if: - - alias: White Noise - condition: and - conditions: - - condition: state - entity_id: input_select.scheduled_climate_mode_emma_bedroom - state: White Noise - alias: Scheduled mode is White Noise - - condition: state - entity_id: input_boolean.white_noise_emma_bedroom - state: 'off' - alias: White Noise is not already on - then: - - target: - entity_id: input_boolean.white_noise_emma_bedroom - data: {} - alias: Turn on white noise - action: input_boolean.turn_on - - data: - who: parents - title: Emma Climate Schedule - message: White noise has been activated in Emma's Bedroom. - type: normal - tag: emma-climate - alias: Send white noise notification - action: script.text_notify - alias: Select climate mode + - alias: Set climate mode if not already set + choose: + - conditions: + - alias: White Noise + condition: and + conditions: + - condition: state + entity_id: input_select.scheduled_climate_mode_emma_bedroom + state: White Noise + alias: Scheduled mode is White Noise + - condition: state + entity_id: input_boolean.white_noise_emma_bedroom + state: 'off' + alias: White Noise is not already on + sequence: + - target: + entity_id: input_boolean.white_noise_emma_bedroom + data: {} + alias: Turn on white noise + action: input_boolean.turn_on + - data: + who: parents + title: Emma Climate Schedule + message: White noise has been activated in Emma's Bedroom. + type: normal + tag: emma-climate + alias: Send white noise notification + action: script.text_notify + - conditions: + - condition: and + conditions: + - condition: state + entity_id: input_select.scheduled_climate_mode_emma_bedroom + state: + - Heat + alias: Heat + - condition: state + entity_id: climate.emma_bedroom_vtherm + state: + - 'off' + alias: Heat is not already on + alias: Heat + sequence: + - action: climate.set_hvac_mode + metadata: {} + target: + entity_id: climate.emma_bedroom_vtherm + data: + hvac_mode: heat + alias: Turn on heater + - action: input_boolean.turn_on + metadata: {} + target: + entity_id: input_boolean.white_noise_emma_bedroom + data: {} + alias: Turn on white noise + - alias: Send heater notification + data: + who: parents + title: Emma Climate Schedule + message: The space heater has been activated in Emma's Bedroom. + type: normal + tag: emma-climate + action: script.text_notify icon: mdi:lightbulb-night mode: restart tina_morning_meds: diff --git a/templates/speech/nightly_briefing.yaml b/templates/speech/nightly_briefing.yaml index 003f48c..5da4a71 100644 --- a/templates/speech/nightly_briefing.yaml +++ b/templates/speech/nightly_briefing.yaml @@ -73,11 +73,11 @@ {% endif %} {% if states('input_select.scheduled_climate_mode_emma_bedroom_aircon') != 'N/A' %} {% if is_state('input_select.scheduled_climate_mode_emma_bedroom_aircon','AC') and is_state('input_boolean.hot_day','on') %} - "Today was a hot day, so Emma's bedroom air conditioner will start cooling a bit earlier tonight at {{ input_datetime_read('input_datetime.emma_bedroom_cooling') }}. " + "Today was a hot day, so Emma's bedroom air conditioner will start cooling a bit earlier tonight at {{ input_datetime_read('input_datetime.emma_bedroom_climate') }}. " {% elif is_state('input_select.scheduled_climate_mode_emma_bedroom_aircon','AC') %} - "Emma's bedroom air conditioner will start cooling at {{ input_datetime_read('input_datetime.emma_bedroom_cooling') }}. " + "Emma's bedroom air conditioner will start cooling at {{ input_datetime_read('input_datetime.emma_bedroom_climate') }}. " {% elif is_state('input_select.scheduled_climate_mode_emma_bedroom_aircon','Fan') %} - "Emma's bedroom air conditioner will activate fan only mode at {{ input_datetime_read('input_datetime.emma_bedroom_cooling') }}. " + "Emma's bedroom air conditioner will activate fan only mode at {{ input_datetime_read('input_datetime.emma_bedroom_climate') }}. " {% elif is_state('input_select.scheduled_climate_mode_emma_bedroom','White Noise') and is_state('input_boolean.white_noise_emma_bedroom','off') %} "Emma's white noise generator will activate at {{ input_datetime_read('input_datetime.emma_bedtime') }}. " {% endif %}