SolarEdge solar panels support

Hi there, I’m looking to switch from Domoticz to Home Assistant. I think all of my Domoticz setup can be achieved in Home Assistant, except for my SolarEdge solar panels. In Domoticz it is possible to connect to the SolarEdge API. Are there any initiatives to have SolarEdge support in Home Assistant?

For now you can link SolarEdge API to PVOutput, which is a supported component.
+1 for direct implementation, though!

1 Like

+1 for implementation. The PVoutput component is ok, but PVoutput is not consistent with the data, better to directly connect to your SolarEdge portal :slight_smile:

+1 from my side too!

Looks like solaredge changed its api or something. I’m constantly getting real time readings (both for production and consumption) with a 3 sec delay. Time for a dedicated component? :innocent:

+1 for me :slight_smile:

Which component are you using?

You can make use of a REST sensor, my sensors:

- platform: rest
  resource: https://monitoringapi.solaredge.com/site/YOUR_SITE_CODE/overview.json?api_key=YOUR_API_KEY
  value_template: '{{ value_json.overview.lastDayData.energy | float / 1000 | round(1) }}'
  name: 'SolarEdge Today'
  unit_of_measurement: 'kWh'
  scan_interval: 900

- platform: rest
  resource: https://monitoringapi.solaredge.com/site/YOUR_SITE_CODE/overview.json?api_key=YOUR_API_KEY
  value_template: '{{ value_json.overview.currentPower.power | round(1) }}'
  name: 'SolarEdge Live'
  unit_of_measurement: 'Watt'
  scan_interval: 900
3 Likes

Really nice solution! I’ve tried to check the output of that url, but lot of data are missing (current production and consumption data). Are you aware of any other way to get those values? I’m using pvoutput with limited success: when I’m both producing and consuming, I get actual data alternated with 0 readings. So no real way to use this for automation rules.
Thanks so much

The second REST sensor as mentioned in my post is extracting the current production from the overview JSON output. My current consumption is gathered from my Dutch Smart Meter, so I don’t know about that, but the API is documented, see (page 18?): https://www.solaredge.com/sites/default/files/se_monitoring_api.pdf

1 Like

Following your hints and after digging a bit into the api documentation you’ve linked, here’s the “magic link”

https://monitoringapi.solaredge.com/site/your_site_id/currentPowerFlow.json?api_key=your_api_key

(replace site id and api key).

This is a sample output from my PV (no battery, but if present you should also get its values back):

{"siteCurrentPowerFlow":{"updateRefreshRate":3,"unit":"kW","connections":[{"from":"LOAD","to":"Grid"},{"from":"PV","to":"Load"}],"GRID":{"status":"Active","currentPower":5.29},"LOAD":{"status":"Active","currentPower":0.7},"PV":{"status":"Active","currentPower":5.99}}}

Now comes the fun part, and first thing first: is there any way to get more value templates from a single rest request? (due to daily API limit of 300 calls)

Thanks so much for your input, @Kroontje

So, here’s my attempt to make this work.
Thanks so much to @mad_ady and @sti0 which are working on this.

First thing first, we need a custom component: jsonrest.

In your main homeassistant folder, create a custom_components folder and a sensor subfolder. Create then a textfile named jsonrest.py placed in the sensor subfolder.

homeassistant_folder
----> custom_components
---------> sensor
----------------> jsonrest.py

Open the textfile, and paste this (thanks to @sti0)

Save file and close.

Here’s hass part: (replace yourSiteID and yourAPIkey with SolarEdge ones)

sensor:
  - platform: jsonrest
    resource: https://monitoringapi.solaredge.com/site/yourSiteID/currentPowerFlow.json?api_key=yourAPIkey
    method: GET
    name: SolarEdge jsonrest
    scan_interval: 400

  - platform: template
    sensors:
      grid_consumption:
        value_template: '{{ states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["LOAD"].currentPower }}'
        unit_of_measurement: 'kW'
      grid_production:
        value_template: '{{ states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["PV"].currentPower }}'
        unit_of_measurement: 'kW'
      grid_available:
        value_template: '{{ states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["PV"].currentPower - states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["LOAD"].currentPower}}'
        unit_of_measurement: 'kW'

Remember that SolarEdge has an API limit call of 300 a day. You can follow same process for other data (kWh production and consumption), but since solaredge website is so good at plotting graphs and collecting data I see no point for it in my setup.

09-11-2017 17_29_40-Home Assistant

Take profit :beer:

1 Like

any chance someone knows how to apply for an Api key? On my account page no such option is offered, and clicking the secure website mentioned in the documentation leads an error…

Cheers,
Marius

btw, im reading all possible statistics out of my SE installation, through mqtt . Modbus connected to my Zwave Hub, which also reads my smart meter DSMR4
A direct Solar Edge add-on would be so much easier…
cheers,
Marius

aha. cool.
I don’t have that tab ;-((

Ask your installer to enable that. If you cannot reach him, call Solaredge until you find an operator kind enough to activate it real time :slight_smile:

+1 for me
Having this supported would be nice.

Added decimal rounding to avoid really long numbers. Let’s call it ver. 0.2

sensor:
  - platform: jsonrest
    resource: https://monitoringapi.solaredge.com/site/yourSiteID/currentPowerFlow.json?api_key=yourAPIkey
    method: GET
    name: SolarEdge jsonrest
    scan_interval: 400

  - platform: template
    sensors:
      grid_consumption:
        value_template: '{{ states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["LOAD"].currentPower }}'
        unit_of_measurement: 'kW'
      grid_production:
        value_template: '{{ states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["PV"].currentPower }}'
        unit_of_measurement: 'kW'
      grid_available:
        value_template: '{{ states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["PV"].currentPower - states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["LOAD"].currentPower | round(2) }}'
        unit_of_measurement: 'kW'
1 Like

— edit—
no separate inverter data yet, but progress has been made (last month and last day are defined correctly, same output probably result of last month being only 1 day old??):

09

had to skip the jasonrest sensors, since their not working in my setup (yet)
----- end edit-----

thats wonderful!
I’ve managed to get my api key and site id. Filled these in in the sensor jsonrest, and seems to work. That is, i don’t get any authorization questions. Is that how its suppers to work?

the solarEdge sensor is On, the others still unknown, so that might be a definition issue. btw, i don’t have any meter installed yet that measures my consumption, so i will have to take that out i guess, unless that is somehow measured inside the Solar Edge system itself?

Also, i have 3 grids. would the definition of the grid_production and grid_available have to change compared to your settings?

—edit—
added the 2 examples @Kroontje provided above. They’re metering!

04

still, its not close to what my other meters are saying:

52

will check and find the peculiars, but thanks all for getting this far!

----edit—

some specifics: my threefaseinverter telemetry, im looking for the correct syntax to retrieve the L1DAta,L2Data and L3Data. Did you manage this @Kroontje?

the telemetry layout through http:

<data>
<count>24</count>
<telemetries>
<threePhaseInverterTelemetry>
<date>2016-12-05 11:04:58</date>
<totalActivePower>319.0</totalActivePower>
<dcVoltage>748.5</dcVoltage>
<groundFaultResistance>6900.03</groundFaultResistance>
<powerLimit>100.0</powerLimit>
<totalEnergy>444623.0</totalEnergy>
<temperature>22.6103</temperature>
<inverterMode>MPPT</inverterMode>
<L1Data>
<acCurrent>0.78125</acCurrent>
<acVoltage>226.016</acVoltage>
<acFrequency>49.9869</acFrequency>
<apparentPower>176.0</apparentPower>
<activePower>118.0</activePower>
<reactivePower>-130.0</reactivePower>
<cosPhi>1.0</cosPhi>
</L1Data>
<vL1To2>388.219</vL1To2>
<vL2To3>388.344</vL2To3>
<vL3To1>389.188</vL3To1>
<L2Data>
<acCurrent>0.648438</acCurrent>
<acVoltage>224.062</acVoltage>
<acFrequency>49.9879</acFrequency>
<apparentPower>170.0</apparentPower>
<activePower>118.0</activePower>
<reactivePower>-122.0</reactivePower>
<cosPhi>1.0</cosPhi>
</L2Data>
<L3Data>
<acCurrent>0.757812</acCurrent>
<acVoltage>223.141</acVoltage>
<acFrequency>49.9866</acFrequency>
<apparentPower>145.0</apparentPower>
<activePower>83.0</activePower>
<reactivePower>-148.0</reactivePower>
<cosPhi>1.0</cosPhi>

Cheers,
Marius

Seems a good solution. So I followed the instructions, copied the jsonrest.py right from the source in homeAssistant/custom_components/sensor/ and added the sensor configuration to my configuration.yaml file. Then I restarted homeAssistant. En then my log shows a long list of issues like this:

 File "/usr/src/app/homeassistant/loader.py", line 104, in get_platform
return get_component(PLATFORM_FORMAT.format(domain, platform))

File “/usr/src/app/homeassistant/loader.py”, line 142, in get_component
module = importlib.import_module(path)
File “/usr/local/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 674, in exec_module
File “”, line 781, in get_code
File “”, line 741, in source_to_code
File “”, line 219, in _call_with_frames_removed
File “/config/custom_components/sensor/jsonrest.py”, line 156
self.data = None
^
TabError: inconsistent use of tabs and spaces in indentation

I can’t figure out what I am doing wrong… Anybody??