Hello
I`m trying to figure out if it is possible to integrate a "code device" in zway, from the Tibber API to tell real time power prices.
https://developer.tibber.com/docs/guides/calling-api
I first tried out the "HTTP device", but I couldn`t figure out if it is possible to authorize with a Token instead of basic autorization, so I tried out the "code device" app.
So far I have not managed to get it working because of lakk of programming skills.
I have tested the API with the demo-token in the program "Postman", and get out the numbers I want as a JSON-object. Postman can convert code to a lot of languages, and I have been trying different versions of javascript in the app.
I can see that the "Code device" app specifies the returning value to be a number. Since the Tibber server-response is an JSON object I maybe have to extract the number of interest from the code in a sort of way???
Anyone with programming skills that could help me out with this code?
This is the query of interest:
{ "query": "{viewer {homes {currentSubscription {priceInfo {current {total }}}}}}" }
And this is the return:
{"data":{"viewer":{"homes":[{"currentSubscription":null},{"currentSubscription":{"priceInfo":{"current":{"total":0.5734}}}}]}}}
I want that 0.5734 to be my sensorvalue..
Tibber API communication
Re: Tibber API communication
Found a workaround to make a device showing live price with the JSON vdev Creator.
The only problem now is that the z-way interface is showing only one decimal precison for the value.
I would like to have 2 decimals for this virtual device. Is it possible to change this somehow?
The only problem now is that the z-way interface is showing only one decimal precison for the value.
I would like to have 2 decimals for this virtual device. Is it possible to change this somehow?
Re: Tibber API communication
You can modify the UI. It is the UI doing it
Re: Tibber API communication
Is it a setting in UI?
Or do you know which file I have to take a look into to modifie this code?
Or do you know which file I have to take a look into to modifie this code?
Re: Tibber API communication
Found another solution parsing the value of interest with jq from the json to another file multiplying it with 100 before collecting it into zway.