Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

martindinicolino

macrumors newbie
Original poster
Apr 20, 2021
11
1
I am trying to have a HomeKit-enabled smart plug power on my backup drive at a specific time of the day and power off the smart plug once the Time Machine backup is completed.

So far I’m able to back up to the drive and automatically eject it upon completion. For more info see the following thread https://forums.macrumors.com/thread...e-backup.1057661/?post=29933021#post-29933021

I have no clue on how to make the Mac speak to to the smart plug though and would be open to suggestions. Any help would be highly appreciated.
 
Last edited:

martindinicolino

macrumors newbie
Original poster
Apr 20, 2021
11
1
Ok, so this is where I'm at right now.
Turning the smart plug off could definitely be more elegant, but it should do as a proof of concept:
- every day at 17:00 a homekit automation turns on the smart plug to power the external hard drive,
- I have LaunchControl running a script at 17:01 that automatically backs up the drive with TimeMachine and ejects it upon completion,
- I then added a curl command at the end of the script that triggers and delivers a notification to any iPhone, iPad or Apple Watch using Pushcut,
- tapping the notification on any of those devices triggers a shortcut that turns off the smart plug;

Pushcut pro allows you to turn an always-on iOS device into an automation server, thus eliminating the need of any physical interaction, rendering the whole thing seamless, which is great and would definitely be a possible solution; but I was hoping to find a way to do this without having to sign up for a subscription service. Any ideas?
 
Last edited:

mpainesyd

macrumors 6502a
Nov 29, 2008
689
168
Sydney, Australia
An interesting project but I think it needs Homekit commands to be available in a programming language like Swift or Applescript. That seems unlikely given Apple's neglect of Homekit (there is not even an Apple Discussion category dedicated to Homekit).
"...power off the smart plug as soon as the time machine backup is completed." - why is it so critical to turn it off straight away? Why not used a generous duration (say 1 hour) and then turn it off?
 
  • Like
Reactions: martindinicolino

martindinicolino

macrumors newbie
Original poster
Apr 20, 2021
11
1
An interesting project but I think it needs Homekit commands to be available in a programming language like Swift or Applescript. That seems unlikely given Apple's neglect of Homekit (there is not even an Apple Discussion category dedicated to Homekit).
"...power off the smart plug as soon as the time machine backup is completed." - why is it so critical to turn it off straight away? Why not used a generous duration (say 1 hour) and then turn it off?
You mean the availability of HomeKit commands in Swift or Applescript would help reduce complexity for this project, did i get that right?

About the lack of time delay, i don’t know, it seemed convenient, the HDDs I use can get relatively loud (I described using one for simplicity but i do use 2 and it can get a bit distracting when i’m studying). Adding a time delay didn‘t appear to make sense to me as they are only ejected after TM has completed all of its steps; is there something i’m overlooking?
Adding a wait function to the script shouldn’t be too difficult.
 

martindinicolino

macrumors newbie
Original poster
Apr 20, 2021
11
1
the awesome people over at talks.automators.fm had great inputs on how to improve this and suggested a solution I really like using HomeControl;
with Shortcuts coming to MacOS Monterey this process might get even easier, in case you are interested you can follow this project‘s progress here;
 
  • Like
Reactions: robotica
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.