I am trying to retrieve data from my solar panels with a RESTful sensor. I want to show the montly production from the past year in a graph.
The api gave me these results:
{
"energy": {
"timeUnit": "MONTH",
"unit": "Wh",
"measuredBy": "INVERTER",
"values": [
{
"date": "2020-01-01 00:00:00",
"value": 77742.0
}, {
"date": "2020-02-01 00:00:00",
"value": 149768.0
}, {
"date": "2020-03-01 00:00:00",
"value": 462802.0
}, {
"date": "2020-04-01 00:00:00",
"value": 679417.0
}, {
"date": "2020-05-01 00:00:00",
"value": 792385.0
}, {
"date": "2020-06-01 00:00:00",
"value": 727016.0
}, {
"date": "2020-07-01 00:00:00",
"value": 613442.0
}, {
"date": "2020-08-01 00:00:00",
"value": 576991.0
}, {
"date": "2020-09-01 00:00:00",
"value": 470422.0
}, {
"date": "2020-10-01 00:00:00",
"value": 148939.0
}, {
"date": "2020-11-01 00:00:00",
"value": null
}, {
"date": "2020-12-01 00:00:00",
"value": null
}
]
}
}
And this is the configuration i use:
- platform: rest
name: solaredge_data
resource: https://<URL>
- platform: template
sensors:
production_per_month:
value_template: '{{ states.sensor.solaredge_data.attributes["energy"]["values"] }}'
unit_of_measurement: 'Wh'
I have spent several hours to get it to work and from the documentation I can’t figure out how to do it. Any help would be appreciated