Page 2 of 2

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Thu Dec 06, 2018 2:15 pm
by mortenkols
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 }}}}}}" }'

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Thu Dec 06, 2018 3:20 pm
by GlennNZ
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

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Thu Dec 06, 2018 4:11 pm
by mortenkols
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}}" }'

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Thu Dec 06, 2018 4:20 pm
by GlennNZ
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

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Mon Dec 17, 2018 8:04 pm
by DaveL17
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.

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Sun Dec 23, 2018 1:48 pm
by mortenkols
Thanks for all the help. But i cant get it to work. Anyone who can help me on the way?

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Sun Dec 23, 2018 2:53 pm
by DaveL17
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.

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Sun Dec 23, 2018 3:24 pm
by mortenkols
Thanks. But im trying to receive live measurement from the api. Prices is no problem. I want to receive watt, ampere and voltage

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Sun Dec 23, 2018 3:33 pm
by DaveL17
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.

Re: Tibber API (Swedish/Norweigan electric company)

PostPosted: Sun Dec 23, 2018 3:37 pm
by mortenkols
No problem. Here is the link to the documentation for the api.
https://developer.tibber.com/docs/guides/calling-api