I have the same usecase, but I cannot seem to make it work.
I’m trying to pull the data like this
rest:
- authentication: basic
scan_interval: 90
resource: https://api.awattar.de/v1/marketdata
sensor:
- name: "Spotpreise"
json_attributes_path: '$'
value_template: "OK"
json_attributes:
- data
the url delivers a JSON much like the one of the OP:
{
"object": "list",
"data": [
{
"start_timestamp": 1676394000000,
"end_timestamp": 1676397600000,
"marketprice": 199.99,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676397600000,
"end_timestamp": 1676401200000,
"marketprice": 192.97,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676401200000,
"end_timestamp": 1676404800000,
"marketprice": 175.81,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676404800000,
"end_timestamp": 1676408400000,
"marketprice": 160.09,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676408400000,
"end_timestamp": 1676412000000,
"marketprice": 151.03,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676412000000,
"end_timestamp": 1676415600000,
"marketprice": 141.73,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676415600000,
"end_timestamp": 1676419200000,
"marketprice": 134.81,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676419200000,
"end_timestamp": 1676422800000,
"marketprice": 130.95,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676422800000,
"end_timestamp": 1676426400000,
"marketprice": 130,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676426400000,
"end_timestamp": 1676430000000,
"marketprice": 130.01,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676430000000,
"end_timestamp": 1676433600000,
"marketprice": 126.66,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676433600000,
"end_timestamp": 1676437200000,
"marketprice": 136.53,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676437200000,
"end_timestamp": 1676440800000,
"marketprice": 161.2,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676440800000,
"end_timestamp": 1676444400000,
"marketprice": 185,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676444400000,
"end_timestamp": 1676448000000,
"marketprice": 188.76,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676448000000,
"end_timestamp": 1676451600000,
"marketprice": 171.22,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676451600000,
"end_timestamp": 1676455200000,
"marketprice": 152.52,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676455200000,
"end_timestamp": 1676458800000,
"marketprice": 132.16,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676458800000,
"end_timestamp": 1676462400000,
"marketprice": 120.79,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676462400000,
"end_timestamp": 1676466000000,
"marketprice": 121.45,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676466000000,
"end_timestamp": 1676469600000,
"marketprice": 121.38,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676469600000,
"end_timestamp": 1676473200000,
"marketprice": 128.71,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676473200000,
"end_timestamp": 1676476800000,
"marketprice": 144.99,
"unit": "Eur/MWh"
},
{
"start_timestamp": 1676476800000,
"end_timestamp": 1676480400000,
"marketprice": 158.8,
"unit": "Eur/MWh"
}
],
"url": "/de/v1/marketdata"
}
but it doesn’t work.
no matter what configuration i try i get the same log entry:
Logger: homeassistant.components.rest.sensor
Source: components/rest/sensor.py:170
Integration: RESTful (documentation, issues)
First occurred: 17:53:56 (35 occurrences)
Last logged: 18:45:16
JSON result was not a dictionary or list with 0th element a dictionary
has anyone an idea?
Any help is appreciated!