Supervise your Home Server with a Watchdog and Heartbeats (Raspberry Pi, ESP8266, Docker)



Home automation systems must run all the time. Today we will make sure you get an alarm on your Smartphone if something goes wrong with your system. But how can we create an alarm if the server is down? Let’s have a closer look.
I am a proud Patreon of @GreatScott!, @ElectroBOOM , @Electronoobs , @EEVblog , and others. No Microsoft Teams, Zoom

Links:
Raspberry Pi4 US: https://amzn.to/3pP32HZ
Raspberry Pi4 DE: https://amzn.to/3avMgaG
Raspberry Pi4: https://ebay.to/3n1sPef
ESP-01s Boards: https://s.click.aliexpress.com/e/_9iUH4Z or https://amzn.to/2SDaYAx or https://ebay.to/3wG6I1K
ESP-01 Programmer: https://s.click.aliexpress.com/e/_AsjoBx or https://ebay.to/2S0TcY3
ESP-01 Programmer: https://s.click.aliexpress.com/e/_9w9QoH or https://amzn.to/3i7BUTQ
Solid Polymer Capacitors 1000uF : https://s.click.aliexpress.com/e/_A2Ii9X
Power supplies (110-240V – 3.3V) : https://s.click.aliexpress.com/e/_A6pG3T
Prototype Boards : https://s.click.aliexpress.com/e/_AtVdgv

Sketch and Flow: https://github.com/SensorsIot/Heartbeat8266
Telegram Library: https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot
PubSub Library: https://github.com/knolleary/pubsubclient

The links above usually are affiliate links that support the channel (no additional cost for you).
Supporting Material and Blog Page: http://www.sensorsiot.org
Github: https://www.github.com/sensorsiot
My Patreon Page: https://www.patreon.com/AndreasSpiess
Discord: https://discord.gg/JfgDSa8
If you want to support the channel, please use the links below to start your shopping. No additional charges for you, but I get a commission of your purchases to buy new stuff for the channel
My Amazon.com shop: https://www.amazon.com/shop/andreasspiess
For Banggood https://bit.ly/2jAQEf4
For AliExpress: http://bit.ly/2B0yTLL
For Amazon.de: http://amzn.to/2r0ZCYI
For Amazon UK: http://amzn.to/2mxBaJf
For ebay.com: http://ebay.to/2DuYXBp

https://www.facebook.com/profile.php?id=100013947273409
https://twitter.com/spiessa
https://www.instructables.com/member/Andreas%20Spiess/
Please do not try to email me. This communication channel is reserved for my primary job
As an Amazon Associate, I earn from qualifying purchases
#no#midroll#ads

source

