Blog
How I built an Electricity Bill Tracker for fun and (not) profit

How I built an Electricity Bill Tracker for fun and (not) profit

Project
Excerpt
How curiosity drove me to building a neat tool to keep track of my Electricity spending
2nd Posted URL
Action Items
Channel
Medium
DavidAmunga.com
Next Action Date
Dec 14, 2022
Posted URL
Published Date
Dec 16, 2022
Status
Published
Type
Blog
Keywords
This is a story, a full expose, of my solo dev project , stima.app - An Electricity Bill Tracker for Kenyan Consumers. I took it up in late June 2022 and completed it in September 2022. I hope it serves as a helpful guide to anyone building simple tools that makes daily life easier.

Introduction

On the 16th of May 2022,I found myself in an unfortunate situation of having my power cut due to zeroing out on my electricity prepaid tokens. I was in the middle of a demo showcasing the progress on a platform to ~ 10 senior people in a call. This was the 5th time in a year it happened and it always resulted in uncomfortable conversations after rejoining ie Rescheduling (probably meant a no ) or cringe jokes about how KPLC (Kenya Power and Lightning Company - Electricity provider) always sucked.

About KPLC

Kenya Power and Lighting Company, commonly referred to as Kenya Power or shortened KPLC, is a public liability company which transmits, distributes and retails electricity to customers throughout Kenya. Consumers commonly pay for electricity using prepaid and postpaid methods. Postpaid users.
Postpaid users are billed based on the reading done on a monthly basis. Its quite interesting that this is done manually via someone coming to ready the meter at the physical location. Prepaid users purchase power and input a unique Token No onto their power meters and their usage is cut based on the units purchased. After paying, users get a notification from Kenya Power giving more info about the purchase.
Kenya Power Prepaid Message
Kenya Power Prepaid Message
A Prepaid Meter
A Prepaid Meter
 

The Idea

During one of the few times i had my unfortunate zero token situation i didn’t get the acknowledgement message after paying which was weird. I skimmed through Twitter to find out whether others has faced a similar issue. I discovered that there exists a Self Service Portal where users can check up on their recently made meter payments to retrieve the token.
Self Service Portal
Self Service Portal
I was glad i was able to get the Token Number but was massively surprised that not many users know it exists and prefer ranting at their Support Account on Twitter. One interesting thing about buying from the screenshot above is that often times the total amount you pay could result in purchasing lesser/more units.
notion image
There is a growing debate among Kenyan consumers on the frequent fluctuation of these prices. Edwin Ngatia has a series of insightful posts breaking down the variables involved to calculate the final token price.
The self service portal works but i personally found the interface heavily underwhelming where it only showed the last ~4 transactions and basically didn’t tell consumers anything else.

The Problem

