Home EK and You Meet Our Electric Kiwi Juice Hacker

Meet Our Electric Kiwi Juice Hacker

Have you ever wondered how coding can change the way we manage power? We’ve been on a mission to find out! Our Juice Hacker campaign has kicked off, inviting anyone up for a challenge to show off their coding skills and create cool stuff using our Electric Kiwi API.

A talented hacker, Michael, integrated Electric Kiwi with Home Assistant. We asked him some questions about his project, so if you’re keen to know what inspired him to work on this project and how it benefits EK customers, read on!

Can you share a bit about your background in software development and how you became interested in home automation?

I have a degree in Computer Science from Otago. I’ve been in software development for about 10 years now. I’ve been working on mobile apps, small scale games, websites and complex integrations and systems. The main languages I’ve used are Javascript (and Typescript), C#, a bit of Kotlin and Java thrown in. No python though which is what Home Assistant is written in.

I started getting really interested in Home Automation when we moved home about 2 years ago and I wanted things like my lights and speakers to turn on automatically when I walked into my home office. Kids also leave things on a lot, like lights and so on, so I want them to turn off on their own. I’d discovered Home Assistant and started learning about all the things it could do. We’d also had solar installed so that further made me want to utilise the excess power better.

What inspired you to participate in the Electric Kiwi Juice Hackers campaign?

We’d recently moved house and power providers (to EK) and had solar installed. Our 1960s house is not very energy efficient so it’s very warm in summer and too cold in winter. The bedroom was one of the worst with next to no insulation in the roof; however, we have five heat pumps and the one in our bedroom was Wifi controllable, which means I could automate it. So a nice warm (or cool) room for an hour sounded like a great idea. I’d managed to set up the automation to go off manually, but of course what if I changed my Hour of Power? I’d then have to change all my automations too!

On top of this, I wanted everything to be easy for my wife to use if she wanted to change the hour. I knew other energy providers had APIs so off I went searching and found the Juice Hackers API, I was stoked!

How did you initially approach the project? Were there any specific problems you aimed to solve with your integration?

I’d never written a Home Assistant integration before and to be honest it’s really daunting. I joined the Home Assistant Discord channel to ask questions and also looked around to see if anyone was already working on it. I found an unofficial integration by Matt (one of EK’s founders) on Github but wasn’t really what I wanted to build and wasn’t a home assistant integration either. Some others had made minor attempts at an integration but didn’t get far. Once released I got a lot of “I was going to do this but didn’t have time” from others.

Can you walk us through the process of developing the integration? What were the biggest challenges you faced, and how did you overcome them?

I don’t write Python at all in my daily job so it was a huge learning curve! Learning python and Home Assistant at the same time!

When I discovered the API I also learned there was no Python API for the Juice Hackers API. With Home assistant integrations, you need to separate the interfaces (client) from the integrations. It took me at least three iterations to get an API client I was happy with and worked in a way that was easy to use. So I had to publish my first Python library which can be installed using pip (the python package manager).

I did this as I slowly learnt how to make a basic integration using sensors (displaying static data like account information)

I also wanted to publish my integration into Home Assistant – this takes a lot of time and patience, there are hundreds of pull requests that the developers go through so it took months before they were able to review my integration. However; fortunately, that didn’t prevent me from sharing a version others could use while I waited for that to get reviewed. Patience is hard!

I also got EK in touch with Nabu Casa (makers of Home Assistant) to better integrate signing users into the integration using home assistant cloud instead of users having to sign up for their own access keys. This was an interesting process on its own but made for a much better user experience.

How does this integration improve the everyday lives of Electric Kiwi customers using Home Assistant?

Customers can now set up automations around when their free Hour of Power is, whether that’s heating the spa or turning on the dishwasher or setting an alarm. The possibilities are only limited by one’s creativity.

So in short it helps customers save money on their power bill and manage their spending on power as they can also see their current account balance and bills.

They can also change their free Hour of Power using automations based on power use or manually using the selector so they can have this on custom dashboards instead of having to open the app.

Are there any future enhancements or additional features you’re planning to add to the integration?

I’ve been asked a few times to provide energy usage e.g daily, weekly etc. However due to how Home Assistant works and my limited knowledge, this is a bit harder than just exposing the data as the initial days data is usually an estimate and not accurate. Home assistant provides a really useful energy dashboard so getting this data in would be great, so is next on the list. This will allow users to use their energy data to better save money by learning about their energy usage.

What has been the most rewarding aspect of working on this project?

There are probably two rewards for me.

One is my own achievement of publishing both the EK Python API and EK Home Assistant Integration and solving the challenges that came along with it.

The other is the sense of achievement and satisfaction knowing I’ve helped other kiwis use their power better and give them their data to use as they wish.


Thanks to Michael’s work, Electric Kiwi customers can now do all sorts of cool stuff. They can set up their gadgets to turn on and off automatically, saving power and money. Michael’s also thinking about adding even more features, like showing how much energy you’re using each day. Keen to give your coding power a go? Visit our EK Juice Hackers website for more info!


Related Articles

Cartoon boy dressed as a detective investigating scams and bad passwords
EK and YouHow-to

Staying safe online: Why a pet’s name isn’t a good password

Think of a number between 1 – 10… It’s a well documented...

A cartoon boy representing Electric Kiwi customers holds onto an umbrella in a strong windstorm, illustrating the company's commitment to safeguarding its customers from the impact of skyrocketing wholesale energy prices.
EK and YouIndustry Watch

Why is Electric Kiwi not taking new Electricity customers?

Updated 24th July 2024 Electric Kiwi has made the decision to stop...

Cartoon girl working at cash register with Peaky Bank logo, giving change to customer.
EK and YouSavings

Introducing Peaky Bank

With Peaky Bank, you’ll get paid $2/kWh to reduce your usage when...

Say goodbye to manual payments! With the Electric Kiwi app 2.0, you can now easily make payments and manage your payment methods right from the app.
EK and YouHow-to

App 2.0 is here!

We’re all about making things better – and our Electric Kiwi app...

Sarah Manikam celebrates her success as a recipient of the Electric Kiwi-AUT Women in STEM scholarship.
EK and You

The STEM student we’re supporting this year

What kind of person appears in your head when you imagine a...

Infographic illustrating peak and off-peak hours for optimizing battery usage with Electric Kiwi's MoveMaster plan.
Energy TransitionHow-toTechnology

How to use your battery to save with MoveMaster

Gone for a battery? Nice one. Batteries are a great way to...