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
+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:
Looks like you are having gaps as well.
Changing scan interval is not possible (rate limited rest service and update frequency of solaredge power is 15mins anyway). Thanks for reply
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
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.
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.
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.
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