Windows Load Shedding Auto Shutdown Software

Not sure, but I would recommend just getting a UPS which will come with software and protect your PC from unscheduled outages too.
 
Not sure, but I would recommend just getting a UPS which will come with software and protect your PC from unscheduled outages too.
the software that comes with those UPSs is terrible. I've used it for other reasons like turning off the buzzer and besides having to jump through hoops to install it was buggy. software is meant to solve problems not create new ones.

I just use Task Scheduler. Create a new task to trigger "C:\Windows\System32\shutdown.exe" at the required time.
I haven't looked, but it would be cool if there was a small windows service that ran in the background that could read a loadshedding api, and set the task scheduler to automatically shutdown, and allow for offset like - auto shutdown 10min into loadshedding.
 
Assuming that you have your schedule, you could do this with a Powershell script.
A single windows command in task scheduler will do.

shutdown /s /t 30
...should do it. Schedule that to run 5 mins before load shedding (run as administrator).
 
Last edited:
I haven't looked, but it would be cool if there was a small windows service that ran in the background that could read a loadshedding api, and set the task scheduler to automatically shutdown, and allow for offset like - auto shutdown 10min into loadshedding.
If there's an API then it's easily doable.
 
Maybe.

To automatically shut down your PC during load shedding in South Africa, you can use a LoadShedding API to monitor the status and trigger the shutdown when necessary. Here's a step-by-step guide using Python:
  1. Find a suitable LoadShedding API: Research and select an appropriate LoadShedding API that provides information on load shedding schedules and statuses in South Africa. An example is the EskomSePush API (https://eskom-se-push.co.za). Note that you may need to sign up for an API key to access the service.
  2. Install required libraries: You'll need the requests library to make API calls and the schedule library to schedule your script. Install them using pip:

Python:
pip install requests schedule

Create a Python script: Open your preferred code editor and create a new Python script, e.g., loadshedding_shutdown.py. Add the following code:

Python:
import requests
import os
import schedule
import time

API_KEY = 'your_api_key'
API_URL = 'https://loadshedding-api-url.com'
AREA = 'your_area_identifier'

def get_loadshedding_status():
    url = f"{API_URL}?api_key={API_KEY}&area={AREA}"
    response = requests.get(url)

    if response.status_code == 200:
        data = response.json()
        return data['status']
    else:
        print(f"Error fetching data: {response.status_code}")
        return None

def check_and_shutdown():
    status = get_loadshedding_status()

    if status and status == 'load_shedding':
        print("Load shedding detected, shutting down PC.")
        os.system('shutdown /s /t 1')
    else:
        print("No load shedding detected.")

# Check every 5 minutes
schedule.every(5).minutes.do(check_and_shutdown)

while True:
    schedule.run_pending()
    time.sleep(60)

  1. Customize the script: Replace the API_KEY, API_URL, and AREA variables with your specific details from the API provider.
  2. Test the script: Run the script in your terminal with python loadshedding_shutdown.py. It will check the load shedding status every 5 minutes (you can change the interval as needed). If load shedding is detected, your PC will shut down automatically.
  3. Run the script in the background: To keep the script running in the background, you can either minimize the terminal window or use a tool like nohup (Linux) or pythonw.exe (Windows) to run the script without the terminal window.
Remember to save your work and close important applications before running the script, as your PC may shut down automatically when load shedding is detected.
 
Top
Sign up to the MyBroadband newsletter
X