Live feed

Posted on
Thu Oct 27, 2022 4:43 pm
haakon offline
User avatar
Posts: 45
Joined: Mar 02, 2017

Live feed

Thank you for a great plugin!

I am using it to fetch data from Tibber, a Scandinavian power company. Their API can provide historical as well as live data. I can get the former to work with GhostXML, not the latter. It it possible to get live data using GhostXML? (I'm a newbie when it comes to coding, so please excuse me if the question is poorly worded.)

By using a raw curl string I am able to get this to work:

Code: Select all
curl \
-H "Authorization: Bearer 96a14971-525a-4420-aae9-e5aedaa129ff" \
-H "Content-Type: application/json" \
-X POST \
-d  '{ "query": "{  viewer {    homes {      consumption(resolution: HOURLY, last: 12) {        nodes {          from          to          cost          unitPrice           consumption        }      }          }  }}" }'


When I try to replace the query with the following (that works well in Tibbers API explorer), I get a syntax error from GhostXML. (I keep the line breaks for readability:)

Code: Select all
subscription{
  liveMeasurement(homeId:"96a14971-525a-4420-aae9-e5aedaa129ff"){
    timestamp
    power
    accumulatedConsumption
    accumulatedCost
    currency
    minPower
    averagePower
    maxPower
  }
}


So is it possible to get a subscription query like this to work? If that is the case, how should it be input?

Posted on
Thu Oct 27, 2022 5:21 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Live feed

Glad you're finding the plugin useful. Are you using the raw curl method? That should work with the API call. There's an example to follow in the plugin documentation.

Screen Shot 2022-10-27 at 6.15.53 PM-2.png
Screen Shot 2022-10-27 at 6.15.53 PM-2.png (211.31 KiB) Viewed 2621 times

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

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest