SolarEdge - additional sensors

Is there a simple method to add on my own a new sensor for integration? I looked in sensor.py but there in SolarEdgeSensorFactory the names with _ are used and in the API this is not there, on top of that I need something that is split by phase: AC Voltage

I need this to add a warning before the inverter shuts down on its own due to overvoltage.

I don’t know of a way to add a sensor to the integration, but before this integration came out, users would use a REST sensor.

As an example, using the “Site Overview” API to get the current power, it would look something like:

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

Just be aware that this adds to the rate limiting for the SolarEdge cloud.

Where you able to get the voltage in Home Assistant? I’m looking for the exact same thing!

rest:
  - scan_interval: 00:10:00
    method: GET
    resource_template: https://monitoringapi.solaredge.com/equipment/<siteId>/<inverterSN>/data.json?startTime={{ (now() - timedelta(minutes = 15)).strftime('%Y-%m-%d %H:%M:%S') }}&endTime={{ now().strftime('%Y-%m-%d %H:%M:%S')}}&api_key=<apiKey>
    sensor:
      name: 'SolarEdge Current Data'
      value_template: '{{ value_json.data.count }}'
      json_attributes_path: "$.data"
      json_attributes:
        - "telemetries"
template:
- sensor:
  - name: "SolarEdge Voltage"
    unique_id: solaredge_voltage
    state: |
      {% set cur = state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1] %}
      {{ [float(cur.L1Data.acVoltage), float(cur.L2Data.acVoltage), float(cur.L3Data.acVoltage)] | max | round(1) }}
    attributes:
      Date:     "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].date }}"
      "Line 1": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L1Data.acVoltage | float | round(1) }} V"
      "Line 2": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L2Data.acVoltage | float | round(1) }} V"
      "Line 3": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L3Data.acVoltage | float | round(1) }} V"
    icon: >
      {% set cur = state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1] %}
      {% set v = [float(cur.L1Data.acVoltage), float(cur.L2Data.acVoltage), float(cur.L3Data.acVoltage)] | max %}
      {% if v >= 253 %}
        mdi:flash-off
      {% elif v >= 250 %}
        mdi:flash-alert
      {% else %}
        mdi:flash
      {% endif %}
    device_class: voltage
    state_class: measurement
    unit_of_measurement: V

Where do I add the “Rest” code?

In config.yaml
Remember to put your site Id, serial number and API key in url

Hi,

I added it to my config.yaml, added the site Id, serial number and API key in the url. I can see the sensors now, but no values.

Below a copy from from config.yaml (I had part of my site, serial and api keys)

rest:
  - scan_interval: 00:10:00
    method: GET
    resource_template: https://monitoringapi.solaredge.com/equipment/<29xxx>/<74xxx-48>/data.json?startTime={{ (now() - timedelta(minutes = 15)).strftime('%Y-%m-%d %H:%M:%S') }}&endTime={{ now().strftime('%Y-%m-%d %H:%M:%S')}}&api_key=<72ABCD>
    sensor:
      name: 'SolarEdge Current Data'
      value_template: '{{ value_json.data.count }}'
      json_attributes_path: "$.data"
      json_attributes:
        - "telemetries"
template:
- sensor:
  - name: "SolarEdge Voltage"
    unique_id: solaredge_voltage
    state: |
      {% set cur = state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1] %}
      {{ [float(cur.L1Data.acVoltage), float(cur.L2Data.acVoltage), float(cur.L3Data.acVoltage)] | max | round(1) }}
    attributes:
      Date:     "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].date }}"
      "Line 1": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L1Data.acVoltage | float | round(1) }} V"
      "Line 2": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L2Data.acVoltage | float | round(1) }} V"
      "Line 3": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L3Data.acVoltage | float | round(1) }} V"
    icon: >
      {% set cur = state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1] %}
      {% set v = [float(cur.L1Data.acVoltage), float(cur.L2Data.acVoltage), float(cur.L3Data.acVoltage)] | max %}
      {% if v >= 253 %}
        mdi:flash-off
      {% elif v >= 250 %}
        mdi:flash-alert
      {% else %}
        mdi:flash
      {% endif %}
    device_class: voltage
    state_class: measurement
    unit_of_measurement: V

You should check if the address from resource_template is correct. Open it in your browser and see what you get. After inserting the dates, your address should look like this:

https://monitoringapi.solaredge.com/equipment/29xxx/74xxx-48/data.json?startTime=2022-05-23 00:00:00&endTime=2022-05-23 23:00:00&api_key=72ABCD

and should return:

