I have a simple automation that is using a calendar event to trigger a notification. While I could hard-code the event start time, ideally, I’d really like to have the notification dynamically tell me the start time using ‘trigger.calendar_event.start’ (both so I can copy/paste this automation for other uses and also just because I’d like to learn how), however I can’t figure out how to do this. I’ve spent a fair amount of time searching and trying variations I’ve found, but nothing seems to work. Specifically this:
gets me exactly what I want when using a calendar entity (i.e. it returns 9:00 AM), but I haven’t figured out how to reformat it to work with ‘trigger.calendar_event.start’. I BELIEVE it’s because it doesn’t seem to output a normal timestamp, but rather for instance: “2023-08-16T15:50:00-05:00”. Obviously it’s extra-difficult to iterate on variations for testing since I have to setup test calendar events to get it to trigger since I can’t just use Developer Tools.
Weird, I tried it a couple times formatted slightly differently and it finally lasted through a save/reload of the automation (but it added the quotation marks). Been doing it in YAML the entire time. I’m sure I was just making a silly copy/paste error that I couldn’t see. Ended up with this:
And it worked! Thanks a ton, definitely couldn’t have figured it out otherwise! I changed the final time format to meet my needs: strftime(’%-I:%M %p’).
Yeah, I actually started off with the multi-line approach but it didn’t like it for some reason. Probably did the indents wrong, but regardless, ultimate success. Thanks!