How to integrate Fusion Solar (from Huawei) with Alexa

Manuel Conde
7 min readFeb 19, 2025

--

Recently, I had solar panels installed with a Huawei inverter, model SUN2000.

After seeing that the Fusion Solar app offers a lot of data related to energy generation and consumption, I was intrigued by the idea of whether it would be possible to integrate the information from the Fusion Solar app with Alexa.

After a quick search on Google, quite a few people were asking the same thing in Huawei’s own forums, but no one seemed to have found a solution, as Huawei does not offer any type of integration for Smart Home devices.

However, some people had found a solution to integrate Fusion Solar information into Home Assistant, which is an open-source system for Smart Home that uses Raspberry Pi devices or home servers to manage all the integrated devices.

I found those people here: https://github.com/tijsverkoyen/HomeAssistant-FusionSolar

Specifically, they discovered that the information generated by the kiosk mode (a customized control panel that offers very specific information chosen by the manufacturer) offered by Fusion Solar could be used, and also that, by knowing your installer’s data or becoming your own installer for your solar installation, one could access an internal API offered by Fusion Solar for installers through OpenAPI or NorthboundAPI.

Some data offered by Fusion Solar website

Since, in my particular case, my only intention was to know from Alexa the power currently being generated (just out of curiosity and to avoid having to access the Fusion Solar app), the data offered by kiosk mode was sufficient for my purpose. However, it should be noted that the kiosk mode has a small issue: the data is cached for 30 minutes, so the information is not accessible in real time, but with a 30-minute delay. If this doesn’t work for you, you’ll have to deal with the API mode.

On the other hand, I discovered that it was quite easy to program your own skill for Alexa. Simply by following Amazon’s own tutorial (which takes about 30 minutes), where they explain how to create your first skill, you already have enough information.

With all this information, I got to work.

Step one: get the data

While the Github page for Home Assistant for Fusion Solar tells you how to obtain the kiosk mode URL to integrate it into their system (on the Fusion Solar website, at the top right, there is the Kiosk icon), it does not clarify where they obtain the data in JSON format.

Where to activate kiosk mode

Because in reality, the URL that gives you the kiosk mode is a webpage that runs some JavaScript files and generates a visible page with statistics and a power generation graph.

Some of the data you could see in kiosk mode

The URL of the website that offers kiosk mode has this format:

https://uni001eu5.fusionsolar.huawei.com/pvmswebsite/nologin/assets/build/cloud.html#/kiosk?kk=xxxxxxxxxxxxxxxxxxxxxxxxxxxx

and in it, the only thing that stands out is the kk parameter, which gives us a unique generated token for our installation, with a validity of 1 year from the time it is generated. After that year, a new token must be generated.

If you analyze that page in the browser’s Dev Tools, you will see a call to the REST service, from where it gets the data displayed on that webpage. Specifically, the call is this one:

https://uni001eu5.fusionsolar.huawei.com/rest/pvms/web/kiosk/v1/station-kiosk-file?kk=xxxxxxxxxxxxxxxxxxxxxxx

As you can see, it uses the same token to obtain the information. The call returns several data points (including those for the graph to be represented, which are many) and, specifically, the information we want is in the data field. A small problem we encounter with the response of this data is that it comes in escaped format, so it is not readable at first glance. Simply, by unescaping the content, we already have the information legible.

Several data come, but in my case, the only one that interests me is the current power, which is found in data.realKpi.realTimePower.

We already have a way to easily obtain the data we need.

Second step: integrate it into an Alexa skill

Since the purpose of this tutorial is not to explain how to create an Alexa skill, as the Alexa tutorial explains it perfectly, what I am going to provide you with is the final code that the Alexa skill executes to return the information to me through a voice command.

The only thing I will add is that my intention was for Alexa to give me the information with a single and simple command, for which I have used the “LaunchRequestHandler” to directly execute my code without having to give a second command to execute a custom intent. As the invocation name, I have chosen “fusion solar” (at least two words).

I clarify this because the tutorial specifies that Alexa skills must have an invocation name, such as “Alexa, open fusion solar” and then, in the custom intent where you have your code, you assign one or more utterances that call that intent (for example, “give me the power”). That forced me to say long phrases like the following: “Alexa, open fusion solar and give me the power”. To avoid this, I decided to put the code directly into the launcher and thus avoid having to say an execution phrase that calls the intent.

That said, this is how I left the launcher:

const Alexa = require('ask-sdk-core');
const axios = require('axios');
const unscape = require('unescape');

const LaunchRequestHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest';
},
async handle(handlerInput) {
try {
const response = await axios.get(`https://uni001eu5.fusionsolar.huawei.com/rest/pvms/web/kiosk/v1/station-kiosk-file?kk=YOUR_TOKEN_HERE`);
const data = JSON.parse(unscape(response.data.data));
const power = Math.round(data.realKpi.realTimePower * 10) / 10;
let speechText;

switch (true) {
case (power <= 0.5):
speechText = `La potencia actual es muy baja, de solo ${power} kilovatios.`;
break;
case (power > 0.5 && power <= 1):
speechText = `La potencia actual es baja, de solo ${power} kilovatios.`;
break;
case (power > 1 && power <= 2):
speechText = `La potencia actual es media, de ${power} kilovatios.`;
break;
case (power > 2 && power <= 3):
speechText = `La potencia actual es alta, de ${power} kilovatios.`;
break;
case (power > 3):
speechText = `La potencia actual es muy alta, de ${power} kilovatios. ¡Vamos a todo tren!`;
break;
default:
speechText = `Valor desconocido`;
console.log("Valor no reconocido");
}

return handlerInput.responseBuilder
.speak(speechText)
.getResponse();
} catch (error) {
return handlerInput.responseBuilder
.speak(`Lo siento, hubo algún error al leer los datos del inversor.`)
.getResponse();
}
}
};

... rest of default code

It should be noted here that I have used the axios library to make the call to the REST service, and the unescape library to unescape the data. Both must be included in the lambda’s file package.json.

 "dependencies": {
"ask-sdk-core": "^2.7.0",
"ask-sdk-model": "^1.19.0",
"aws-sdk": "^2.326.0",
"axios": "^1.7.9",
"unescape": "^1.0.1"
}

Third step: ask Alexa

Well, with these two things, everything would be ready to have our personalized skill on Alexa. The ultimate test comes when I say to the Fire-TV: “Alexa, open fusion solar” and Alexa responds with a simple phrase: “The current power is medium, at 1.2 kilowatts.”

Next comes the question I have seen the most in forums about skills that only you will use at home: do I have to publish the skill in the Market? The answer, according to my research, seems to be no. You can leave your skill in developer mode and you won’t need to publish it (which would be detrimental to you, because remember that you had to put your personal token in the URL that calls the REST service, and you need to renew that token every year). The only thing you need to keep in mind for this to work is that your developer account and the account you use with Alexa must be the same.

And done! I already have some information about solar panels integrated into Alexa. In total, gathering and understanding the information, watching the Alexa skills tutorial, finding and refining the REST data, and programming and testing the skill, barely took me an afternoon (about 4 hours). So I think it’s quite accessible for anyone.

Surely, if you have more Smart Home devices, you can come up with ideas to integrate turning them off or on at specific times of the day, simply by asking Alexa. I hope it has been useful to you.

You can find the full code in my GitHub: https://github.com/mcvendrell/alexa-skill-for-fusion-solar?tab=readme-ov-file

--

--

No responses yet