Stay Ahead of Loadshedding with an iOS Shortcut Using ESP’s API

by | Sep 18, 2023

If you’re tired of manually checking loadshedding schedules, this tutorial is for you. Initially, my coworker Justin had the idea of using Google Home to fetch loadshedding times. After some research, we decided to create an iOS Shortcut instead. It calls the ESP API (formerly Eskom se Push) to fetch the next loadshedding time for a specific area in South Africa.

Prerequisites

  • An iPhone running iOS 13 or higher
  • ESP API token (Get it here)
  • Postman or another API testing tool

Steps

Get Your API Token

First, go to ESP’s API page and get an API token. It’s free for up to 50 requests per day.

Find Your Area ID

To find your Area ID, you’ll also need to use the ESP API:

  1. Open Postman or your preferred API testing tool.
  2. Make a GET request to https://developer.sepush.co.za/business/2.0/areas_search?text=YOUR_SEARCH_TERM, replacing YOUR_SEARCH_TERM with the name of your area, town, or region.
  3. Add a header named token and insert your API token as its value.
  4. Look for the id field in the JSON response to get your Area ID.

Create the Shortcut

  1. Open Shortcuts: Open the Shortcuts app on your iPhone.
  2. Create Shortcut: Tap on “+”, then “Add Action”.
  3. Call the API: Add a “Get Contents of URL” action.
    • URL: Use the Area Information API endpoint, for example: https://developer.sepush.co.za/business/2.0/area?id=YOUR_AREA_ID
    • Headers: Add a header named token and paste your API token as its value.
  4. Get Dictionary Value: Add a “Get Dictionary Value” action to extract the events from the API response.
  5. Get First Item from List: Use a “Get Item from List” action to retrieve the first item from the events list.
  6. Retrieve ‘Start Time’: Use another “Get Dictionary Value” action to get the start time from the first event.
  7. Format Date: Use a “Format Date” action to change the date format to a more readable one.
  8. Display Result: Use a “Show Result” action to display the formatted start time.

Use Siri to Run the Shortcut

You can also trigger this shortcut through Siri by saying the name of the shortcut. For instance, if you named your shortcut “When is loadshedding”, saying this to Siri will execute the shortcut and provide you the next loadshedding time.


Stay empowered and never be in the dark again about when the next loadshedding will occur. This shortcut is your own personal loadshedding assistant, always a voice command away. Enjoy your newfound convenience!

That’s it! You now have a simple Apple Shortcut that allows you to ask Siri when the next loadshedding event is. Just activate Siri and say your shortcut’s name, like “When is loadshedding,” and you’ll get the next start time.

Happy loadshedding planning!


If you want to find out more about how Maverick Labs can help your company build custom apps you can contact us or if you want to see more on what Maverick Labs does view our full products and services.

This blog post was created with the assistance of AI tools, including ChatGPT, to aid in research and content generation. The content was then reviewed and approved by the post author for accuracy and coherence.

While AI tools can provide valuable insights and information, it’s important to note that the content reflects a combination of automated assistance and human oversight. The author’s expertise and judgment were integral in shaping the final article.

Readers are encouraged to use their discretion when interpreting the information presented and to consider seeking additional sources or expert opinions for a comprehensive understanding of the topics discussed. The author is responsible for the content’s accuracy and reliability, and any errors or omissions are unintentional.

Thank you for visiting our blog, and we hope you find the information informative and engaging. Your feedback and questions are always welcome.