Master Home Assistant Templates: State Based Entities

Ғылым және технология

Master Home Assistant Temaplte and build your very own Home Assistant entities using state based templates. This video is long, but full of working examples from my own Home Assistant based smart home.
Links to things mentioned in the video:
YAML Shown in this video: github.com/thejeffreystone/Sl...
HA Template Docs: www.home-assistant.io/integra...
Sensor Device classes: www.home-assistant.io/integra...
Binary Sensor Device Classes: www.home-assistant.io/integra...
Third Reality Smart Button: amzn.to/3PYfHbe
Chapters:
00:00 - Intro
01:13 - The New, Old Way of Building Template Entities
06:30 - What is a State Based Template Entity?
07:19 - Real Examples of State Based Templates in Home Assistant
08:10 - Example - We Have a Problem Sensor
11:18 - Example - Button Monitor Entity
15:28 - Example - Is tomorrow a school day?
18:39 - Example - Using a Media Player as a Occupancy Sensor
21:26 - Example - Dynamic Occupancy Sensors
27:59 - Example - Countdown Sensor to a Date
32:28 - Example - Find Batteries that need Changing
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 - github.com/thejeffreystone
Twitter - / thejeffreystone / / slackerlabs
On the Web - slacker-labs.com/
Discord - / discord
And if you like this video you could always fuel my automation habit -
Grab SlackerLabs Merch: slackerlabsmerch.square.site
Use my Amazon Affiliate Links:
My Favorite Smart Home Tech: amzn.to/3QKFp3W
Gear I use my Smart Home: amzn.to/3R0kQ3F
Getting Started with Home Assistant: amzn.to/3PXayjw
Home Assistant Yellow Essential Gear: amzn.to/3LK4fgN
One Time Donation:
Paypal: www.paypal.com/paypalme/Slack...
Cash App: $slackerlabs
Buy me a coffee: www.buymeacoffee.com/icE6DeBut
Or use my Amazon affiliate link which provides a small commission on things you buy without additional cost to you - www.amazon.com/s/ref=as_li_ss...
Other Affiliate Links:
Music - Epidemic Sound: www.epidemicsound.com/referra...
Video Assets - LenoFx: i.refs.cc/CJXU6Da9?smile_ref=e...

