diff --git a/config/packages/events.yaml b/config/packages/events.yaml index c708914..7383cb2 100755 --- a/config/packages/events.yaml +++ b/config/packages/events.yaml @@ -99,7 +99,12 @@ sensor: value_template: "{{ ((state_attr('input_datetime.school_last_day', 'timestamp')-as_timestamp(now())) | int /60/1440) | round(0) }}" unit_of_measurement: 'Days' vacation_days2go: - value_template: "{{ ((as_timestamp(strptime(state_attr('calendar.vacation', 'start_time'), '%Y-%m-%d'))-as_timestamp(now())) | int /60/1440) | round(0) }}" + value_template: > + {% if state_attr('calendar.vacation', 'start_time') %} + {{ ((as_timestamp(strptime(state_attr('calendar.vacation', 'start_time'), '%Y-%m-%d'))-as_timestamp(now())) | int /60/1440) | round(0) }} + {% else %} + 999 + {% endif %} unit_of_measurement: 'Days' - platform: rest resource: https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/packages/json_data/school.json