First of all this is not the usual(ess) article that says “use Low Power Mode, disable background refresh, etc…” we already know those stupids tips, I’m assuming that we are a bit above this level.

So I would try to explain how to keep charged your batteries between 20% and 80% using Shortcuts and Alexa connected Smart Plug, plus get some notifications when the batteries are below or above a threshold of other devices. For example, get an SMS or email on your iPhone when the battery of the MacBook is above/below x% level, in order to remember to charge it.

But since it’s boring to remember to detach the cable when the charge is above 80%, I made an automation using Shortcut, that automatically turn off the charger above 80%.

If you want to know why 80%, here’s a great technical article from Battery University: How to Prolong Lithium-based Batteries. Without using complicated words, when a battery is almost full, it has lots more difficulty to store the final charge. And this is where the batteries degrade, when you charge them always to full or always discharged to empty.

iOS

First thing, I’m using the Meross smart plugs (with Alexa only), but is the same with other similar products, then you need to connect an iOS shortcut to an Alexa routine. I’m doing it using MKZsense skill, you can find more info here: mkzense.com

After created a new webhook in the MKZsense service (mine is called IFTTT-3) you need to attach it to an Alexa action, in this way:

IMG_4681

Then, create an Alexa routine that uses the -just created- trigger to turn off the charger:

IMG_4687

Then create a shortcut that “presses/activates” the Alexa routine using a Webhook (technically you are doing a GET request that activates the request to run your Alexa routine via MKZseense server, but is not important to know):

SCR-20220128-hwr

And add it to the automation “when battery level rises above 80%”

20220128-125137

macOS

Same procedure can be applied for a laptop with macOS but here Shortcut doesn’t allow to run an automation, so we need “an app for that”, that is Shortery - Shortcut Automation for your Mac by Lars Gerckens, available for free on the Mac App Store.

But instead an automation on the iOS app Shortcut, just create an automation on Shortery that runs when the battery is above 79% that launches the shortcut to turn off the smart plug.

Image 29-01-22 at 08.50

You can also add a shortcut that send you an email (or an SMS) when the battery is below 20-30% in order to remember to charge the device:

Conclusions

Just a long and complex post, but absolutely not difficult, just remember that when the smart plug is turned off by the automation, the day after when you will charge again your device, it’s still off, so I also inserted a routine that turn on the smart plugs every day at X hour, just using an automation from the smart plugs app:

20220129-093824

I’m also using the same setup, with the help of Shortery, to turn on/off the light of my desk when my iMac is going to sleep or is waking up.

Screen Shot 2022-01-30 at 08.34.11

In action:

videogif