Пікірлер: 46

  • @clairerovic
    @clairerovic9 ай бұрын

    I am so loving this range of videos. Casual HA user for five odd years. Have heaps of products & ideas though still stumble my way through many Automations 😅😂

  • @jaap7374
    @jaap73743 ай бұрын

    I noticed there is a link to a video in the home assistant documentation, but honestly, this video is (in my humble opinion) better for more people. You should add links to specific sections of the video to the corresponding section of the documentation.

  • @NunoSoares22
    @NunoSoares2210 ай бұрын

    Excellent. It’s about time someone does it good and clear. Great work Jeff!

  • @jickmagger7323
    @jickmagger73236 ай бұрын

    Great job! Thank you for sharing your knowledge!

  • @dariusvaitkus965
    @dariusvaitkus96510 ай бұрын

    Amazing! Best video about templating. Thank you very much !

  • @mysticsilent
    @mysticsilent10 ай бұрын

    Very nice explaination of all the template sensor uses. I was getting myself into this more and more but now I have many usecases to improve my smarthome. Thanks!

  • @johnnynobels
    @johnnynobels10 ай бұрын

    Great video. As a beginner the new and legacy yaml format is confusing. Your video is a great help. Would like more explanation on state classes, domains, etc. with reference to official ha documentation

  • @niklasb2007
    @niklasb200710 ай бұрын

    Great!!

  • @SlackerLabs

    @SlackerLabs

    10 ай бұрын

    Thank you!

  • @TDHobbies
    @TDHobbies5 ай бұрын

    I have been trying to get my Apple TV to show what is being watched and I found you while on my quest for a solution.

  • @uSlackr
    @uSlackr8 ай бұрын

    This in great. Love the deep dive. I recently created my own template filter to handle a complicated calculation. I wonder if you could to that to make a date math function

  • @patrikfranzen4459
    @patrikfranzen445910 ай бұрын

    Tack!

  • @SlackerLabs

    @SlackerLabs

    10 ай бұрын

    Thanks!

  • @jaap7374
    @jaap73746 ай бұрын

    Can you update your templating playlist? You probably have the best templating instructions on KZread. A lot of information is covered and the playlist helps in finding the specific thing I'm looking for.

  • @SlackerLabs

    @SlackerLabs

    6 ай бұрын

    Done. I need to get the next one done. But I have some other videos I will probably get out before that one.

  • @francoisgrandcollot1027
    @francoisgrandcollot102711 күн бұрын

    Hello, many thx for your youtube video. May I have some help ? I don't know how to establish a calculation made from 2 entities ie: entitie apparent power that divides entitie inverter voltage so as to know the current and declare it as a new entitie. Do you have a simple example? Sincerely

  • @Tfmt100
    @Tfmt1003 ай бұрын

    Hi! Nice content, thx! I'm struggling to find content about tasmota mqtt entitys without standard device class on HA (like MPU 6886 accelerometers/Gyros) and so, those entitys cant be shown on statistics with graphics. Could you give me some hint about how to solve it?

  • @vetsus3518
    @vetsus351810 ай бұрын

    i think i love your videos more that you're explaining random (not random per the video) data for jinja... i searched forums forever trying to find 'next day' or even more for quite some time.. and the best i could come up with was essentially adding 86400 times the number of days to find that and in this video.... a string much shorter finds the same value.... do you have a discord? cuz i'm sure much of what i need could be solved with simply asking you and you'd know it. lol

  • @EsotericArctos
    @EsotericArctos10 ай бұрын

    Where do templates save if you don't create a manual entry in Config.YAML?

  • @marcelofranco4284
    @marcelofranco428410 ай бұрын

    Thanks a lot for your template videos!!! Question: Which mmWave sensors are you using? Do you like them or, in other words, would you buy the same sensors again? Best regards!

  • @SlackerLabs

    @SlackerLabs

    10 ай бұрын

    Right now I have a mix. I'm using the everything presence sensors ( I have 3 now), the FP2 and the Roomsense IQ. I would buy the EP1 or the roomsense iq. Not sure I would buy the FP2. I like mmWave. All three have been reliable presence sensors. But the FP2 doesn't is lacking in the HA integration side.

  • @hugh_martin
    @hugh_martinАй бұрын

    New subscriber (and new HA user) here. Thanks to your template series, I’m steadily progressing in my template creation (and lots of re-writing). I’m wondering if you’ve installed any jinja extensions into vscode to make writing your templates easier/faster. If so, do you then just paste the code into the Template tab in the Developer tools? Or are there better ways to integrate jinja development via vscode? Thanks for all the great tips!

  • @SlackerLabs

    @SlackerLabs

    Ай бұрын

    I only use the HA extension in VS Code which just helps with syntax or auto complete. I'm actually not sure there are any good extensions. I should check. HA is getting some more template tools so that will make it easier to do these from the UI. And I totally need to get that vidoe on trigger based templates done.

  • @MyHeap
    @MyHeap8 ай бұрын

    I have an unrelated, related question. When you said you have sensors in your freezers to notify you. What sensors are you using? How are they connecting (wifi, BT, Zigbee, zwave, etc). I would like to monitor my own freezers this way. Joe

  • @SlackerLabs

    @SlackerLabs

    8 ай бұрын

    Mine are Rf. Using 433mhz based sensors. I have a little sdr usb stick and talks to an HA addon to bring that data in. I have not tested if a zigbee sensor would work. I suspect the lining in the freezer might cause some Interference with some of the frequencies out there

  • @MyHeap

    @MyHeap

    8 ай бұрын

    @@SlackerLabs thank you for the information. I appreciate it. For giggles I put an aqara temp sensor in my refrigerator to see if it would work. The short answer is no, it drops off the zigbee network. I suppose the radio is interfered with by the metal housing of the refrigerator. I am guessing it is likely shunting the signal to ground perhaps since the chasis and skin of the refrigerator is tied to ground. Thank you again. I am still kinda new with HA and you videos help. Joe

  • @Saturn2888
    @Saturn28882 ай бұрын

    Do you have a good video or spot in a video where you show how to automate light scenes? You talked about having lights turn on a certain way and then making 50 scenes then replacing those with a template. I have over 100 smart lights in every room of my house, and the way I've done it is to set a scene for the light color and brightness (normal, bright, late night). I'd like to automate the creation of those scenes. I thought I could setup a Number based on the weather (good for 3500K vs 5000K) and when turning on lights in a room, it references that number and sets brightness to 100%. Then for Late Night, I need to rethink it because it's custom per room with only some lights turned on and different colors. It's not for when I'm in the room either, just for when I need light but don't wanna wake myself up. Does that sound like the right way of going about it?

  • @daveforrester61
    @daveforrester6110 ай бұрын

    Great video walkthrough and explanations, but could you not write a script that changes the area of all the battery entities with a numeric value to "Critical Battery". I have 200 battery entities 😂

  • @SlackerLabs

    @SlackerLabs

    10 ай бұрын

    Actually I bet we could. That's probably not a bad idea. I was just thinking it would easy to set the area when a new device was added. But now you got me thinking that's totally boring. We need to automate that!

  • @martindebes7070
    @martindebes70704 ай бұрын

    The button monitor entity lacks a 'platform' statement. Or do i miss something?

  • @MrMosvold
    @MrMosvold10 ай бұрын

    Thanks for the video. Question. you have two call service to scripts; "script.cleanup_text" and "script.text_notify" in your example file scripts.yaml. But how does those script look like (or did I miss something)?

  • @SlackerLabs

    @SlackerLabs

    10 ай бұрын

    The clean up one I talked about in the recent response variable video. The text notify one was talked about much longer ago than that. I need to do a better job of documenting my config.

  • @donireland6218
    @donireland621810 ай бұрын

    Nice! I found the examples of counting down the number of days until a specific date to be useful. How would you apply this to something where the date varies from year to year? Like Thanksgiving (the last Thursday in November), General election day (1st Tuesday after the 1st Monday in November) or Easter (I'm not even sure what kind of rule THAT would follow).

  • @traskth

    @traskth

    5 ай бұрын

    Easter is the first sunday following the first full moon after the spring equinox

  • @donireland6218

    @donireland6218

    5 ай бұрын

    @@traskth that knowledge doesn't help with the question asked -- unless you have a way to figure out when the first full moon is.

  • @traskth

    @traskth

    5 ай бұрын

    @@donireland6218 it was asked what the rule was for easter, i was just stating what the rule was. I dont know how to apply countdown to a moving holiday, but im not great when it comes to jinja or HA templating

  • @donireland6218

    @donireland6218

    5 ай бұрын

    @@traskth I was asking about the moving holiday. I only offered Easter as an example.

  • @eugsmiley
    @eugsmiley10 ай бұрын

    1:40 OMG! My confusion has a reason!?! [Shakes fist at the incomplete HA documentation]

  • @chrise666
    @chrise66610 ай бұрын

    Thought I was following. I have this in template.yaml and what else do I need to do to create the binary sensor 'hose_on'? - binary_sensor: - name: hose_on delay_off: minutes: 20 state: > {{is_state('sensor.orbit_b_hyve_state','manual')}}

  • @SlackerLabs

    @SlackerLabs

    10 ай бұрын

    That's looks right to me. Just make sure your indention is all lined up. And that you have three template: line in the configuration.yaml and your restarted HA after adding that configuration.yaml part

  • @chrise666

    @chrise666

    10 ай бұрын

    Thanks @@SlackerLabs I just have this in configuration.yaml -> template: !include template.yaml

  • @rasbe6863
    @rasbe686310 ай бұрын

    The real question I have for you Jeff is why did you not make a days until Rex Manning day?

  • @SlackerLabs

    @SlackerLabs

    10 ай бұрын

    And that is a really good question. To which I will now go question all my life’s choices up until now. And make that sensor

  • @rasbe6863

    @rasbe6863

    10 ай бұрын

    @@SlackerLabs see only someone who has been following you and watching you for many years can understand the importance of Rex Manning day

  • @torfinnsrnes6232
    @torfinnsrnes623210 ай бұрын

    In my opinion the term template is quite misleading. A better term would have been dynamic processing.

Келесі