SolarEdge solar panels support


#41

Maybe you can help me here. Ive made another sensor for the Inventory.

- platform: jsonrest
  resource: !secret se_inventory_resource
  method: GET
  name: SolarEdge Inventory
  scan_interval: 400

i can’t get the separate attritbutes to show up though, i must be misplacing the various _ and . but think ive tried all combinations :wink:

{{states.sensor.solaredge_inventory.attributes.Inventory.inverters.name}}

Ive also tried it with a rest sensor, like my other sensors, but that too wont show the details, only the main sensor:

- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.name}}'
- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.SN}}'
- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.manufacturer}}'
- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.model}}'
- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.communicationMethod}}'
- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.connectedOptimizers}}'
- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.dsp1Version}}'
- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.dsp2Version}}'
- platform: rest
  resource: !secret se_inventory_resource
  value_template: '{{ value_json.Inventory.inverters.cpuVersion}}'

Please have a look would you?

Thanks,
Marius


#42

check Can't get separate list items in a template

@VDRainer solved this for me, please use to your advantage!

Cheers,
Marius


#43

Thanks for all the work here guys.

You can of course also make a history graph on the home screen:

sensor:
  #- platform: yr
  - platform: jsonrest
    resource: https://monitoringapi.solaredge.com/site/SITESITESITE/overview.json?api_key=KEYKEYKEY
    method: GET
    name: SolarEdge inverter
    scan_interval: 400

  - platform: template
    sensors:
      grid_today:
        friendly_name: "Solar Power Today"
        value_template: '{{ (states.sensor.solaredge_inverter.attributes.overview.lastDayData.energy | float / 1000) | round(2) }}'
        unit_of_measurement: 'kWh'
      grid_now:
        friendly_name: "Solar Power Now"
        value_template: '{{ (states.sensor.solaredge_inverter.attributes.overview.currentPower.power | float / 1000) | round(2) }}'
        unit_of_measurement: 'kW'

# Solar graph
history_graph:
  gr1:
    name: Solar Graph
    entities:
      - sensor.grid_now
    hours_to_show: 24
    refresh: 60

#44

It can’t seem to find my jsonrest file:

i placed it in: /home/ha/.homeassistant/custom_components/sensors


#45

How did you do this, what parts do you used for this modulus-zwave-mqtt?

Seeing something interesting at openhab, maybe some leads to use modes over tcp


#46

great link thanks.

i don’t read from the modbus, i read either directly from the solar edge Api, or have the values published via Mqtt (on my Hub that also reads the Modbus’s.)

heres a link on the Openhab forum about the Api:

if you want i can share my code on that, but i think it is several posts up in this thread already :wink:


#47

+1 on standard component. I am using the REST Sensor, which processes the json as well now.

The entity graph as well as the history graph are showing gaps and not “connected steps” if you know what I mean. I figured out that by hovering over the data points in the graph, that some data points (10%) are shown as floats like 2534.36353476243 and the others are shown as integers (e.g. 2534). I can’t figure out why and think it is a bug.

First I tried only the REST Sensor, which looked like this:

- platform: rest
  name: SolarEdge
  scan_interval: 900
  json_attributes: 
    - overview
  value_template: '{{ value_json.overview.currentPower.power | int }}'
  unit_of_measurement: 'W'
  resource: !secret solaredgeportal

Then I added a template sensor, but exactly the same problem.

- platform: template
  sensors:
    solar_power_w:
      friendly_name: 'Solar Power W'
      value_template: '{{ states("sensor.solaredge") | int }}'
      unit_of_measurement: 'W'

32%20PM

Anyone else seeing this?


#48

this is what I see:
json-rest senro
55

another graph showing the same info from my meters directly
09

maybe you can adjust your scan_interval settings?


#49

Looks like you are having gaps as well.
Changing scan interval is not possible (rate limited rest service :frowning: and update frequency of solaredge power is 15mins anyway). Thanks for reply


