More improvements for #53

This commit is contained in:
2023-02-01 18:03:28 -05:00
parent 684a0f3c92
commit 203c507a53
5 changed files with 31 additions and 29 deletions

View File

@ -235,7 +235,7 @@ script:
entity_id: input_datetime.kallen_bedtime
data_template:
time: >
{% if is_state('sensor.school_tomorrow', 'on') %}
{% if is_state('sensor.kallen_school_tomorrow', 'on') %}
21:00
{% else %}
22:00
@ -244,7 +244,7 @@ script:
entity_id: input_datetime.kallen_nightly_briefing
data_template:
time: >
{% if is_state('sensor.school_tomorrow', 'on') %}
{% if is_state('sensor.kallen_school_tomorrow', 'on') %}
20:40
{% else %}
21:40
@ -359,7 +359,7 @@ script:
entity_id: input_datetime.audible_notification_off
data_template:
time: >
{% if is_state('sensor.school_tomorrow','on') %}
{% if is_state('sensor.kallen_school_tomorrow','on') %}
22:00
{% else %}
23:00
@ -390,9 +390,9 @@ script:
data_template:
time: >
{% set low = state_attr('sensor.current_forecast','overnight_low') | float %}
{% if is_state('input_boolean.hot_day','on') and is_state('sensor.school_tomorrow','on') %}
{% if is_state('input_boolean.hot_day','on') and is_state('sensor.kallen_school_tomorrow','on') %}
20:00
{% elif is_state('input_boolean.hot_day','on') and is_state('sensor.school_tomorrow','off') %}
{% elif is_state('input_boolean.hot_day','on') and is_state('sensor.kallen_school_tomorrow','off') %}
21:00
{% elif low >= 56 and low <= 60 %}
22:30

View File

@ -94,6 +94,28 @@ sensor:
spring_break_days2go:
value_template: "{{ ((state_attr('input_datetime.spring_break_start', 'timestamp')-as_timestamp(now())) | int /60/1440) | round(0) }}"
unit_of_measurement: 'Days'
kallen_school_tomorrow:
unique_id: 0a1b81bc-2080-4006-b0f1-270af904d411
friendly_name: 'Kallen School Tomorrow'
value_template: >-
{%- set test=(as_timestamp(now())+ (86400)) | timestamp_custom("%Y-%m-%d",true) %}
{% if states.calendar.kallen_school_days.attributes.start_time == test + " 09:00:00" %}
on
{% elif states.calendar.kallen_school_days.attributes.start_time == test + " 08:00:00" %}
on
{% else %}
off
{% endif %}
kallen_band_tomorrow:
unique_id: 2906baeb-98ec-4215-8043-e223f2759ed7
friendly_name: 'Kallen Band Tomorrow'
value_template: >-
{%- set test=(as_timestamp(now())+ (86400)) | timestamp_custom("%Y-%m-%d",true) %}
{% if states.calendar.kallen_school_days.attributes.start_time == test + " 08:00:00" %}
on
{% else %}
off
{% endif %}
lunch_menu_week:
friendly_name: Lunch Menu Week
value_template: >

View File

@ -6,26 +6,6 @@
month_is:
friendly_name: 'Month is'
value_template: "{{ ['January','February','March','April','May','June','August','September','October','November','December'][now().month-1] }}"
school_tomorrow:
friendly_name: 'School Tomorrow'
value_template: >-
{%- set test=(as_timestamp(now())+ (86400)) | timestamp_custom("%Y-%m-%d",true) %}
{% if states.calendar.kallen_school_days.attributes.start_time == test + " 09:00:00" %}
on
{% elif states.calendar.kallen_school_days.attributes.start_time == test + " 08:00:00" %}
on
{% else %}
off
{% endif %}
band_tomorrow:
friendly_name: 'Band Tomorrow'
value_template: >-
{%- set test=(as_timestamp(now())+ (86400)) | timestamp_custom("%Y-%m-%d",true) %}
{% if states.calendar.kallen_school_days.attributes.start_time == test + " 08:00:00" %}
on
{% else %}
off
{% endif %}
kallen_timer_remaining_minutes:
friendly_name: 'Kallen Timer Remaining Minutes'
value_template: >-

View File

@ -11,12 +11,12 @@
'The count down clock until bedtime has started. Time to get cleaned up, get your pajamas on, and head for your bedroom.',
'Its the final countdown <break time="2s"/> until bedtime, silly. Time to get ready to head that way!'
] | random }}
{% if is_state('sensor.school_tomorrow', 'on') %}
{% if is_state('sensor.kallen_school_tomorrow', 'on') %}
{{ [ 'Because you have school tomorrow. ',
'Because you have to get up early tomorrow for school.',
'Because you want to be ready for school tomorrow.'
] | random }}
{% if is_state('sensor.band_tomorrow','on') %}
{% if is_state('sensor.kallen_band_tomorrow','on') %}
{{ [
'And you have band practice in the morning. ',
'And you have a date with a trombone first thing in the morning. ',

View File

@ -9,8 +9,8 @@
{% if is_state('input_boolean.tony_streaming_today','on') %}
"Tony will be streaming tonight. The studio is scheduled to go online at {{ (state_attr('input_datetime.tony_streaming_start_time','timestamp') | int | timestamp_custom('%I:%M %p', False)) }}. "
{% endif %}
{% if is_state('sensor.school_tomorrow','on') %}
{% if is_state('sensor.band_tomorrow','on') %}
{% if is_state('sensor.kallen_school_tomorrow','on') %}
{% if is_state('sensor.kallen_band_tomorrow','on') %}
"Collin has school tomorrow, and there will be band practice in the morning at {{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%I:%M %p") }}. "
{% else %}
"Collin has school tomorrow at {{ as_timestamp(strptime(state_attr('calendar.kallen_school_days','start_time'), '%Y-%m-%d %H:%M:%S')) | timestamp_custom("%I:%M %p") }}. "