How to: Use automatic Octopus tariff data in the Solax app

A screenshot of the page where users can generate an Octopus API key

If you have a Solax inverter attached to your solar panels, and get your energy from Octopus, then you can now calculate your earnings using live tariff data in the Solax app. I gather this feature has been there for a few months, but I’ve only recently found out about it. Here’s how to set it up.

Firstly, open the SolaxCloud app. On the home screen, tap the Earnings section. At the top right, you should see an icon that looks like a calculator with a lightning bolt on it, so tap that. You’ll now see two tabs – ‘To Grid’ and ‘From Grid’.

Get your Octopus API key

Before we continue, you’ll need to generate an API key. Log into your online Octopus Energy account (on the web, not on the app). At the top, it should say ‘Hi, [your name]’, display your account number, and then show a link called ‘Personal Details’. Click that link.

You should now see several boxes, one of which is called ‘Developer settings’. Click the ‘API access‘ button.

Scroll down a bit, and you’ll see a box labelled ‘Your API key:’. Copy this key, and preferably save it in a password manager. You can only have one API key, but you can use it for multiple things – I use my key for the Octopus Energy integration for Home Assistant, for example. You can regenerate your key, but it’ll invalidate your previous key, and you’ll only be shown it once on the Octopus web site. That’s why it’s best to treat it like your password.

Whilst you’re on Octopus’ web site, make a note of your account number too, as you’ll need this in a moment.

Enable automatic tariff setting

Back to the SolaxCloud app. Below the ‘To Grid’ and ‘From Grid’ tabs, you should have two further tabs: ‘Customized’ and ‘Automatic’. Tap ‘automatic’.

A new box called ‘Tariff provider’ appears, so tap this, and select ‘Octopus’. There’s another option called ‘Nord Pool’ which may work if you use a different energy supplier. I don’t, so I’ve only tested this with Octopus.

Now, you’ll have two options: ‘API Key’ and ‘Select a package’. ‘Select a package’ lets you manually choose your tariff and region, but it won’t update automatically if you change your tariff. So, we’ll select ‘API key’. Here, enter your account number, and then the API key, and tap ‘Save’. You should find that your current tariff and meter point access number now appear in the app. Scroll down, and you’ll be able to see the underlying tariff data, both as a graph and the raw data.

I’m on a fixed tariff with Octopus, so at present there’s no fluctuation with my import and export prices. However, if you’re on a tariff such as Octopus Agile, you’ll now see this data in the SolaxCloud app. What’s more, any future earnings will be calculated using this tariff data, and so it’ll more accurately reflect how much money your solar panels and/or battery are saving you.

Join Octopus

Octopus is now the UK’s largest electricity supplier, with a market share of 22%. And, with features like API access, the chances are that if you’re geeky enough to read this sort of blog post, then you’re already signed up. However, if not, here’s my referral link – you’ll get £50 off your first bill if you sign up. Financial incentives aside, of all the energy companies that I have used, Octopus have had the best customer service by far.

So long, Solax local API

A screenshot of the Home Assistant web site showing the information page for the Solax integration.

If you’ve been reading this blog for a while, you’ll know that we have solar panels which are connected to an inverter from the Chinese company Solax. Recently, I asked for the firmware on our inverter to be updated, as part of some testing I’m assisting with for an app. Unfortunately, in doing so, it’s broken the Home Assistant integration.

As per the integration page:

Inverter models with newer firmware (and also those using devices like PocketWifi) no longer expose an API when connected to your wireless network, they do however continue to expose it on their own broadcasted SSID. To use this sensor in this case it is necessary to set up a reverse proxy with something like NGINX and use a Raspberry Pi (or similar) with two network connections (one being Wi-Fi that connects to the inverters SSID).

Home Assistant Solax Power integration
A screenshot of the Wi-Fi network selection screen on iOS 8, showing an unsecured network for the Solax inverter.

Sure enough, a scan of available Wi-fi networks showed a new unsecured SSID with my inverter’s serial number. Now I’m not beyond setting up a reverse proxy (I have Nginx Proxy Manager running) but this would require purchasing an additional Raspberry Pi, potentially with an additional USB Wi-fi adaptor or HomePlug adaptor.

Annoyingly, the inverter does still connect to my home Wi-fi network, and it’s possible to access a web-based portal by popping the inverter’s IP address into a web browser. But it no longer offers a local, real-time API over REST.

All aboard the Modbus

That’s the bad news. The good news is that it’s still possible to connect to the inverter using the Modbus protocol. Now, Modbus is old. Like, really old. Like, older than me old. Like, old enough to be a grandfather old. Like… well, you get the picture – it was originally developed in 1979 for use over serial connections. Thankfully Modbus can also work over TCP/IP on port 502, so I don’t need to run a very long serial cable and dig out my old USB to RS232 adaptor. Yes, I still have a USB to RS232 adaptor somewhere. I’m only a few years younger than Modbus.

Also, Modbus sounds like a bus full of really cool people wearing 1960s fashion and listening to The Who, although arguably they should be on Lambretta scooters. This is where I would ask Microsoft Copilot to create an image of this, but I’ll probably end up using the equivalent electricity to power a provincial English town trying to get it to generate what I’ve pictured in my mind.

Home Assistant natively supports Modbus, and if you have a spare half hour you can read everything on that page. Suffice to say, you have to set it up using YAML and know the Modbus specification of the device you’re communicating with. You probably don’t want to do this.

HACS to the rescue

The good news is that there’s a HACS integration for Solax Modbus. Once you have HACS installed, search for Solax and it’s (currently) the only one that comes up. Install it, restart Home Assistant, and then add the integration. There will be lots of input boxes pre-filled with default values – leave these be. The only thing you need to enter is the IP address for your inverter.

Once set up, the integration added loads of new entities for my inverter to Home Assistant. In fact, it seems like there were far more than before. The data isn’t strictly speaking ‘real-time’, but it polls every 15 seconds and so might as well be.

So that’s the good news. You can have the latest firmware on your inverter, and have it work locally with Home Assistant, without having to purchase another device to act as a reverse proxy. The bad news is that you’ll need to update any dashboards that you have set up to point to the new entities.

Looking to the cloud

The official way of accessing your inverter’s data and status is using the Solax Cloud, either online or through the official app. From there, there is an official API for interacting with this data. But it’s not real-time – updates happen every five minutes. And I can see why some people won’t want their data uploading to the cloud.

There isn’t a Home Assistant integration for Solax Cloud, either in the core product or through HACS. But someone has written their own YAML code to communicate with the Cloud API, should you wish to use this, although it also relies on the REST API which seems to have been deprecated from newer firmware versions.

Getting the latest Solax firmware

If you do want to update the firmware on your Solax inverter, there’s a handy guide here. The easiest and safest way is to contact Solax support and ask them to do it for you; they can log into your inverter remotely and run the upgrade. I hadn’t realised this until Home Assistant suddenly stopped being able to communicate with the REST API on my inverter. There are other ways of obtaining the firmware, and you can upload it yourself to your inverter’s local web portal, but it’s probably best for Solax to do this for you. Considering our solar panels, battery and inverter cost a five figure sum to install, it’s not something that I want to accidentally brick.

As for the app I mentioned in the first paragraph? I’ll talk about it once it’s released.