How I auto-charge my Macbook using Broadlink smart plug, Power Manager and IFTTT app

Jelly Tran
3 min readSep 19, 2020

--

Not long before, my laptop drains on battery pretty badly. Moreover, thể battery issue got even worse, the bottom surface is swollen.

This is because of me not paying enough intention for the battery charging, I should have unplugged the charging cable after my laptop is fully charged. I know many people are living this bad habit too, we tend to leave the charging cable even when the green light is on.

And during my smart home setup process, I was determined to solve this problem automatically without me wasting time and will power for this small action (unplug the cable). I will cut the chase and go straight to the point right ahead ^^

The automatic charging process could be described by words like this: when the laptop battery is under 10%, trigger an action to start charging. When the laptop battery is 100%, trigger an action to stop charging. As simple as that, but the execution would cost you some bucks for the pursuit of smart devices.

Things to prepare:

charge_macbook event
stop_charge_macbook event
Add a script and choose “Run a script on battery remaining”
  • In my case, I will choose 10% is the limit before I start the charging on

In the script, you have to make a request to trigger the web hook you have defined. Fill in this blank the following pieces of code

past this line of code and replace your webhook key accordingly
  • Use this command to make a request to start charging:
curl -X POST https://maker.ifttt.com/trigger/charge_macbook/with/key/{your_webhook_key}
  • The same flow could be created for the “battery level reaching 100%” case. Use this command to make a request to stop charging:
curl -X POST https://maker.ifttt.com/trigger/stop_charge_macbook/with/key/{your_webhook_key}

Everything is already set up, when the MacBook battery drops to 10%, the electric current would be activated, red light on the cable is on, and when the battery reaches 100%, the electric current would be stopped, green light on a cable is off. You don’t have to move a finger during this whole charging process. This would save your will power for something else more important while keeping your battery in good condition.

--

--

Jelly Tran
Jelly Tran

Written by Jelly Tran

jelly, web developer, currently in Singapore

Responses (1)