Tibber API (Swedish/Norweigan electric company)

Posted on
Thu Dec 06, 2018 2:15 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Tibber API (Swedish/Norweigan electric company)

Thanks for all the help GlennNZ!!

I want to add live subscription (watt, ampere, volt), I have tried this, but it dosent work.

-d '{ "query": "{viewer {homes {LiveMeasurement {power }}}}}}" }'
Attachments
Skjermbilde 2018-12-06 kl. 21.10.29.png
Skjermbilde 2018-12-06 kl. 21.10.29.png (71.78 KiB) Viewed 4176 times

Posted on
Thu Dec 06, 2018 3:20 pm
GlennNZ offline
User avatar
Posts: 1555
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Tibber API (Swedish/Norweigan electric company)

Glad it is working

Sorry not an expert on the tibber api and the plugin is probably not the best place to test new curl commands.

Would suggest you do that within a terminal window - start as per the tibber api documentation and get it working,
Code: Select all
curl \
-H "Authorization: Bearer d1007ead2dc84a2b82f0de19451c5fb22112f7ae11d19bf2bedb224a003ff74a" \
-H "Content-Type: application/json" \
-X POST \
-d  'mutation{ sendMeterReading(input:{homeId:"some home id", reading: 123}){time reading  }}'



Then copy and paste to within the GhostXML plugin to get easily into Indigo.

At a quick quess though I would wonder whether you have to many ending curly brackets
Code: Select all
-d '{ "query": "{viewer {homes {LiveMeasurement {power }}}}" }'

Might be better - although I haven't tested.

G

Posted on
Thu Dec 06, 2018 4:11 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Tibber API (Swedish/Norweigan electric company)

Have tried many different methods now, but I can't get it to work. Should it be a "query"? Remove query and write subscription or mutation?

-H "Authorization: Bearer <..........>" \
-H "Content-Type: application/json" \
-X POST \
-d '{ "query": "subscription{liveMeasurement(homeId:"HOMEID"){power timestamp}}" }'

Posted on
Thu Dec 06, 2018 4:20 pm
GlennNZ offline
User avatar
Posts: 1555
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Tibber API (Swedish/Norweigan electric company)

Depends on what tibber api wants.
The tibber documentation does suggest just subscription - although will need quotes added

Although does mention that this is a websocket persistent connection - so probably not likely to be successful with a single curl call....

Probably best to use the query calls and alter as needed to get hopefully the data you need.

G

Posted on
Mon Dec 17, 2018 8:04 pm
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Tibber API (Swedish/Norweigan electric company)

Thanks to Glenn's fine work, there is now an "official" release of the raw curl feature.

You can find more information on the GhostXML releases forum.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Dec 23, 2018 1:48 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Tibber API (Swedish/Norweigan electric company)

Thanks for all the help. But i cant get it to work. Anyone who can help me on the way?

Posted on
Sun Dec 23, 2018 2:53 pm
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Tibber API (Swedish/Norweigan electric company)

Create a new GhostXML device.

Feed Type: JSON
URL/Feed Path: https://api.tibber.com/v1-beta/gql

Method: Raw Curl (advanced)
Curl Commands:
Code: Select all
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-X POST \
-d '{ "query": "{viewer {homes {consumption(resolution: HOURLY, last: 1) {nodes {from to totalCost unitCost unitPrice unitPriceVAT consumption consumptionUnit }} meteringPointData {estimatedAnnualConsumption } currentSubscription {priceInfo {current {total energy tax startsAt }}}}}}" }'

Replace TOKEN with your API key and then copy and paste the above commands directly into the curl commands box.

That should work. If it doesn't work, I'm guessing that there's something not quite right with your API access settings. The above works perfectly well for me.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Dec 23, 2018 3:24 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Tibber API (Swedish/Norweigan electric company)

Thanks. But im trying to receive live measurement from the api. Prices is no problem. I want to receive watt, ampere and voltage

Posted on
Sun Dec 23, 2018 3:33 pm
DaveL17 offline
User avatar
Posts: 6741
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Tibber API (Swedish/Norweigan electric company)

mortenkols wrote:
Thanks. But im trying to receive live measurement from the api. Prices is no problem. I want to receive watt, ampere and voltage

Apologies, I misunderstood. I don't have access to the API, so I'm unable to help further.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Sun Dec 23, 2018 3:37 pm
mortenkols offline
Posts: 198
Joined: Oct 29, 2014
Location: Norway

Re: Tibber API (Swedish/Norweigan electric company)

No problem. Here is the link to the documentation for the api.
https://developer.tibber.com/docs/guides/calling-api

Who is online

Users browsing this forum: No registered users and 1 guest