I have this query from Tibber Grapql :
{viewer {homes {production (resolution: MONTHLY, last:1 ) {nodes {profit unitPrice production }}}}}
It produces the correct output like:
{
"data": {
"viewer": {
"homes": [
{
"production": {
"nodes": [
{
"profit": 340.66446335,
"unitPrice": 1.555972,
"production": 218.94
}
]
}
}
]
}
}
}
I now try to do the same from Home Assitant using rest:
- platform: rest
name: Tibber Production per hour
unique_id: tibber_production_per_hour
resource: https://api.tibber.com/v1-beta/gql
method: POST
payload: '{ "query": "{viewer {homes {production (resolution: MONTHLY, last:1 ) {nodes {profit unitPrice production }}}}}" }'
json_attributes_path: "$.data.viewer.homes[0].production"
json_attributes:
- profit
- unitPrice
value_template: "{{ value_json.data.viewer.homes[0].production.nodes.production | float }}"
scan_interval: "01:00:00"
headers:
Authorization: !secret tibber_token
Content-Type: application/json
User-Agent: REST
unit_of_measurement: SEK/kWh
This does however not work. I got it to work for prices and cost but totally fail to se what type of error I am doing with the production figures. If anyone can point me in the right direction I would really appreciate it.