Thanks so much for the code, unfortunately I spend way too many hours trying to make it work (each restart take times), but the entity always stay at “Unknown”
I did add the code in configuration.yaml, like so
sensor:
- platform: rest
unique_id: tibber_prices
name: Tibber Prices
resource: https://api.tibber.com/v1-beta/gql
method: POST
payload: ‘{ “query”: “{ viewer { homes { currentSubscription { status priceInfo { current { total level } today { total level } tomorrow { total level } } } } } }” }’
json_attributes_path: “$.data.viewer.homes[0].currentSubscription.priceInfo”
json_attributes:
- today
- tomorrow
value_template: “{{ value_json.data.viewer.homes[0].currentSubscription.priceInfo.current.total | float }}”
scan_interval: 30
headers:
Authorization: !secret tibber_token
Content-Type: application/json
User-Agent: REST
unit_of_measurement: EUR/kWh
and I did add the tibber_token: in secrets.yaml
In the logs I have:
Logger: homeassistant.components.rest.data
Source: components/rest/data.py:114
integration: RESTful (documentation, issues)
First occurred: 6 May 2025 at 20:16:53 (7 occurrences)
Last logged: 08:15:53
Timeout while fetching data: https://api.tibber.com/v1-beta/gql
Logger: homeassistant.components.rest.util
Source: components/rest/util.py:18
integration: RESTful (documentation, issues)
First occurred: 6 May 2025 at 20:16:53 (7 occurrences)
Last logged: 08:15:53
Empty reply found when expecting JSON data
Logger: homeassistant.components.rest.util
Source: components/rest/util.py:37
integration: RESTful (documentation, issues)
First occurred: 6 May 2025 at 15:51:41 (253 occurrences)
Last logged: 10:44:43
REST result could not be parsed as JSON
Logger: homeassistant.components.rest.util
Source: components/rest/util.py:33
integration: RESTful (documentation, issues)
First occurred: 6 May 2025 at 15:51:41 (6727 occurrences)
Last logged: 11:15:43
JSON result was not a dictionary or list with 0th element a dictionary
This tibber code is the only thing in my HA trying to use rest.
Otherwise the official Tibber integration is working and fetching the data, I could even successfully get manually the forecast with the action tibber.get_prices
Could someone please help? It would be so amazing and saving me money, if I could have the forecast in HA