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
{% 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
alias: set good morning time
trigger:
@ -607,7 +623,7 @@
state: 'off'
- above: '73'
condition: numeric_state
entity_id: sensor.upstairs_temperature
entity_id: sensor.living_room_temperature
action:
- data:
entity_id: switch.living_room_fan
@ -705,5 +721,48 @@
- service: script.kitchen_lights_night
- service: script.dog_mode_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

@ -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>.',
'Tee Minus 30 minutes and counting until you should be off to sleep. Time to get cleaned up, and get your pajamas on.'
] | random }}
If you go now there may be time for stories. Do not forget to brush your teeth.
{% if is_state('sensor.weekday', 'fri') %}
Oh, and tomorrow is Saturday, so we can sleep in.
{% endif %}
{% if is_state('sensor.weekday', 'sat') %}
Oh, and tomorrow is Sunday, so we can sleep in.
{% if is_state('sensor.school_tomorrow', 'on') %}
{{ [ 'Because you have school tomorrow. ',
'Because uou have to get up early tomorrow for school.',
'Because you want to be ready for school tomorrow.'
] | random }}
{% else %}
Oh, and it appears you do not have school tomorrow so we can sleep in.
{% endif %}
{% endmacro %}

View File

@ -308,3 +308,12 @@
{% else %}
none
{% 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 %}