Home Assistant Webhooks, Time pattern Automation Triggers, and some Timestamp Math

Поділитися
Вставка
  • Опубліковано 30 лип 2024
  • In this video, we are going to build a Home Assistant remote monitoring system to notify me if my brother's Home Assistant instance goes down.
    To make that happen we are going to use a web hook. So if you are interested in how to get started with web hooks this video will walk you through creating a web hook and using it to trigger a Home Assistant automation.
    We will also talk about time pattern automation triggers, triggering an automation on Home Assistant startup, and even everyone's favorite timestamp math.
    So if any of that is interesting to you, check it out.
    Chapters:
    00:00 - Home Assistant Webhooks, Time pattern Automation Triggers, and some Timestamp Math - Intro
    01:51 - What is a Home Assistant Web Hook
    04:23 - A Remote Monitoring Use Case
    06:22 - Build a Home Assistant automation with a webhook trigger
    07:39 - Formatting Home Assistant Timestamps
    08:52 - Find the difference between two timestamps in Home Assistant
    10:37 - Defining a Rest Command in Home Assistant
    11:21 - Build a Home Assistant Automation with a time pattern trigger
    Blog Post with YAML: slacker-labs.com/2021/08/28/h...
    #homeassistant #smarthome #homeautomation
    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/
    And if you like this video you could always fuel my automation habit -
    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...
    Video Gear:
    Canon m50: amzn.to/3ftldPH
    Desk Mic: amzn.to/3wkum40
    Camera Mic: amzn.to/3tXk1cp
    Newer 660: amzn.to/3fwwejd
    Dazzne D50: amzn.to/3oGBK5y
    Audio Interface: amzn.to/3u07chK
    Gimble: amzn.to/3ouKAoe
    Music - Epidemic Sound: www.epidemicsound.com/referra...
    Video Assets - LenoFx: i.refs.cc/CJXU6Da9?smile_ref=e...
  • Наука та технологія