78 thoughts on “Supervise your Home Server with a Watchdog and Heartbeats (Raspberry Pi, ESP8266, Docker)

  • June 6, 2021 at 8:49 am
    Permalink

    Hello Herr Spiess,
    One piece that has been missing from my IoT system is the ability to remotely monitor without paying for some service. I understand I could port-forward on my router but I think that creates a security risk on my home network. Would appreciate your input. Thanks for the video.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Hi Andreas,
    feedback from (another) old-timer
    Great description on the watchdog principle. In the early days of CPU, I used to implement those in hardware, based on a timer/counter that got reset as long as everything is fine. If it missed a heartbeat, then the hardware did reset/reboot the whole thing.
    Have you looked at the app IFTTT? That (internet) service can generate alarms if it does not get a signal within a certain time.
    BTW… there is also a Telegram bot called Watchdog. It looks like it can do everything… except what we want it to do. Would it not be cool if Telegram could generate an alert if it didn't get a heartbeat from our RPI?
    Thank you for your weekly high quality video. It brightens up my Sundays !
    Every time
    chrisV

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Andreas thank you for another very informative video although a little short.

    I have the usual Raspberry Pi Server running NodeRed and other programs supporting a selection of 24 ESP 01/8266/32 MC's dotted throughout my home. All ESP's have an MQTT heartbeat which will get a Software Reset if the heartbeat fails for more than 2 minutes then if this fails to reset the device I use a Sonoff Basic to RESET all power for that device and its peripherals via an MQTT Last Will. The Raspberry Pi has its power supported by a bank of batteries. All of this works very well and essentially looks after itself but I have just designed a 555 based external watchdog module that will hopefully replace most of the above. I do not use WiFi on the Pi Server so have never had your problem, I do however have another Pi acting as a WiFi Access Point and is faultless

    Much of what I have achieved has been as a result of your and other makers videos for which I thank you.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Too bad of the fake capacitors. In general, I really hate fake components… A while ago, a large amount of fake 2N3055 was discovered. One of my favourite transistors. Contraband is spread out all over the electronic components spectrum. A real pain in the….

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    My Home assistant pings my webserver every 5 mins.. If it misses a heartbeat my webserver sends me an email. Simple and elegant. The heart beat also has a small log of things..

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    I​ would​ like​ to​ follow your​ method, and​ build​ one​ myself.​ Thank​ you​ very​ much.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Please do yourself a favor and implement some function like "timePassedSince" or "timeDiff". (see your code at 9:50)

    inline int32_t timeDiff(const unsigned long prev, const unsigned long next) {

    return ((int32_t) (next – prev));

    }

    inline long timePassedSince(unsigned long timestamp) {
    return timeDiff(timestamp, millis());

    }

    This will save you a lot of headaches when the stuff stops working after 49.7 days.

    You now use 2 different ways to compute whether some interval has passed and it does take me a while to figure out whether or not they are correct.
    In my optinion, such simple code that cannot be "read" in seconds is very likely incorrect, or at least raises doubts about the correctness.
    By using those 2 simple one-liners you can take away a lot of doubt.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Even Andreas, I am playing with a ESP32-WRoom-32 but it doesn't show up on Win10. It's usb doesn't show up tried the CP210xVCP driver. It is a deve board from China 38 pins mate. Nice vlog time to watch you mate. My front gate needs a watchdog.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    I get my mains/internet connection watchdog from Flightradar24 feeder outage notification e-mails. It takes a bit more than an hour to trigger, but it's quite foolproof and probably very redundant on their side.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    I implemented watchdog as folloving: the node red pings the nodes (asks for their ip via mqtt) if two responses from one node is missing it send a message with telegram. If connection is restored a new message is sendt.

    If node red receives no messages it is set up to execute a reboot.

    This has worked flawless. Without any extra components.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Healthchecks.io is a simple to use, open source monitoring/watchdog system. I use it for nothing more than monitoring backup scripts but it has a lot of flexibility. I also like the philosophy of the developer – I'm confident if he ever had a youtube channel he would have no midroll ads.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Thanks for this vid about such an important topic!
    I am using Homematic for ca, 10years and ioBroker as an integration platform since its beginnings. Both can send emails ad/or messages via a messanger. So, I implemented a bidirectional watchdog monitoring system. Both systems monitor each other.
    I also monitor many of my ESP sensors.
    And I implemented power grid monitoring. As a backup power source, in my first units I used supercaps but switched to energizer Li primary cell batteries. They claim 20 years shelf life which the supercaps do not do.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Thats perfect timing, because i just wanted to put together a server.
    My Raspberry Pi recently died soo… I bought a Mini ITX board from Ricardo
    I hope you had great holidays too!

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    I have had heartbeats and watchdogs on my mind lately with my soon to start HA project after my lab move to the new property. This video is saved to watch again when I get started. Thanks!

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Once again an excellent, very informative video. The topics of reliability, availability and safety are rarely addressed elsewhere.

    Reply
  • June 6, 2021 at 8:49 am
    Permalink

    Yes, monitoring becomes more and more important. In servercenters we are doing it for years, without thinking about it. All the important stuff is monitored, heartbeated, watchdogd and redundant at several levels. It is a set rule. However, at hobby we do not value availability. Even commercial smart home devices do not care about it, it seems. Glad your wife did "force" you do think about it. I was creating a ESP32 to act as a forwarder for BLE beacon sensor data to Home Assistant. However, sometimes the ESP32 dies due the heavy BLE scanning and Wifi use. So I added a ATTiny45, created a serial connection between both microcontrollers, let them play "ping pong". If there is no pong from the ESP32, the ATTiny switches a relay, which cuts the power to both microcontrollers. If there is no ping from the ATTiny, the same action happens triggered by the ESP. Works as expected, and turns the BLE to Wifi forwarder into an almost maintenance free device.

    Reply
  • July 6, 2021 at 12:33 am
    Permalink

    There are some interesting points in that clause but I dont know if I see all of them eye to centre . There is some validness but I will take hold legal opinion until I look into it further. Good clause, thanks and we want more! Added to FeedBurner besides.

    Reply
  • July 15, 2021 at 10:25 am
    Permalink

    Hі there juѕt wanted to give you a quіck hеads սp. The tеxt in your content seem to be running off the screen iin Safaгi. I’m nott sure if thbis is a format іssue or something to do with ihternet browser comlatibility but I thought I’d post tο let you know. Thee dеsign and style look great t

    Reply
  • July 18, 2021 at 5:27 am
    Permalink

    Thank you for the post on your blog. Do you provide an RSS feed?

    Reply
  • August 27, 2021 at 9:47 am
    Permalink

    A review of Jamorama would be incomplete with out taking into account the personality behind it. A really good a great number products are around produced by egg heads with out soul or experience. Ben Edwards gained a Bachelor of Training ahead of becoming a member of the DegreesK band. His passion has been for teaching, especially guitar. The foregoing was his inspiration for creating Jamorama; The so called Final Lead Guitar and Soloing kit, and now Jamorama Lead Guitar. We have decided to observe up this design (Ben Edwards creation) using an sincere examine of Jamorama.

    Reply
  • August 29, 2021 at 3:18 pm
    Permalink

    Mistakes are a part of being human. Appreciate your mistakes for what they are: precious life lessons that can only be learned the hard way. Unless its a fatal mistake, which, at least, others can learn from.

    Reply
  • August 31, 2021 at 7:35 am
    Permalink

    Wow, this was very interesting to read. Have you ever considered submitting articles to magazines?

    Reply
  • August 31, 2021 at 8:46 pm
    Permalink

    Oh my goodness! Its like you understand my mind! You seem to know a lot about this, just like you wrote the book in it or something. I think that you can do with some pictures to drive the content home a bit, besides that, this is outstanding blog. A wonderful read. I will definitely return again. Have you considered promoting your blog? add it to SEO Directory right now 🙂

    Reply
  • September 1, 2021 at 2:22 pm
    Permalink

    I simply want to mention I am very new to blogging and site-building and really liked this web blog. Very likely I’m likely to bookmark your blog . You actually come with good writings. Appreciate it for sharing with us your blog site.

    Reply
  • September 5, 2021 at 5:00 pm
    Permalink

    useful I am sure there will be hundreds of people that appreciate this information. This is my very first comment, I think I like this!. perseverance to keep up Have you considered promoting your blog? add it to SEO Directory right now 🙂 http://www.links.m106.com

    Reply
  • September 7, 2021 at 1:28 am
    Permalink

    Ive been meaning to read this and just never got a chance. Its an issue that Im very interested in, I just started reading and Im glad I did. Youre a excellent blogger, 1 of the very best that Ive seen. This weblog unquestionably has some facts on topic that I just wasnt aware of. Thanks for bringing this things to light.

    Reply
  • September 13, 2021 at 3:39 pm
    Permalink

    This is a good subject to talk about. Usually when I find stuff like this I stumble it. This article probably wont do well with that crowd. Ill look around and find another article that may work.

    Reply
  • September 24, 2021 at 7:15 am
    Permalink

    Fantastic job here. I actually enjoyed what you had to say. Keep going because you unquestionably bring a new voice to this subject. Not many people would say what youve said and still make it interesting. Well, at least Im interested. Cant wait to see much more of this from you.

    Reply
  • September 27, 2021 at 12:59 pm
    Permalink

    I found your blog using Bing and I must say this is one of the most informative blogs I have read in a while. I will make sure I come back to read your future posts.

    Reply
  • October 5, 2021 at 7:07 pm
    Permalink

    Hi there, just became alert to your blog through Google, and found that its really informative. I’m gonna watch out for brussels. I will appreciate if you continue this in future. Numerous people will be benefited from your writing. Cheers!

    Reply
  • October 7, 2021 at 3:29 pm
    Permalink

    Depending on yourself to make the decisions can really be upsetting and frustrating. It takes years to build confidence. Its not the sort of thing that simply just happens.

    Reply
  • October 8, 2021 at 9:08 pm
    Permalink

    Hey, youve got a very nice post there. I have to agree with what you say I will bookmark this page and check for more updates. You can check out my page as well its Football betting Your one stop source for all the best football betting tips, football predictions, guides & analysis in winning Soccer betting youll ever find.

    Reply
  • October 9, 2021 at 1:36 am
    Permalink

    Another issue is that video games are typically serious naturally with the major focus on mastering rather than entertainment. Although, it comes with an entertainment facet to keep children engaged, every single game is often designed to focus on a specific experience or curriculum, such as mathmatical or scientific disciplines. Thanks for your post.

    Reply
  • October 9, 2021 at 12:42 pm
    Permalink

    The subsequent time I read a weblog, I hope that it doesnt disappoint me as a lot as this one. I imply, I do know it was my choice to read, but I actually thought youd have something attention-grabbing to say. All I hear is a bunch of whining about one thing that you would fix should you werent too busy in search of attention.

    Reply
  • October 9, 2021 at 10:19 pm
    Permalink

    This website has more than enough good information on it, I check on it every few hours. I wish other sites spent as much time as this one does making information to the point to readers like myself. I recommend this site to all of my facebook friends. This website will make some massive passive profit Im sure.

    Reply
  • October 10, 2021 at 12:41 pm
    Permalink

    I cherished up to you’ll obtain performed proper here. The caricature is tasteful, your authored material stylish. nonetheless, you command get bought an shakiness over that you wish be delivering the following. ill indubitably come more in the past again as exactly the same nearly a lot regularly inside case you protect this hike.

    Reply
  • October 12, 2021 at 6:18 pm
    Permalink

    I’ve observed that in the world of today, video games will be the latest craze with children of all ages. Occasionally it may be impossible to drag the kids away from the video games. If you want the very best of both worlds, there are plenty of educational video games for kids. Interesting post.

    Reply
  • October 25, 2021 at 4:21 pm
    Permalink

    Loving the information on this web site , you have done great job on the content .

    Reply
  • October 27, 2021 at 7:46 am
    Permalink

    Hi, i think that i saw you visited my weblog thus i came to 搑eturn the favor?I am trying to find things to enhance my site!I suppose its ok to use a few of your ideas!!

    Reply
  • October 29, 2021 at 3:59 pm
    Permalink

    Wonderful learn, I simply handed this onto a colleague who was doing some research on that. And he truly bought me lunch as a result of I discovered it for him smile So let me rephrase that: Thanks for lunch! Anyway, in my language, there arent much good supply like this.

    Reply
  • December 17, 2021 at 11:06 am
    Permalink

    I do agree with all the ideas you have presented in your post. Theyre very convincing and will certainly work. Still, the posts are very short for newbies. Could you please extend them a bit from next time? Thanks for the post.

    Reply
  • December 18, 2021 at 6:57 pm
    Permalink

    I usually dont commonly post on many another Blogs, however Thank you very much keep up the amazing work. Ok regrettably its time to get to school.

    Reply
  • December 19, 2021 at 7:16 am
    Permalink

    Great stuff.You may want to actually consider such as something like cheeseburger. What are your thoughts?

    Reply
  • December 19, 2021 at 5:07 pm
    Permalink

    I really enjoy this template you have got going on in your site. What is the name of the theme by the way? I was thinking of using this style for the web page I am going to build for my class room project.

    Reply
  • December 25, 2021 at 12:23 am
    Permalink

    Just to let you know, this page looks a little bit odd from my android phone. Who knows perhaps its just my mobile phone. Great post by the way. Have you considered promoting your blog? add it to SEO Directory right now 🙂

    Reply
  • January 16, 2022 at 7:01 am
    Permalink

    I enjoyed this internet site quite much and have taken away a better insight. I will recommend this website to everyone I know. More men and women ought to step into. Have you considered promoting your blog? add it to SEO Directory right now 🙂

    Reply
  • February 1, 2022 at 5:17 pm
    Permalink

    There’s noticeably a bundle to find out about this. I assume you made sure nice points in features also….

    Reply
  • February 14, 2022 at 12:21 am
    Permalink

    Prawdziwy z Ciebie talent i mistrz pióra z ogromną łatwością przekładasz myśli na słowa… trzymaj tak dalej, dbaj i pięlęgnuj swego bloga… Skąd czerpiesz tak ciekawe inspiracje ?

    Reply
  • February 14, 2022 at 2:42 pm
    Permalink

    This definitely be the next preference. You are perfect, theme team. I Really enjoy the system, fonts along with the perfect subject. Thanks for a great valuable project. Great work! Keep up the ultra do the webjob!

    Reply
  • March 21, 2022 at 3:22 am
    Permalink

    Hi 🙂 My dream retirement would be living in Udaipur, India! I have been to the city and enjoy the individuals and Indian culture. I’d be thrilled to be able to see this film which takes place in the top place in the world! 🙂

    Reply
  • March 30, 2022 at 12:43 am
    Permalink

    Prawdziwy z Ciebie talent i mistrz pióra z ogromną łatwością przekładasz myśli na słowa… trzymaj tak dalej, dbaj i pięlęgnuj swego bloga… Skąd czerpiesz tak ciekawe inspiracje ?

    Reply
  • April 9, 2022 at 1:14 am
    Permalink

    Howdy, i read your blog often and i own an analogous one and i used to be simply wondering if you get a lot of spam comments? If thus how do you stop it, any plugin or anything youll be able to advise? I get thus much lately its driving me mad so any help is very abundant appreciated. It costs about $10 more on a comparable HP printer, and $75 on a Canon.

    Reply
  • April 15, 2022 at 4:05 pm
    Permalink

    I like the helpful info you provide in your articles. I will bookmark your weblog and check again here regularly. Im quite certain I’ll learn a lot of new stuff right here! Best of luck for the next!

    Reply
  • July 31, 2022 at 11:13 pm
    Permalink

    Right here is the right site for everyone who wishes to find out about this topic. You know so much its almost hard to argue with you (not that I personally will need to…HaHa). You definitely put a brand new spin on a topic which has been written about for decades. Wonderful stuff, just great!

    Reply
  • August 12, 2022 at 10:53 am
    Permalink

    I found your blog using Google and I must say this is one of the most informative blogs I have read in a while. I will make sure I come back to read your future posts.

    Reply
  • August 19, 2022 at 5:00 pm
    Permalink

    Spot on with this write-up, I seriously believe that this website needs far more attention. I’ll probably be returning to read more, thanks for the info!

    Reply
  • September 1, 2022 at 12:43 pm
    Permalink

    As with the previous articles I need to stress that in order to write reviews and have affiliate accounts you need to be of legal age before getting started cialis generic name

    Reply
  • September 5, 2022 at 3:48 pm
    Permalink

    The pharmacy will never hand out free samples, so the only way to actually find out of it works or not is to pay the full price on a prescription real cialis online

    Reply
  • September 7, 2022 at 5:56 pm
    Permalink

    tadalafil generic vs cialis 2016-09-07 Not applicable EU Adcirca Tablet 20 mg 1 Oral Aphena Pharma Solutions – Tennessee, LLC 2009-05-22 Not applicable US Adcirca Tablet, film coated 20 mg Oral Eli Lilly Nederland B

    Reply

Leave a Reply

Your email address will not be published.