{"id":3406,"date":"2026-05-09T14:35:53","date_gmt":"2026-05-09T18:35:53","guid":{"rendered":"https:\/\/blog.lufamily.ca\/kang\/?p=3406"},"modified":"2026-05-09T14:36:09","modified_gmt":"2026-05-09T18:36:09","slug":"home-automation-garage-door-opener-on-life-support","status":"publish","type":"post","link":"https:\/\/blog.lufamily.ca\/kang\/2026\/05\/09\/home-automation-garage-door-opener-on-life-support\/","title":{"rendered":"Home Automation Garage Door Opener on Life Support"},"content":{"rendered":"\n<p>More than nine years ago, I created a <a href=\"https:\/\/blog.lufamily.ca\/kang\/2017\/03\/14\/raspberry-pi-zero-w-with-relay\/\">remote garage door<\/a> opener that connected to my HomeKit setup. This has proven to be a budget-friendly and super handy device, as I am able to control my garage door from anywhere in the world. I came up with this solution before WiFi-based remote garage door openers were commercialized.<\/p>\n\n\n\n<p>However, recently the Raspberry Pi Zero W started to randomly lose WiFi network connection, and I have to reboot it all the time. Of course, this is very frustrating. Since the device is plugged into a ceiling plug, the same socket that is used for the actual garage door opener, it is quite inconvenient to cycle the device. I typically had to restart the whole garage by resetting the breaker on the main electrical panel.<\/p>\n\n\n\n<p>I have some extra <a href=\"https:\/\/www.aliexpress.com\/item\/1005008886238781.html?src=google&amp;src=google&amp;albch=shopping&amp;acnt=631-313-3945&amp;isdl=y&amp;slnk=&amp;plac=&amp;mtctp=&amp;albbt=Google_7_shopping&amp;aff_platform=google&amp;aff_short_key=UneMJZVf&amp;gclsrc=aw.ds&amp;albagn=888888&amp;ds_e_adid=&amp;ds_e_matchtype=&amp;ds_e_device=c&amp;ds_e_network=x&amp;ds_e_product_group_id=&amp;ds_e_product_id=en1005008886238781&amp;ds_e_product_merchant_id=5385071276&amp;ds_e_product_country=CA&amp;ds_e_product_language=en&amp;ds_e_product_channel=online&amp;ds_e_product_store_id=&amp;ds_url_v=2&amp;albcp=19366866438&amp;albag=&amp;isSmbAutoCall=false&amp;needSmbHouyi=false&amp;gad_source=1&amp;gad_campaignid=17337458112&amp;gbraid=0AAAAACbpRIlN7eGJpvL5wv0rmG_zhkeAF&amp;gclid=CjwKCAjwtvvPBhBuEiwAPMijrwjrtXgBjVsURgq3EuA1LNjldTPAlmhKb6xz7Sq-g1XGvpKI1RHI4BoCEU0QAvD_BwE\">ESP32-S3 SuperMini<\/a> boards on the side that I was going to replace the PiZero W with. I bought these from Pinduoduo (\u62fc\u591a\u591a) when I was in China last year. Due to my laziness, I did not get around to it. Something else happened that allowed me to find another workaround.<\/p>\n\n\n\n<p>About three and a half years ago, I purchased the <a href=\"https:\/\/www.amazon.ca\/dp\/B091TJ39L5?ref_=ppx_hzod_title_dt_b_fed_asin_title_0_0\">VOCOlinc HomeKit Smart Plugs<\/a> from Amazon. I used these to remotely control some fans in the house. One of these was recently freed up. I can then plug the adapter used to power the Pi Zero into the Smart Plug. Now I have a remote way to remotely power cycle the Pi Zero. A remote device to control the power of another remote device! Not only can I cycle the Pi Zero remotely, I can also programmatically determine when to cycle the device.<\/p>\n\n\n\n<p>The Smart Plug is setup with my HomeKit environment and I recently learned that on a Mac, you can use the Shortcut App to toggle an accessory or scene with HomeKit.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"187\" src=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.10.20-PM-1024x187.png\" alt=\"\" class=\"wp-image-3411\" srcset=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.10.20-PM-1024x187.png 1024w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.10.20-PM-300x55.png 300w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.10.20-PM-768x140.png 768w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.10.20-PM-1200x219.png 1200w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.10.20-PM.png 1258w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n<\/div>\n\n\n<p>I also found out that once I have a Shortcut, I can invoke it using the <code>shortcuts<\/code> command line command.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"896\" src=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.29.28-PM-1-1024x896.png\" alt=\"\" class=\"wp-image-3415\" srcset=\"https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.29.28-PM-1-1024x896.png 1024w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.29.28-PM-1-300x262.png 300w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.29.28-PM-1-768x672.png 768w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.29.28-PM-1-1536x1343.png 1536w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.29.28-PM-1-2048x1791.png 2048w, https:\/\/blog.lufamily.ca\/kang\/wp-content\/uploads\/sites\/3\/2026\/05\/Screenshot-2026-05-09-at-2.29.28-PM-1-1200x1050.png 1200w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n<\/div>\n\n\n<p>Using this shortcut concept, I can create a periodic cron job that effectively check the connectivity of the Pi Zero every 15 minutes. If I am unable to connect, I can effectively remote restart the Pi Zero. The script is listed below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/usr\/bin\/env zsh\n#\n# This script is meant to be run as root\n\nlogger \"cyclePizero.sh: INFO test connectivity to pizero.localdomain\"\nif ! ping -q -c 1 pizero.localdomain >\/dev\/null; then\n        logger \"cyclePizero.sh: ERROR unable to ping pizero.localdomain\"\n        logger \"cyclePizero.sh: INFO restarting the resolved daemon\"\n        systemctl restart systemd-resolved.service\n        logger \"cyclePizero.sh: INFO cycling pizero.localdomain\"\n        ssh bigbird -n 'shortcuts run \"Toggle Garage Opener\"'\n        sleep 3\n        ssh bigbird -n 'shortcuts run \"Toggle Garage Opener\"'\n        logger \"cyclePizero.sh: INFO cycling completed\"\nelse\n        logger \"cyclePizero.sh: INFO pizero.localdomain ping successfully\"\nfi<\/code><\/pre>\n\n\n\n<p>Note that I also sometimes have to restart the name resolution service, <code>system-resolved<\/code>. This is another reason sometimes HomeKit fails to communicate with the Pi Zero.<\/p>\n\n\n\n<p>Hopefully this patch will work until I finally have time to replace it with the ESP32.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>More than nine years ago, I created a remote garage door opener that connected to my HomeKit setup. This has proven to be a budget-friendly and super handy device, as I am able to control my garage door from anywhere in the world. I came up with this solution before WiFi-based remote garage door openers &hellip; <a href=\"https:\/\/blog.lufamily.ca\/kang\/2026\/05\/09\/home-automation-garage-door-opener-on-life-support\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Home Automation Garage Door Opener on Life Support&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[108],"tags":[102,67,28],"class_list":["post-3406","post","type-post","status-publish","format-standard","hentry","category-electronics-hobby","tag-homekit","tag-networking","tag-technology"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7V6i8-SW","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/3406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/comments?post=3406"}],"version-history":[{"count":8,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/3406\/revisions"}],"predecessor-version":[{"id":3417,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/posts\/3406\/revisions\/3417"}],"wp:attachment":[{"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/media?parent=3406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/categories?post=3406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lufamily.ca\/kang\/wp-json\/wp\/v2\/tags?post=3406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}