Adding new school tomorrow sensor to improve automations

This commit is contained in:
Jeffrey Stone 2020-05-17 21:29:52 -04:00
parent a021c13929
commit 23977ffee6
3 changed files with 80 additions and 11 deletions

View File

@ -531,6 +531,22 @@
07:15 07:15
{% endif %} {% endif %}
- id: set_skylar_nightly_report_time
alias: set skylar nightly report time
trigger:
- platform: time
at: '18:30:00'
action:
- service: input_datetime.set_datetime
entity_id: input_datetime.skylar_nightly_report
data_template:
time: >
{% if states.sensor.school_tomorrow.state == 'on' %}
19:00
{% else %}
20:00
{% endif %}
- id: set_good_morning_time - id: set_good_morning_time
alias: set good morning time alias: set good morning time
trigger: trigger:
@ -607,7 +623,7 @@
state: 'off' state: 'off'
- above: '73' - above: '73'
condition: numeric_state condition: numeric_state
entity_id: sensor.upstairs_temperature entity_id: sensor.living_room_temperature
action: action:
- data: - data:
entity_id: switch.living_room_fan entity_id: switch.living_room_fan
@ -705,5 +721,48 @@
- service: script.kitchen_lights_night - service: script.kitchen_lights_night
- service: script.dog_mode_on - service: script.dog_mode_on
- service: script.kitchen_lights_on - service: script.kitchen_lights_on
- service: script.kitchen_lights_morning
- id: driveway_motion_lighting
alias: Driveway Motion Lighting
initial_state: true
trigger:
- platform: state
entity_id: binary_sensor.aarlo_motion_driveway
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
- service: switch.turn_on
entity_id: switch.driveway_light
- delay:
minutes: 3
- service: switch.turn_off
entity_id: switch.driveway_light
- alias: "Delivered Package Notification"
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.mail_fedex_delivered
#send only if mail or packages are more than 0
condition:
- condition: or
conditions:
- condition: template
value_template: "{{ states('sensor.mail_fedex_delivered') | int > 0 }}"
action:
- service: script.text_notify
data_template:
who: "jeff"
title: "Package Delivered"
message: "Fedex just made a delivery"
- service: script.ah_report
data_template:
usps: >-
{%- if states.sensor.mail_fedex_delivered.state | int > 0 -%}
Federal Express just left something on the porch.
{%- endif -%}
call_interuption: 1

View File

@ -737,7 +737,7 @@ script:
{% endmacro %} {% endmacro %}
{% macro prebed_routine() %} {% macro prebed_routine() %}
Skylar, Skylar,
{{ [ 'It is time to get in the bath. ', {{ [ 'It is time to get in the bath. ',
'You only have thirty minutes until bedtime. That means you should be heading for the bathtub. Time to get clean.', 'You only have thirty minutes until bedtime. That means you should be heading for the bathtub. Time to get clean.',
'I cannot communicate with the bathtub. Or I would have started the water for you already. So you will have to start the bath, <emphasis>yourself</emphasis>', 'I cannot communicate with the bathtub. Or I would have started the water for you already. So you will have to start the bath, <emphasis>yourself</emphasis>',
@ -746,12 +746,13 @@ script:
'Did you ever hear the one about the kid who never took a bath? <break time="2s"/>Yeah, me <emphasis>either</emphasis>. So we should keep it that way. Bath time now, <emphasis>sir</emphasis>.', 'Did you ever hear the one about the kid who never took a bath? <break time="2s"/>Yeah, me <emphasis>either</emphasis>. So we should keep it that way. Bath time now, <emphasis>sir</emphasis>.',
'Tee Minus 30 minutes and counting until you should be off to sleep. Time to get cleaned up, and get your pajamas on.' 'Tee Minus 30 minutes and counting until you should be off to sleep. Time to get cleaned up, and get your pajamas on.'
] | random }} ] | random }}
If you go now there may be time for stories. Do not forget to brush your teeth. {% if is_state('sensor.school_tomorrow', 'on') %}
{% if is_state('sensor.weekday', 'fri') %} {{ [ 'Because you have school tomorrow. ',
Oh, and tomorrow is Saturday, so we can sleep in. 'Because uou have to get up early tomorrow for school.',
{% endif %} 'Because you want to be ready for school tomorrow.'
{% if is_state('sensor.weekday', 'sat') %} ] | random }}
Oh, and tomorrow is Sunday, so we can sleep in. {% else %}
Oh, and it appears you do not have school tomorrow so we can sleep in.
{% endif %} {% endif %}
{% endmacro %} {% endmacro %}

View File

@ -307,4 +307,13 @@
{{ states.calendar.anchorage_holidays.attributes.message }} {{ states.calendar.anchorage_holidays.attributes.message }}
{% else %} {% else %}
none none
{% endif %} {% endif %}
school_tomorrow:
friendly_name: 'School Tomorrow'
value_template: >-
{%- set test=(as_timestamp(now())+ (86400)) | timestamp_custom("%Y-%m-%d",true) %}
{% if states.calendar.skylar_school.attributes.start_time == test + " 07:35:00" %}
on
{% else %}
off
{% endif %}