#50

Just a quick update.
I’m digging into modbus over tcp (yeah, that’s right!!) option available in my inverter; this should solve all the update time interval issues. Will post back with a detailed guide, as soon as I master the modbus power :wink:


#51

thanks, I like that!


#52

Looking forward to it!


#53

Keen for this!


#54

On the dutch website tweakers there is a topic on how to make your own monitoring portal for solaredge. I was wondering a similar setup is possible for the home assistant. I’m definitely lacking the the program skills to set this up.

The site is all in dutch, so I will give a short recap of the opening topic. The complete topic is a bit too long (~800 posts).
What the TS found out is that the first 2 day your solar edge inverter is connected to the internet, it communicates unencrypted with Solaredge server. Solare edge will send an encryption key to the inverter in this period. The good news is that this process can been intercepted. When you have this encryption key, you can use it to, the nice thing is that in this way you can gather more parameter as you can do by using the the API from Solar edge. You can for example also gather the temperature of the optimizers. As far as I understood this data is not supplied via the API or on the monitoring portal.

Now there is a catch to this off course. If you miss the encryption key there is no way you can listen in when the data is already encrypted. You can however perform a factory reset and start from scratch again, the downside is that all current data is lost as well. Or a 2nd option is to retrieve the key via a script + RS232 connection.

Here is the topic: https://gathering.tweakers.net/forum/list_messages/1721977

Since my programming skills are too limited to do something useful with this in home assistant, however I can help out translating stuff if needed.


#55

After some digging I got this to work via the rest sensor (not using jsonrest):

  - platform: rest              
    name: solaredge_overview                                      
    scan_interval: 300          
    json_attributes:            
      - overview                                                     
    value_template: '{{ value_json.overview }}'
    resource: !secret solaredge_url            
  - platform: template                         
    sensors:                                                                         
      solaredge_currentpower:                  
        friendly_name: 'SolarEdge Current Power Production'
        value_template: '{{ states.sensor.solaredge_overview.attributes.overview.currentPower.power | float | round(2) }}'
        unit_of_measurement: 'W'                                                                                          
      solaredge_lastdayenergy:                                                                                            
        friendly_name: 'SolarEdge Last Day Energy Production'                                                             
        value_template: '{{ states.sensor.solaredge_overview.attributes.overview.lastDayData.energy | float | round(2) }}'
        unit_of_measurement: 'Wh'                                                                                         
      solaredge_lastmonthenergy:                                                                                          
        friendly_name: 'SolarEdge Last Month Energy Production'                                                           
        value_template: '{{ (states.sensor.solaredge_overview.attributes.overview.lastMonthData.energy | float / 1000) | round(2) }}'
        unit_of_measurement: 'kWh'                                                                                                   
      solaredge_lastyearenergy:                                                                                                      
        friendly_name: 'SolarEdge Last Year Energy Production'                                                                       
        value_template: '{{ (states.sensor.solaredge_overview.attributes.overview.lastYearData.energy | float / 1000) | round(2) }}' 
        unit_of_measurement: 'kWh'                                                                                                   
      solaredge_lifetimeenergy:                                                                                                      
        friendly_name: 'SolarEdge Life Energy Production'                                                                            
        value_template: '{{ (states.sensor.solaredge_overview.attributes.overview.lifeTimeData.energy | float / 1000) | round(2) }}' 
        unit_of_measurement: 'kWh'                            

The only thing I still want to do is add a sensor that calculates the Wh out of the current power - but I’m still pondering how that will work with HA.


#56

any news about this? need help with testing?


#57

Hello all. I just implemented this last night with the rest service call.

I’m getting the following error in my logs everytime it runs

