Which hass version are you using? If I’m not wrong, this code requires > 0.57.1.
Just to be 100% sure, here’s a direct copy paste of my jsonrest.py https://pastebin.com/AsV7FCA1
Try to first load the custom component and check for any errors, then start fiddling with config.
I can confirm it is still working properly on 0.59.1 (Hassio).
Anybody interested in having last day, month, year, lifetime as well?
Coulant get the jsonrest to show anything else but the On
Now if we could get the separate ThreePhaseInverter telemetry i posted above to show up, the would be way cool.
On the other hand, I’ve noticed that reading these through Mqtt provides live continous figures, opposed to the timed SolarEdge Api figures. Nice to have, but not as insightful. Ill keep them just in case its easier to use in future construction of automations. How do you use them?
And if you get the Jsonrest data to work please do post, maybe thats even better.
Cheers,
Marius
Not sure if it matters, but here’s my complete workflow to make this work (given that jsonrest is correcly installed)
I’ve added the jsonrest sensor under sensor in config and rebooted hass (with no errors). I then checked that the sensor was indeed working
Then I’ve added the template sensors, rebooted, created group and voilà (still working on rounding issues )
If jsonrest is correcly loaded and you see output from that json call, it should just work Just check you’re not changing any sensor name, as you’d have to change the templates, too!
EDIT@Mariusthvdb
Almost forgot! As for the 3 phases monitoring, please tell me the api link you’re retrieving data from (just omit siteid and api)
and yes, the jsonrest sensor is created fine, as it shows On proving there is connection
maybe you can have a look.
Also, what interest me even more, is whether we can get the current power. Dynamically and continuously updating. not the aggregated per day or other timeslot.
Thanks,
M
As promised and trying to be as simple as possible, here’s an updated version you can try out. V. 0.3
#*REQUIRES JSONREST CUSTOM COMPONENT
#**REQUIRES HOME ASSISTANT > 0.57.1
#***replace YOUR_SITE_ID and YOUR_API_KEY with yours
#We are creating two *jsonrest sensors* wich contain the whole JSON output, then we are going to extract data
#and put those data in other *template sensors*
###ACTUAL DATA --> contains what you are producing (and consuming if you've got an inverter module to do so) NOW
###AGGREGATED DATA ---> shows you these data aggregated by month, year, since beginning
###API LIMIT is 300 calls/day. Be sure the two calls do not exceed that. Time is in SECONDS. Example below is 240 calls/day.
#V. 0.3: corrected decimal roundings bug
sensor:
######### ACTUAL DATA ##########
- platform: jsonrest
resource: https://monitoringapi.solaredge.com/site/YOUR_SITE_ID/currentPowerFlow.json?api_key=YOUR_API_KEY
method: GET
name: SolarEdge jsonrest
scan_interval: 400
- platform: template
sensors:
grid_consuming_now:
value_template: '{{ states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["LOAD"].currentPower }}'
unit_of_measurement: 'kW'
grid_producing_now:
value_template: '{{ states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["PV"].currentPower }}'
unit_of_measurement: 'kW'
grid_available_now:
value_template: '{{ (states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["PV"].currentPower - states.sensor.solaredge_jsonrest.attributes.siteCurrentPowerFlow["LOAD"].currentPower | float) | round(2) }}'
unit_of_measurement: 'kW'
######### AGGREGATED DATA ##########
- platform: jsonrest
resource: https://monitoringapi.solaredge.com/site/YOUR_SITE_ID/overview.json?api_key=YOUR_API_KEY
method: GET
name: SolarEdge jsonrest_storic
scan_interval: 3600
- platform: template
sensors:
grid_last_updated:
value_template: '{{ states.sensor.solaredge_jsonrest_storic.attributes.overview.lastUpdateTime }}'
grid_lifetime:
value_template: '{{ (states.sensor.solaredge_jsonrest_storic.attributes.overview.lifeTimeData.energy | float / 1000000) | round(2) }}'
unit_of_measurement: 'MWh'
grid_this_year:
value_template: '{{ (states.sensor.solaredge_jsonrest_storic.attributes.overview.lastYearData.energy | float / 1000) | round(1) }}'
unit_of_measurement: 'kWh'
grid_this_month:
value_template: '{{ (states.sensor.solaredge_jsonrest_storic.attributes.overview.lastMonthData.energy | float / 1000) | round(1) }}'
unit_of_measurement: 'kWh'
grid_today:
value_template: '{{ (states.sensor.solaredge_jsonrest_storic.attributes.overview.lastDayData.energy | float / 1000) | round(1) }}'
unit_of_measurement: 'kWh'
##################################################
#It's a nice idea to save some db space and exclude the main two sensors logging (since we already have those data available
#as extracted template sensors)
measuring the panels, through my hub connected ModBUs over Mqtt (zonnepanelen), api calls and your jsonrest definitions.
Too bad the current flow isn’t possible in my setup.
Not sure if the api calls aren’t better given the max calls/day with the jsonrest .
Thanks! I use the latest hass version 0.59.2. Updated the jsonrest.py with the fresh download you offered.
I also checked that the url https://monitoringapi.solaredge.com/site//currentPowerFlow.json?api_key= (wich returns correct data, and now I see the indicators at the homescreen, but with no data in it. Then I checked the log, where I found these:
Could not render template grid_today: UndefinedError: ‘mappingproxy object’ has no attribute ‘overview’
22:42 components/sensor/template.py (ERROR)
Could not render template grid_production: UndefinedError: ‘dict object’ has no attribute ‘PV’
22:13 components/sensor/template.py (ERROR)
Could not render template grid_available: UndefinedError: ‘dict object’ has no attribute ‘PV’
22:13 components/sensor/template.py (ERROR)
Could not render template grid_consumption: UndefinedError: ‘dict object’ has no attribute ‘LOAD’
22:13 components/sensor/template.py (ERROR)
it means the definitions are not valid for your setup, as in mine.
the combination of the object and attribute is not valid. check above in my screenshots, they will be similar?
Nope. I do not get the display items on the homescreen. Just the circles on top. When I look in the states overviews (< >) I see:
sensor.grid_available_now unknown unit_of_measurement: kW
friendly_name: grid_available_now
sensor.grid_consuming_now unknown unit_of_measurement: kW
friendly_name: grid_consuming_now
sensor.grid_last_updated unknown friendly_name: grid_last_updated
sensor.grid_lifetime unknown unit_of_measurement: MWh
friendly_name: grid_lifetime
sensor.grid_producing_now unknown unit_of_measurement: kW
friendly_name: grid_producing_now
sensor.grid_this_month unknown unit_of_measurement: kWh
friendly_name: grid_this_month
sensor.grid_this_year unknown unit_of_measurement: kWh
friendly_name: grid_this_year
sensor.grid_today unknown unit_of_measurement: kWh
friendly_name: grid_today
Sorry for my noobiness, but how can I define the object and attribute?
ive grouped the individual sensors (circles, called badges…) in a group SolarEdge Json, just so its easy to compare them with my already setup other sensors (also in a group)
you should at least be able to have the overview items, the producing now items are depending on your setup of extra hardware (measuring and outputting actual data)
same here,
you probably don’t have the piece of hardware required to be installed in or alongside the inverter for measuring the current power flow (by which i think is meant the own use of the delivered solar-power).
i read that from an attached modbus, and that gives me all current actual energy data, opposed to the limited api calls or jsonrest calls in the above setting.
HI,
yes i have that too, working fine.
Sometimes i get an over-quota error message, but can’t trace it for 100% certainty to the Solaredge.
DO you have any other sensors? there are many more options, but the ones i need most are with login credentials that wont be configured like above, and give unauthorized errors.
Most of all, i would like to have the separate Phase ( i have a 3 phase installation) sensors.
see below for a try to get that, maybe you can find the error, of make it work?
the above works fine in a browser, and gives the full telemetry ea.
of course we can’t create a sensor with the hard coded date-range like this, so im looking for a way to have that created automatically and dynamically based on the current timestamp. Or maybe with an input selector?
Would you have suggestions doing so?
Ive asked the community template-wizards for help Dynamically create sensor based on current time?