From a consumer perspective i discovered a few key problems with the self service platform :
  1. Lack of Transparency. At the moment of writing , consumers can only check the last 3-4 transactions that they made. This could be a security concern to hide some of the previous data however i didn’t find a convincing reason how such could be a problem. Historical records are helpful so that consumers track their electricity spending
  1. Lack of Measurable Insights. There is an elaborate breakdown that is provided on the portal and in an acknowledgement SMS. Due to frequent fluctuations (often rise) in the cost of electricity due to certain variables (ie Inflation, consumers are often clueless on the impact it has on them but it also contributes to the relative cost of living in Kenya.

The Solution

I opted to hack out a way i could at least get some bit of data through some fun browser automation using Puppeteer and made an interesting breakthrough describe more through this post Reverse Engineering the KPLC API using Puppeteer for fun
In the end i was able to validate that we could actually do some basic math and get some key insights on my general spending after keying in my meter no.

A Stable v1.0

I had built up a stable API by the end of August. It was a simple Nest.js service running on Firebase Cloud Functions that just worked. For the UI of the platform I built it using Next.js and Tailwind CSS. I built up a simple landing page that straight ahead asked the user for the users Meter Number.
Stima v1.0 landing page
Stima v1.0 landing page
The app has an insights tab highlighting high level statistics on the over the past X number of transactions depending on how far back the KPLC API churns out (~ 6 months )
My Spending stats. Scary i know…. 😶
My Spending stats. Scary i know…. 😶
 
There is also really helpful tab showing the breakdown for each transaction that contributes to the final cost.
notion image
 
The final tab shows cumulative payments you’ve made over the last X months on a Horizontal Bar Chart
notion image

Market Validation

After building the above features i decided shared the app to a couple of friends and family and they generally liked it which gave me a bit of confidence it could be a nice tool. A kind friend shared it in r/kenya subreddit post and i was delightfully surprised it drove up traffic to 50+ users within 2 months !
Splitbee Website Analytics
Splitbee Website Analytics
I did a couple of prototyping sessions with users and was finally able to make it slightly more useful adding a breakdown for Postpaid users and a monthly email where you’ll be able to get a breakdown of your spending.

Shoutout

Huge shoutout to my cool friends Brandon , Cyril , Emmanuel , Derick and Merlin for contributing some major insights on the platform. ie: they are some other guys 😁
notion image

Future features

As time goes by i hope to add the following features onto the platform
  1. Variable Insights Tracking per transaction. To check how much more/less certain variables like Forex Charge/WARMA Levy has changed depending on the previous payment made. e.g (You’ve paid 5% more in Forex Charges as compared to the previous transaction)
  1. More helpful metadata insights. The insights tab is basically derived from the basic statistics i could come up with but believe there could be more trends i could calculate.
  1. Scheduled Power Blackout Alerts. This is a key pain for every Kenyan consumer. The only way to discover if your area has a blackout is if you head over to their website or support twitter channel and frustratingly zoom in some jpegs of unstructured location data to get an idea
    1. Screenshot of the mess of unstructured data
      Screenshot of the mess of unstructured data
  1. Stima Wrapped ??. Paying a fun homage to Spotify Wrapped where you get a story view format of your past transactions for the year. (Releasing Dec 28 🤩🤩 !!!!)
  1. Stima API ?? If anyone wishes to expand the usecase further
Any more cool stuff you’d like to see. Do share !

Disclaimer

As i built the app i’m only using browser automation to fetch through the KPLC API hence :
  1. No data is cached on fetched requests to the KPLC API. Only data saved is email + meter / account number if the users wants to willingly subscribe and get some monthly results.
  1. Some of the data from Postpaid results could be erroneous as it depends on whether the meter was read during that month so it will probably show past payments as bills regardless of the reading made.
  1. The platform is free and the Bill tracking is not made for any profit not now or anytime in the future.

Data Privacy

Other than this being a novel solution as a hobby projects there are general concerns about Data Privacy particularly after the recent enactment of the Data Protection Act 2019 of Kenya which makes a provision for the regulation of the processing of personal data; to provide for the rights of data subjects and obligations of data controllers and processors; and for connected purposes.
Since this is currently being encouraged across Kenyan companies. I was able to make a short framework on how we achieve the same using this live privacy policy

Final Thoughts

This project wasn’t a grand big idea but a small attempt to providing more value to a users spending. I believe we should all be more confident in attempting to solve the small annoying unnecessary discomforts we experience in day to day life. Sometimes we should be encouraged to push our bounds of creativity beyond the regular large scale problem space and often experiment on solving niche problems in our near vicinity.

Conclusion

A great concern i have is the discovery of how the KPLC API works might lead to the future limiting the API hence making the stima.app relatively limited. I really hope that Kenya Power would be able to leverage insights from this project into building a super bill query and tracking tool that will be adequately reliable to consumers as we push towards having better accountability and transparency in utility bills.

Last edited on Fri Dec 30 2022

🗒Hey there !

Was anything I wrote confusing, outdated, or incorrect? Please let me know! Just write a few words below and I'll be sure to amend this post with your suggestions.