[TUTORIAL] Solaredge Integration | Solar Panels

Hello everyone :slight_smile:

This is my first tutorial, I hope I’m doing it correctly, feel free to tell me otherwise.

For Solarredge photovoltaic system owners, here’s how to make a basic report of the information retrieved from the brand’s servers. This will allow you to obtain this kind of result, which I will use as an example in this tutorial:


PREREQUISITES

These steps are detailed in the tutorial

  • Own SolarEdge equipment and have created an API key
  • Have installed Gladys (Captain Obvious at the controls!)
  • Have installed the MQTT integration
  • Have installed Node-red

CREATING A SOLAREDGE API KEY

To create this key, you need to go to the SolarEdge web monitoring at this address: https://monitoring.solaredge.com/
Once your credentials are entered, you will get this menu:

You will need to go to the ADMIN menu and then to Site Access Policy:
image

You will then see this tab where you can generate an API key and save it.

Copy this API key as well as your site ID, we will need them later.


INSTALLING GLADYS


INSTALLING MQTT

This is done in Gladys, in the Integration tab, in one click.
This step is described in the video on installing Node-red

INSTALLING AND USING NODE-RED

I specify that I absolutely did not know the tool before starting… and it’s rather simple for the functions we are going to use. If you have been able to install Gladys / a Docker container, you will be able to manage with Node-red!

Once you have watched this video, you have understood how to retrieve information in Node-red and send it to Gladys via an MQTT broker.

All you have to do now is:

  1. Add a node in Node-red that will be responsible for retrieving SolarEdge data.
  2. Create MQTT devices in Gladys that will receive this information

ADDING A SOLAREDGE NODE IN NODE-RED

As seen in the Node-red video tutorial, you will need to go to the user menu then Manage palette then Install.
In the search field, type solaredge-power and you will see the node appear as here:


Install it by clicking on the Install button.

You will find more information about this node and its possibilities here: node-red-contrib-solaredge-power (node) - Node-RED

In order to obtain the result that is mine (which is just one example among many others), you can directly import this Flow into Node-red by doing Ctrl + i and then pasting the following text:

