Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106382

Trouble with getting calendar to ignore event if not the next day

$
0
0

So i have an automation and sensors that read a subscribed ICS calendar from my works website. It updates in real time and works well. I use this to pull the start time from tomorrows first event and set my alarm for 1.5 hrs before that. This also works well… except when i dont work tomorrow. It seems to ignore the empty days between events and simply show my next event “at 8:00 AM” but its 2 days away… this still sets my alarm. So you see the problem. I need a way to have the template sensor only output the start time of my next event IF its tomorrow.


            {% set nextdayditstart = as_timestamp(strptime(state_attr('calendar.ditCal', 'start_time'), '%D'))  %}
            {% set nextdayditstart = (nextdayditstart | timestamp_custom("%D", true)) %}
            {% if nextdayditstart == ((now().date, + 86400), '%D') %}
            Tomorrow
            {% endif %}

I know this is a simple thing to check, but my brain is just missing it at the moment. I know i have to check the date of the event, and then template an IF statement that if its not tomorrow, put out a value of “day off”: maybe or just ignore it completely until the evening before the next days start event.

Any help would be appreciated,. I haven’t templated much with dates and times in a while and clearly ive forgotten what I’m doing

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106382

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>