2018-06-05 09:38:57 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved                                                                     
Traceback (most recent call last):                                                                                                                                                  
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 287, in async_update_ha_state                                                                       
    self.entity_id, state, attr, self.force_update)                                                                                                                                 
  File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 743, in async_set                                                                                             
    state = State(entity_id, new_state, attributes, last_changed)                                                                                                                   
  File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 538, in __init__                                                                                              
    "State max length is 255 characters.").format(entity_id))                                                                                                                       
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.solaredge_overview. State max length is 255 characters.

My URL is good as I currently have a device type in smartthings for this doing essentially the same thing but since I’m working on moving over to HA felt it was time to get SolarEdge up and running within HA.

Thanks for the assistance.


#58

this is a known error for states longer than 255 characters.
You have 2 options:

  • either template it further down to fewer content (see @devilkin 's post above)
  • use custom state card state-card-text, to show all text, but only text.

#59

Yeah actually @devilkin post is who I copied the code from

this is what my current output looks like

{"overview":{"lastUpdateTime":"2018-06-05 15:54:18","lifeTimeData":{"energy":4.7078512E7,"revenue":4237.003},"lastYearData":{"energy":4407733.5},"lastMonthData":{"energy":220732.12},"lastDayData":{"energy":40404.473},"currentPower":{"power":1111.0},"measuredBy":"INVERTER"}}

I’m using the code from @devilkin that was posted above. Not sure what else I can really yank out of this to get it under the 255. Thank you @Mariusthvdb for the reply :slight_smile:


#60

you should create the separate template sensors to filter out the various values out of ‘overview’.

these are mine:

- platform: template
  sensors:
    solaredge_overview_last_updated:
      friendly_name: Last updated
      value_template: "{{ states.sensor.solaredge_overview.attributes.overview.lastUpdateTime | timestamp_custom ('%H:%M') }}"
    solaredge_overview_lifetime:
      friendly_name: Lifetime
      value_template: '{{ (states.sensor.solaredge_overview.attributes.overview.lifeTimeData.energy | float / 1000000) | round(2) }}'
      unit_of_measurement: 'MWh'
    solaredge_overview_last_year:
      friendly_name: Last year
      value_template: '{{ (states.sensor.solaredge_overview.attributes.overview.lastYearData.energy | float / 1000) | round(1) }}'
      unit_of_measurement: 'kWh'
    solaredge_overview_last_month:
      friendly_name: Last month
      value_template: '{{ (states.sensor.solaredge_overview.attributes.overview.lastMonthData.energy | float / 1000) | round(1) }}'
      unit_of_measurement: 'kWh'
    solaredge_overview_last_day:
      friendly_name: Last day
      value_template: '{{ (states.sensor.solaredge_overview.attributes.overview.lastDayData.energy | float / 1000) | round(1) }}'
      unit_of_measurement: 'kWh'
    solaredge_overview_current_power:
      friendly_name: Current power
      value_template: '{{ (states.sensor.solaredge_overview.attributes.overview.currentPower.power | float / 1000) | round(2) }}'
      unit_of_measurement: 'kW'

you can probably do the same for ‘inventory’

- platform: jsonrest
  resource: !secret se_inventory_resource
  method: GET
  name: SolarEdge Inventory
  scan_interval: 3600



solaredge_inventory_name:
  friendly_name: Name
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].name}}'
solaredge_inventory_manufacturer:
  friendly_name: Mnf
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].manufacturer}}'
solaredge_inventory_model:
  friendly_name: Model
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].model}}'
solaredge_inventory_communication:
  friendly_name: Comm
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].communicationMethod}}'
solaredge_inventory_dsp1:
  friendly_name: Dsp1
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].dsp1Version}}'
solaredge_inventory_dsp2:
  friendly_name: Dsp2
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].dsp2Version}}'
solaredge_inventory_cpu:
  friendly_name: Cpu
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].cpuVersion}}'
solaredge_inventory_sn:
  friendly_name: Sn
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].SN}}'
solaredge_inventory_optimizers:
  friendly_name: Opt
  value_template: '{{states.sensor.solaredge_inventory.attributes.Inventory.inverters[0].connectedOptimizers}}'