Tibber API - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Tibber API (/showthread.php?tid=2185) |
Tibber API - Jørn - 06.08.2019 I have been trying to pull some data like power consumption and prices. Limited Lua/json scripting skills have brought it to a stop, can anybody help`? API Guide https://developer.tibber.com/docs/guides/calling-api RE: Tibber API - admin - 12.08.2019 Change token and data query as needed: Code: https = require('ssl.https') RE: Tibber API - Jørn - 12.08.2019 Superb! But i get "nesting too deep" before all data is retrieved, is this issue on Tibber side or LM `? Code: * table: RE: Tibber API - admin - 12.08.2019 There's a limit of how deep the table can be for log() function, try this: Code: log(resp.data.viewer.homes) RE: Tibber API - thomasoppida - 14.08.2019 Hi, How de we retrieve a value from table within table here, and write this to a group address? grp.write('32/1/16', 'tbl[1][1][1][1][4][1]')? kind regards thomas RE: Tibber API - admin - 14.08.2019 Depends, can you show log output for this table? RE: Tibber API - thomasoppida - 14.08.2019 RE: Tibber API - admin - 15.08.2019 Code: homes = resp.data.viewer.homes RE: Tibber API - thomasoppida - 16.08.2019 That worked :-) Thank you again :-) RE: Tibber API - eirik - 28.11.2019 Hi I've been testing this for a while, and get all the readings from viewer, homes, currentSubscriptions and so on. But the liveMeasurement I can't really figure out. Have anyone got this to work? Eirik RE: Tibber API - stemic01 - 07.02.2020 Very interesting. Anyone who knows how to also integrate the current Power consumption and data from the TIBBER PULSE ? Would be great With some help. RE: Tibber API - stemic01 - 01.03.2020 I would really like to get the live consumption "REAL TIME SUBSCRIPTION" data for visualization and making trends. https://developer.tibber.com/Explorer (Demo token / Real time Consumption) Would be deeply greatfull if any of you LUA specialists were able to help me retrieve this data and for example Write it to a Group address I could call in my Dashboard Interface. Here is the "code" from the Tibber API. How to get this into something usefull in LUA? subscription{ liveMeasurement(homeId:"xxxxxxxxxxxxxxxxxxxxx"){ timestamp power accumulatedConsumption accumulatedCost currency minPower averagePower maxPower } } RE: Tibber API - stemic01 - 31.03.2020 I try to boost this thread again. Any takers? RE: Tibber API - admin - 01.04.2020 Use this websocket client library: https://forum.logicmachine.net/showthread.php?tid=1294&pid=7823#pid7823 Create a user library named websocket and add this line after 'Connection: Upgrade', (line 289): Code: 'Sec-WebSocket-Protocol: graphql-ws', Example resident script, sleep time = 0, change token and homeId as needed: Code: if not client then RE: Tibber API - Jørn - 03.04.2020 Works great But, how to pull data from the table to i.e. to a grp.write`? RE: Tibber API - Erwin van der Zwart - 04.04.2020 Hi, At line 51 (log data) your need to add your code, look at the data table and select the value you want to send to KNX, i don't know the content of the data fields but something like: Code: -- log(data) Erwin RE: Tibber API - Jørn - 04.04.2020 (04.04.2020, 07:23)Erwin van der Zwart Wrote: Hi, I've tried different combinations of this with no luck. I.e. data.power is nil. The "data" table looks like this Code: Tibber websocket 04.04.2020 15:53:26 RE: Tibber API - admin - 04.04.2020 Try data.payload.data.liveMeasurement.power RE: Tibber API - Jørn - 04.04.2020 That worked ;o) But sometimes report error attempt to index field 'payload' (a nil value) stack traceback: why would this be`? RE: Tibber API - Erwin van der Zwart - 05.04.2020 Hi, You should check if the table content is valid before drilling down deeper... Code: if data then Erwin |