Master Home Assistant Templates: State Based Entities

Sdílet
Vložit
  • čas přidán 26. 06. 2024
  • 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...
  • Věda a technologie

Komentáře • 44

  • @jaap7374
    @jaap7374 Před měsícem +2

    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.

  • @clairerovic
    @clairerovic Před 8 měsíci +2

    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 😅😂

  • @NunoSoares22
    @NunoSoares22 Před 9 měsíci +5

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

  • @jickmagger7323
    @jickmagger7323 Před 5 měsíci

    Great job! Thank you for sharing your knowledge!

  • @dariusvaitkus965
    @dariusvaitkus965 Před 8 měsíci

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

  • @mysticsilent
    @mysticsilent Před 9 měsíci

    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!

  • @niklasb2007
    @niklasb2007 Před 9 měsíci +1

    Great!!

  • @johnnynobels
    @johnnynobels Před 9 měsíci +1

    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

  • @TDHobbies
    @TDHobbies Před 4 měsíci

    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.

  • @patrikfranzen4459
    @patrikfranzen4459 Před 8 měsíci

    Tack!

  • @uSlackr
    @uSlackr Před 7 měsíci

    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

  • @jaap7374
    @jaap7374 Před 5 měsíci

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

    • @SlackerLabs
      @SlackerLabs  Před 5 měsíci

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

  • @hugh_martin
    @hugh_martin Před 7 dny

    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!

  • @vetsus3518
    @vetsus3518 Před 8 měsíci

    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

  • @Tfmt100
    @Tfmt100 Před 2 měsíci

    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?

  • @marcelofranco4284
    @marcelofranco4284 Před 8 měsíci +1

    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  Před 8 měsíci +1

      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.

  • @eugsmiley
    @eugsmiley Před 9 měsíci

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

  • @EsotericArctos
    @EsotericArctos Před 9 měsíci +1

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

  • @MyHeap
    @MyHeap Před 6 měsíci +1

    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  Před 6 měsíci +1

      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 Před 6 měsíci

      @@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

  • @daveforrester61
    @daveforrester61 Před 9 měsíci +1

    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  Před 8 měsíci +1

      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!

  • @Saturn2888
    @Saturn2888 Před 20 dny

    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?

  • @martindebes7070
    @martindebes7070 Před 2 měsíci

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

  • @MrMosvold
    @MrMosvold Před 8 měsíci

    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  Před 8 měsíci

      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
    @donireland6218 Před 8 měsíci

    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 Před 4 měsíci

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

    • @donireland6218
      @donireland6218 Před 4 měsíci

      @@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 Před 4 měsíci +1

      @@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 Před 4 měsíci

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

  • @chrise666
    @chrise666 Před 8 měsíci

    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  Před 8 měsíci +1

      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 Před 8 měsíci

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

  • @rasbe6863
    @rasbe6863 Před 9 měsíci

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

    • @SlackerLabs
      @SlackerLabs  Před 9 měsíci +1

      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 Před 9 měsíci +2

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

  • @torfinnsrnes6232
    @torfinnsrnes6232 Před 8 měsíci +1

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