Vigyata.AI
Is this your channel?

Mastering Home Assistant Templates: Intro to Date and Time

29.3K views· 646 likes· 36:16· Jul 21, 2023

🛍️ Products Mentioned (18)

The next installment of my Mastering Home Assistant Templates Series. This video is all about time and date. We will be covering: - How to get the current time and use it in your templates. - Saving time for use later in templates - How to do timestamp Math - the difference between the last_changed and the last_updated timestamps - When to use as_datetime and as_timestamp - And how to compare two points in time - So we know how many days until a date - If a date was in the past - if a date is in the future - Did it happen in the last 24 hours - Or is it happening today Lots to cover, so this one is long. So use the chapters below to jump around: Video Chapters: 00:00 - Introduction to Time and Date Templates in Home Assistant - Intro 01:18 - What to Expect in this video 02:31 - Quick Jinja Recap 04:40 - Using Now() to get the current time 06:20 - Create a TTS Greeting using Now() 08:16 - Saving the current time of events to use later in templates 13:29 - Using Replace() to get a specific point in time based on current time 16:46 - Home Assistant's time and Date Integration provides some helpful entities 19:25 - Using an entity's last changed and last updated timestamp in your templates 21:17 - Intro to Timestamp Math in your Templates 22:51 - The difference between as_datetime and as_timestamp and when to use them 25:49 - Using as_timestamp to get the number of days until a date in the future 28:27 - A Template to check if a timestamp happened in the past 29:57 - A Template to check if an Automation fired in last 24 hours 31:16 - Using relative_time() to get how much time has past since a point in time 32:00 - Check to see if a calendar event is happening today Resources: Home Assistant Docs on Time/Date Templating: https://www.home-assistant.io/docs/configuration/templating/#time Python Time String Formatting Options: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes Who am I? My Name is Jeff. I am an DIY-er and Automator of boring things. And, of course, a huge Home Assistant fan. Oh, I also live in a house that tweets. Follow Me: Github - https://github.com/thejeffreystone Twitter - https://twitter.com/thejeffreystone / https://twitter.com/slackerlabs On the Web - https://slacker-labs.com/ Discord - https://discord.gg/YkMKGHnahh And if you like this video you could always fuel my automation habit - Grab SlackerLabs Merch: https://slackerlabsmerch.square.site One Time Donation: Paypal: https://www.paypal.com/paypalme/SlackerLabs Cash App: $slackerlabs Buy me a coffee: https://www.buymeacoffee.com/icE6DeBut . Or use my Amazon affiliate link which provides a small commission on things you buy without additional cost to you - https://www.amazon.com/s/ref=as_li_ss_tl?k=Home+Automation&ref=nb_sb_noss_2&linkCode=ll2&tag=thejeffreysto-20&linkId=18622d75c4923c69c2b7488cec58ad5e&language=en_US Video Gear: Canon m50: https://amzn.to/3ftldPH Desk Mic: https://amzn.to/3wkum40 Camera Mic: https://amzn.to/3tXk1cp Newer 660: https://amzn.to/3fwwejd Dazzne D50: https://amzn.to/3oGBK5y Audio Interface: https://amzn.to/3u07chK Gimble: https://amzn.to/3ouKAoe Music - Epidemic Sound: https://www.epidemicsound.com/referral/o05z6m/ Video Assets - LenoFx: http://i.refs.cc/CJXU6Da9?smile_ref=eyJzbWlsZV9zb3VyY2UiOiJzbWlsZV91aSIsInNtaWxlX21lZGl1bSI6IiIsInNtaWxlX2NhbXBhaWduIjoicmVmZXJyYWxfcHJvZ3JhbSIsInNtaWxlX2N1c3RvbWVyX2lkIjo3NzE2MjM1MTd9

🎬 More from SlackerLabs