{
   "data":{
      "count":1,
      "telemetries":[
         {
            "date":"2022-05-23 05:01:46",
            "totalActivePower":0.0,
            "dcVoltage":612.697,
            "powerLimit":100.0,
            "totalEnergy":1060100.0,
            "temperature":24.827,
            "inverterMode":"MPPT",
            "operationMode":0,
            "vL1To2":411.313,
            "vL2To3":414.1,
            "vL3To1":411.551,
            "L1Data":{
               "acCurrent":0.0,
               "acVoltage":237.246,
               "acFrequency":49.9996,
               "apparentPower":0.0,
               "activePower":0.0,
               "reactivePower":0.0,
               "qRef":0.0
            },
            "L2Data":{
               "acCurrent":0.0,
               "acVoltage":237.743,
               "acFrequency":50.0001,
               "apparentPower":0.0,
               "activePower":0.0,
               "reactivePower":0.0,
               "qRef":0.0
            },
            "L3Data":{
               "acCurrent":0.0,
               "acVoltage":239.019,
               "acFrequency":49.9993,
               "apparentPower":0.0,
               "activePower":0.0,
               "reactivePower":0.0,
               "qRef":0.0
            }
         }
      ]
   }
}

@epenet @bdraco @ulmerkott
Perhaps you could add additional sensors to the integration?

I do not use the integration and I have no plans to add extra functionality.
I think that you should look into it and see if you can add yourself - contributing isn’t difficult.

I get this, so the address is incorrect. I double checked my site-id, serial number and api key.

@Matthijs_NL, it means something is wrong with your URL
try starting one at a time…
Monitoring server API (solaredge.com)
check that you are providing the correct siteId (to be found here: https://monitoringapi.solaredge.com/sites/list?api_key=apiKey)
check that you are providing the correct inverterSN (to be found here: https://monitoringapi.solaredge.com/equipment/siteId/list?api_key=apiKey)

Hi, a year later allready, but as the sun in shining more and more (and the neighbours all added solarpanels) I’m extra curious in the voltage on the inverter.

Dumbass me just left the <> in the siteId/API key code, instead of just the number. With that fixed I can manually call the URL and see the data.

But still the sensor says “Unavailable”.
Any suggestions?

With this URL:

https://monitoringapi.solaredge.com/equipment/297####/740A####-##/data.json?startTime=2023-05-14%2000:00:00&endTime=2023-05-14%2023:00:00&api_key=72LVMXXXXXXXXXXXX

I get this data:

{"data":{"count":103,"telemetries":[{"date":"2023-05-14 00:02:44","totalActivePower":0.0,"dcVoltage":20.0976,"groundFaultResistance":11000.0,"powerLimit":100.0,"totalEnergy":2699580.0,"temperature":28.3454,"inverterMode":"MPPT","operationMode":0,"L1Data":{"acCurrent":0.0,"acVoltage":237.798,"acFrequency":49.9327,"apparentPower":0.0,"activePower":0.0,"reactivePower":0.0,"cosPhi":0.0}},{"date":"2023-05-14 00:07:44","totalActivePower":0.0,"dcVoltage":20.0994,"groundFaultResistance":11000.0,"powerLimit":100.0,"totalEnergy":2699580.0,"temper

The “rest” code in configuration.yaml (I changed the scan interval to every 10seconds to get faster results while testing)

rest:
  - scan_interval: 00:00:10
    method: GET
    resource_template: https://monitoringapi.solaredge.com/equipment/297#####/740A####-##/data.json?startTime={{ (now() - timedelta(minutes = 15)).strftime('%Y-%m-%d %H:%M:%S') }}&endTime={{ now().strftime('%Y-%m-%d %H:%M:%S')}}&api_key=72LVMKBO5IJ9XXXXXXXXXXXXX
    sensor:
      name: 'SolarEdge Current Data'
      value_template: '{{ value_json.data.count }}'
      json_attributes_path: "$.data"
      json_attributes:
        - "telemetries"

Sensor Code:

template:
- sensor:
  - name: "SolarEdge Voltage"
    unique_id: solaredge_voltage
    state: |
      {% set cur = state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1] %}
      {{ [float(cur.L1Data.acVoltage), float(cur.L2Data.acVoltage), float(cur.L3Data.acVoltage)] | max | round(1) }}
    attributes:
      Date:     "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].date }}"
      "Line 1": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L1Data.acVoltage | float | round(1) }} V"
      "Line 2": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L2Data.acVoltage | float | round(1) }} V"
      "Line 3": "{{ state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1].L3Data.acVoltage | float | round(1) }} V"
    icon: >
      {% set cur = state_attr('sensor.solaredge_current_data', 'telemetries')[states('sensor.solaredge_current_data') | int -1] %}
      {% set v = [float(cur.L1Data.acVoltage), float(cur.L2Data.acVoltage), float(cur.L3Data.acVoltage)] | max %}
      {% if v >= 253 %}
        mdi:flash-off
      {% elif v >= 250 %}
        mdi:flash-alert
      {% else %}
        mdi:flash
      {% endif %}
    device_class: voltage
    state_class: measurement
    unit_of_measurement: V