Mastering Home Assistant Templates: Intro to Date and Time

SlackerLabs
SlackerLabs
19.3 هزار بار بازدید - پارسال - The next installment of my
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/co...

Python Time String Formatting Options: https://docs.python.org/3/library/dat...


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 - Twitter: thejeffreystone / Twitter: slackerlabs
On the Web - https://slacker-labs.com/
Discord - Discord: discord

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/Slack...
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...  

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/referra...
Video Assets - LenoFx: http://i.refs.cc/CJXU6Da9?smile_ref=e...
پارسال در تاریخ 1402/04/30 منتشر شده است.
19,300 بـار بازدید شده
... بیشتر