КОМЕНТАРІ • 33

  • @RicardoMaranhaoMD
    @RicardoMaranhaoMD 2 роки тому +2

    The home assistant teacher! You rock jeff!

  • @rslbrg
    @rslbrg 2 роки тому +1

    Another awesome video. There's always so much good information in your videos. Sitting here watching you video on webhooks...while I've been thinking about trying to fix my automations that "break" if I reboot Home Assistant. You've given me some good ideas and guidance on how to fix these situations. So many tips...and so may use cases!

  • @bgable7707
    @bgable7707 2 роки тому +1

    Great Job, this has given me some ideas on a project of mine. And, I'll be reviewing your other video's to see what else I can gather from them. Thanks, very clear concise and in good order!

  • @Johnsmith-uc9df
    @Johnsmith-uc9df Рік тому

    Great tip on the /30 thank you!

  • @bgable7707
    @bgable7707 11 місяців тому

    Hmm, one year ago I watched this for the first time. Again, thanks. Great example, clear and simple. OH, I see there are other Webhooks vid's you've created. "Webhooks: The Universal Home Assistant Integration" Onward bound.

    • @SlackerLabs
      @SlackerLabs  11 місяців тому

      Yeah, those web hooks come in handy. There was an update to them earlier this year, that adds some security options, so check out the video I did a few months back.

  • @narshimagoudpalakurla9651
    @narshimagoudpalakurla9651 2 роки тому +2

    Your videos are simple and to the point. Subbed ✊🏻

    • @SlackerLabs
      @SlackerLabs  2 роки тому +1

      Thanks! The struggle to keep it simple is real. Heck. I just scraped a video on how I setup my version of JARVIS because during the edit I realized it was going to be way too complicated and impossible to follow.

    • @narshimagoudpalakurla9651
      @narshimagoudpalakurla9651 2 роки тому

      @@SlackerLabs I completely agree . Keeping it simple is very challenging. Keep up the good work

  • @ChrisValcke
    @ChrisValcke 2 роки тому +2

    webhooks are extremely simple by installing the Cloudflared solution for remote access. Also, i was able to use Tasker on Android to fire off a webhook to HA, your video is another step to not only automating but also connecting :)

    • @SlackerLabs
      @SlackerLabs  2 роки тому +1

      I need to take a look at that cloudflarered setup. I glanced at it the other day and thought it might be useful.

    • @ChrisValcke
      @ChrisValcke 2 роки тому +2

      @@SlackerLabs 5 minutes setup, create domain on cloudflare, install on HA and three lines in config.yaml. Done!

  • @jmr
    @jmr 2 роки тому +1

    Great video. I've been working on something broader to identify home automation problems in my home. I had to sit down and create a list of services and systems. You don't realize how complicated your home automation is till you've done that. 😂

    • @SlackerLabs
      @SlackerLabs  2 роки тому +1

      Yea. It’s nuts. I was working on something the other day and noticed a temp sensor that hadn’t updated in weeks. Found out it’s battery had died. So now I’m trying to figure out how to get Jarvis to give me a list of sensors that haven’t sent an updated in more than 24 hours

    • @jmr
      @jmr 2 роки тому

      @@SlackerLabs I just had the exact same issue! lol

  • @simonparkis9301
    @simonparkis9301 2 роки тому +1

    Great video on webhooks. I did this exact monitoring of another home assistant instance but took a different approach. I created a date_time sensor on the machine to be monitored, then created a rest sensor on the monitoring machine looking at the rest url of the date_time sensor. This removes the need for webhook or interval update automation. Then i used a template trigger in an automation to compare the time now to that of the rest sensor and notify if greater than 10 minutes difference.

    • @SlackerLabs
      @SlackerLabs  2 роки тому

      I like it. Definitely less complex. I will give it a try!

    • @simonparkis9301
      @simonparkis9301 2 роки тому

      @@SlackerLabs The only downside is it does update quite frequently when not strictly neccessary.

    • @simonparkis9301
      @simonparkis9301 2 роки тому

      @@SlackerLabs It also works great to automate guest mode when some of my relatives with homeassistant visit my house. I created a zone on their instance which covers my house, then i used a rest sensor to monitor their person status and turn on guestmode if at my house.

    • @SlackerLabs
      @SlackerLabs  2 роки тому

      @@simonparkis9301 Genius! I was monitoring nmap for their mac address of their device. But I like this method. More "active" than scanning for ip addys.

  • @markday3145
    @markday3145 2 роки тому +3

    If you do a more general web hooks video, it would be interesting to know if it is possible to pass data into the web hook (in the POST request), and get at that data from within the automation.

    • @SlackerLabs
      @SlackerLabs  2 роки тому +2

      I have started working on another video and will be able to show exactly that. Hoping to have a couple of use cases to talk through.

  • @tassistant7624
    @tassistant7624 2 роки тому +1

    Thank you very much for your webhook and rest.
    I wonder if it possible to use this trick to make use of asking google mini with voice and let home assistant answer in verbal. If it can be done, could you please make this guide vdo. Thank you very much in advance.

    • @SlackerLabs
      @SlackerLabs  2 роки тому

      Thanks! And yes, it is possible. Actually, I talk about it in a couple of videos and show some examples of it working, although I can't remember if I walk through it. I will work on that video. I actually was going to do one about local audio so this will fit in.

  • @jacobwolfe1299
    @jacobwolfe1299 2 роки тому

    Anyway you could make a blueprint for this? Thanks

  • @pdeswardt
    @pdeswardt 2 роки тому +1

    How do you use webhooks if the HA url in my instance is DYNDNS enabled ( DuckDNS) and SSL secured with LetsEncrypt ? If the required port is 80, how is that port forwarded because HA now listens on port 443 ? Thx

    • @SlackerLabs
      @SlackerLabs  2 роки тому

      Is the required port 80? I don't think I have run into that. I think you just have to hit the url for the instance. The https one works in my last test. But let me check. I am not running the latest version so maybe something changed.

  • @ChloexLashay
    @ChloexLashay Рік тому +1

    Could this work with integrating web apps for habit tracking like Done or Way of Life into Home Assistant?

    • @SlackerLabs
      @SlackerLabs  Рік тому +1

      Yes, although I suspect the best way would be using the shortcuts app. At least if those apps allow you to get to the data you via the short cuts app. I couldn't tell if those apps had a web app or a way to configure a webhook to publish data from those apps to another app, so your chance of integrating my be limited to how much those apps let you have in shortcuts.
      If those apps integrate with IFTTT you could perhaps use that as well to make the connect to a Home Assistant Webhook.

  • @marcomanferdini
    @marcomanferdini 2 роки тому +1

    No, you talk without thinking someone has not set up some features...

    • @SlackerLabs
      @SlackerLabs  2 роки тому

      Which features are you referring? I want to make sure I make things clearer as I make more videos.

  • @cyberstorm135
    @cyberstorm135 Рік тому

    What's the best way to debug webhook ? I successfully call this : GET [homeassistant]/api/config but this POST [homeassistant]/api/webhook/button1 doesn't work, result is an 404 error ? I found him in my automation file.
    - id: '1670691760272'
    alias: automation
    description: ''
    trigger:
    - platform: webhook
    webhook_id: button1

    • @SlackerLabs
      @SlackerLabs  Рік тому

      I find the best way is using a command tool like curl. From there you could do something like:
      curl -X POST -H 'Content-Type: application/json' -d '{"content":"test"}' [homeassistant]/api/webhook/button1
      and see if that works. 404 error, means it can get to that though to that server. That the get can makes me think some kind of filter on http methods. Like get is allowed but post is not.