[
    {
        "id": "8b907e98a30cda10",
        "type": "tab",
        "label": "Solaredge -- Gladys",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "fa05dcc6c3f56552",
        "type": "solaredge-power",
        "z": "8b907e98a30cda10",
        "site": "2fabbdc11f7b34e7",
        "interval": "60",
        "command": "currentPowerFlow",
        "x": 240,
        "y": 240,
        "wires": [
            [
                "b8500338f743f0e1",
                "d0db7133d9d66d12",
                "a88f3e6358c15a97",
                "c3c4dc589062d8b9"
            ]
        ]
    },
    {
        "id": "942e56ee501b6810",
        "type": "mqtt out",
        "z": "8b907e98a30cda10",
        "name": "",
        "topic": "gladys/master/device/mqtt:prodpv/feature/mqtt:prodpvwh/state",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "493ea564b5a53f2c",
        "x": 930,
        "y": 60,
        "wires": []
    },
    {
        "id": "b8500338f743f0e1",
        "type": "function",
        "z": "8b907e98a30cda10",
        "name": "production power",
        "func": "const input = msg.payload;\n\nmsg.payload = input.siteCurrentPowerFlow.PV.currentPower;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 180,
        "wires": [
            [
                "942e56ee501b6810",
                "56c91d64cc144d13"
            ]
        ]
    },
    {
        "id": "d0db7133d9d66d12",
        "type": "function",
        "z": "8b907e98a30cda10",
        "name": "GRID power",
        "func": "const input = msg.payload;\n\nmsg.payload = input.siteCurrentPowerFlow.GRID.currentPower;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 240,
        "wires": [
            [
                "994e508550b78db1",
                "c1e862f32f20a5c6"
            ]
        ]
    },
    {
        "id": "994e508550b78db1",
        "type": "mqtt out",
        "z": "8b907e98a30cda10",
        "name": "",
        "topic": "gladys/master/device/mqtt:grid/feature/mqtt:grid/state",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "493ea564b5a53f2c",
        "x": 900,
        "y": 240,
        "wires": []
    },
    {
        "id": "c820a2f46af7893c",
        "type": "mqtt out",
        "z": "8b907e98a30cda10",
        "name": "",
        "topic": "gladys/master/device/mqtt:load/feature/mqtt:load/state",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "493ea564b5a53f2c",
        "x": 900,
        "y": 400,
        "wires": []
    },
    {
        "id": "a88f3e6358c15a97",
        "type": "function",
        "z": "8b907e98a30cda10",
        "name": "LOAD power",
        "func": "const input = msg.payload;\n\nmsg.payload = input.siteCurrentPowerFlow.LOAD.currentPower;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 300,
        "wires": [
            [
                "c820a2f46af7893c",
                "04af47c06005340b"
            ]
        ]
    },
    {
        "id": "04af47c06005340b",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 460,
        "wires": []
    },
    {
        "id": "56c91d64cc144d13",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 120,
        "wires": []
    },
    {
        "id": "c1e862f32f20a5c6",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 300,
        "wires": []
    },
    {
        "id": "c3c4dc589062d8b9",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "Complete string",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 240,
        "y": 200,
        "wires": []
    },
    {
        "id": "2fabbdc11f7b34e7",
        "type": "solaredge-power-site",
        "siteid": "",
        "apikey": ""
    },
    {
        "id": "493ea564b5a53f2c",
        "type": "mqtt-broker",
        "name": "",
        "broker": "mqtt://localhost",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

You should end up with this:

You will then need to modify the SolarEdge Power node (in yellow) with your SolarEdge API / site ID values:

CREATING MQTT DEVICES IN GLADYS

As you saw in the video tutorial by @pierre-gilles, you can create MQTT devices that will communicate with Node-red.
Here is an example of a device to retrieve data on the total electrical consumption of the house:


This device will be linked to this node:
image

To properly link them, you need to copy the MQTT Topic value in Gladys and then paste it into the node properties in Node-red, here:

You can then do the same with 2 other MQTT devices linked to the other two nodes.

You made it! Well, hopefully… :slight_smile:


That's the end of this tutorial, I don't know if all this will have been clear, if you encounter any issues I can try to help you within the limits of my (rather limited) skills!

Happy installation!

Great @guim31, very nice tutorial, and very comprehensive! :clap:

I’m going to share it with the community

Bravo, that’s super complete, it almost makes you want to have solar panels :grinning_face_with_smiling_eyes:

Cool, I’ll see if I can do the same with my inverter!!!

Otherwise you can simplify the flow like this

[
    {
        "id": "8b907e98a30cda10",
        "type": "tab",
        "label": "Solaredge -- Gladys",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "b8500338f743f0e1",
        "type": "function",
        "z": "8b907e98a30cda10",
        "name": "Production power",
        "func": "const input = msg.payload;\\n\\nmsg.payload = input.siteCurrentPowerFlow.PV.currentPower;\\nmsg.topic = \\\"gladys/master/device/mqtt:prodpv/feature/mqtt:prodpvwh/state\\\"\\n\\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 100,
        "wires": [
            [
                "56c91d64cc144d13",
                "c820a2f46af7893c",
                "c1e862f32f20a5c6"
            ]
        ]
    },
    {
        "id": "d0db7133d9d66d12",
        "type": "function",
        "z": "8b907e98a30cda10",
        "name": "GRID power",
        "func": "const input = msg.payload;\\n\\nmsg.payload = input.siteCurrentPowerFlow.GRID.currentPower;\\nmsg.topic = \\\"gladys/master/device/mqtt:grid/feature/mqtt:grid/state\\\"\\n\\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 340,
        "wires": [
            [
                "c820a2f46af7893c",
                "6bdda102eda08a76",
                "da1791446c730e7b"
            ]
        ]
    },
    {
        "id": "c820a2f46af7893c",
        "type": "mqtt out",
        "z": "8b907e98a30cda10",
        "name": "Gladys",
        "topic": "",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "493ea564b5a53f2c",
        "x": 1030,
        "y": 340,
        "wires": []
    },
    {
        "id": "a88f3e6358c15a97",
        "type": "function",
        "z": "8b907e98a30cda10",
        "name": "LOAD power",
        "func": "const input = msg.payload;\\n\\nmsg.payload = input.siteCurrentPowerFlow.LOAD.currentPower;\\nmsg.topic = \\\"gladys/master/device/mqtt:load/feature/mqtt:load/state\\\"\\n\\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 470,
        "y": 480,
        "wires": [
            [
                "c820a2f46af7893c",
                "44d3b110693a417a",
                "c1809061ef479d05"
            ]
        ]
    },
    {
        "id": "56c91d64cc144d13",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "topic",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 960,
        "y": 120,
        "wires": []
    },
    {
        "id": "c1e862f32f20a5c6",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 970,
        "y": 180,
        "wires": []
    },
    {
        "id": "fa05dcc6c3f56552",
        "type": "solaredge-power",
        "z": "8b907e98a30cda10",
        "site": "2fabbdc11f7b34e7",
        "interval": "60",
        "command": "currentPowerFlow",
        "x": 160,
        "y": 340,
        "wires": [
            [
                "b8500338f743f0e1",
                "d0db7133d9d66d12",
                "a88f3e6358c15a97",
                "6939ab79a4d2044f",
                "4d18e79756d987a6"
            ]
        ]
    },
    {
        "id": "44d3b110693a417a",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "topic",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 660,
        "y": 540,
        "wires": []
    },
    {
        "id": "c1809061ef479d05",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 600,
        "wires": []
    },
    {
        "id": "da1791446c730e7b",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "topic",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 660,
        "y": 220,
        "wires": []
    },
    {
        "id": "6bdda102eda08a76",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 280,
        "wires": []
    },
    {
        "id": "6939ab79a4d2044f",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "topic",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 360,
        "y": 600,
        "wires": []
    },
    {
        "id": "4d18e79756d987a6",
        "type": "debug",
        "z": "8b907e98a30cda10",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 370,
        "y": 660,
        "wires": []
    },
    {
        "id": "493ea564b5a53f2c",
        "type": "mqtt-broker",
        "name": "",
        "broker": "mqtt://localhost",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    },
    {
        "id": "2fabbdc11f7b34e7",
        "type": "solaredge-power-site",
        "siteid": "",
        "apikey": ""
    }
]

Great tutorial.
I just had panels from this brand installed, followed the tutorial to the letter and everything works perfectly. Thanks @guim31
A small clarification for newcomers like me: GRID corresponds to the difference between household consumption and PV production (electricity supplier or surplus), LOAD to the household consumption and production .. well, production from the panels.
Soon I’ll try a connected MQTT module to display consumption levels with red/green LEDs and to know when I can turn on an extra load

Cool !! :grin:
I’m really happy to read that my tutorial was helpful to someone!

Hello @guim31 , are you facing a request limit?
Everything was working

Hi!

I must admit I don’t check Gladys regularly, but since you mentioned it I went into Node-RED in which I see a lot of error messages.

In particular my initial node for the SolarEdge tool returns: « Invalid JSON returned » … but not all the time ^^

Which suggests that from time to time the API call is blocked if it’s too frequent. I’m not sure it’s a per-day limit; otherwise I’d probably be blocked too —