We all have them—those old smartphones gathering dust in a drawer. For several years now, I’ve been repurposing my trusty 2016 iPhone SE as a dedicated home security camera using the popular Alfred app. It’s a fantastic way to upcycle old tech, but it has always come with one major, frustrating downside: severe battery degradation.

Because the phone was essentially plugged in 24/7, I found myself having to replace the battery every single year, and sometimes even more frequently. If you’ve ever left a phone constantly charging, you might be familiar with the dreaded „spicy pillow“ effect, where the lithium-ion battery swells up, threatening to break the screen or even pose a fire hazard.

I tried to outsmart the issue by putting a smart plug on a basic timer schedule, cutting the power for a couple of hours a day. Unfortunately, that blind scheduling just didn’t work—the phone would still overcharge or completely die at the worst times. Yesterday, after having the battery replaced yet again, I decided enough was enough.

To make this setup truly reliable and safe for long-term use, I had to find a way to manage the battery dynamically based on its actual needs. The goal? Keep the iPhone charging happily between 20% and 80%, completely automatically. Here is how I finally built a self-managing charging ecosystem using a Shelly smart plug and Apple Shortcuts.

Step 1: Prepping the iPhone SE

Before tackling the charger, we need to minimize the phone’s power consumption. Even while streaming video, we can save a lot of juice:

Power-Saving Mode in Alfred: Turn this on. It blacks out the screen and locks it against accidental touches, but keeps the camera rolling.

Do Not Disturb: Enable this permanently to stop random notifications from waking the screen.

Screen Brightness: Slide it to absolute zero and turn off Auto-Brightness in the Accessibility settings.

Low Power Mode: Keep iOS Low Power Mode permanently on to throttle background processing.

Step 2: The Hardware – Enter the Shelly Plug

To control the power, I plugged the iPhone’s power adapter into a Shelly smart plug. I chose Shelly because it has a brilliant feature for tinkerers: Local HTTP APIs.

Unlike many smart plugs that require you to bounce signals through a cloud server (which introduces lag and relies on internet connectivity), a Shelly plug can be turned on and off by sending a simple web link directly to its local IP address on your home Wi-Fi network.

Pro Tip: Go into your Wi-Fi router settings and assign a static IP address to your Shelly plug (e.g., 192.168.1.50) so it never changes.

Step 3: The Magic of Apple Shortcuts Automations

Here is where the magic happens. We are going to teach the old iPhone SE to monitor its own battery and command the Shelly plug to give it power only when it’s hungry.

Note: These automations must be created directly on the iPhone SE that is acting as the camera.

Automating the „Turn ON“ (When battery drops below 20%)

Open the Shortcuts app on the iPhone SE and go to the Automation tab.

Tap the + (or Create Personal Automation).

Scroll down and choose Battery Level.

Adjust the slider to 20% and select Falls Below 20%. Tap Next.

Tap Add Action, search for „URL“, and select Get Contents of URL.

In the URL field, type the local HTTP command for your Shelly plug.
(For older Shelly plugs like the Plug S, it looks like this: http://[YOUR_SHELLY_IP]/relay/0?turn=on. For newer Gen 2 Plus/Pro models, use: http://[YOUR_SHELLY_IP]/rpc/Switch.Set?id=0&on=true).

Tap Next. Crucial Step: Toggle OFF Ask Before Running. If you leave this on, the phone will wait for you to tap the screen to confirm, which defeats the purpose of an automated camera.

Tap Done.

Automating the „Turn OFF“ (When battery rises above 80%)

Now, we just reverse the process to stop the charging before the battery gets stressed.

Create a new Personal Automation and choose Battery Level.

Adjust the slider to 80% and select Rises Above 80%. Tap Next.

Add the Get Contents of URL action again.

Input the „Off“ command.
(Older Shelly: http://[YOUR_SHELLY_IP]/relay/0?turn=off. Newer Shelly Gen 2: http://[YOUR_SHELLY_IP]/rpc/Switch.Set?id=0&on=false).

Tap Next, turn OFF Ask Before Running, and tap Done.

The Result: A Set-It-And-Forget-It Security System

That’s it! Now, the iPhone SE sits quietly in the corner, guarding the room. As it works, the battery slowly drains. Once it hits 19%, the phone silently fires a command over the Wi-Fi to the Shelly plug. The plug clicks on, and the phone charges. Once it hits 81%, it tells the plug to shut off.

This simple Shortcuts loop prevents overheating, completely eliminates the risk of battery swelling, and gives that old 2016 hardware a brand-new, safe, and productive lease on life.

Tags