Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 3

SmartHomeEddy

Question

This QuickApp gets your energy consumption and production data from Tibber Live. 
This QuickApp can be used in combination with the Tibber Monitor to get the Tibber Prices. 
Based on the Fibaro WebSockets/GraphQL demo by Peter Gebruers 

 

If you use Tibber for your Energy Panel, you can use this Tibber Live QuickApp for your energy consumption and production combined with the Tibber Monitor QuickApp to provide the Energy Panel with the hourly prices. 

 

Please login or register to see this image.

/monthly_2022_08/image.png.e02b5123ae5e74aa18c67a4d49af38b8.png" />

 

 

Main device with positive or negative actual power consumption

 

Child devices are available for:

  • power (Actual consumption with maxPower in log text)
  • powerProduction (Actual production with maxPowerProduction in log text)
  • accumulatedConsumption (Todays consumption, also the child device for the Energy Panel)
  • accumulatedProduction (Todays production)
  • accumulatedCost (Todays cost)
  • accumulatedConsumptionLastHour (Consumed since since last hour shift)
  • accumulatedProductionLastHour (Produced since last hour shift)
  • lastMeterConsumption (Total consumption)
  • lastMeterProduction (Total production)
  • voltagePhase1
  • voltagePhase2
  • voltagePhase3
  • currentL1
  • currentL2
  • currentL3

 

Please login or register to see this attachment.

 

Available information: 

  • power (Consumption at the moment (Watt))
  • maxPower (Peak consumption since midnight (Watt))
  • powerProduction (Net production (A-) at the moment (Watt))
  • maxPowerProduction (Max net production since midnight (Watt))
  • accumulatedConsumption (kWh consumed since midnight)
  • accumulatedProduction (net kWh produced since midnight)
  • accumulatedCost (Accumulated cost since midnight; requires active Tibber power deal)
  • currency (Currency of displayed cost; requires active Tibber power deal)
  • lastMeterConsumption (Last meter active import register state (kWh))
  • lastMeterProduction (Last meter active export register state (kWh))
  • voltagePhase1 (Voltage on phase 1) *
  • voltagePhase2 (Voltage on phase 2) *
  • voltagePhase3 (Voltage on phase 3) *
  • currentL1 (Current on L1) *
  • currentL2 (Current on L2) *
  • currentL3 (Current on L3) *
  • accumulatedConsumptionLastHour (kWh consumed since since last hour shift)
  • accumulatedProductionLastHour (net kWh produced since last hour shift)
  • accumulatedReward (Accumulated reward since midnight; requires active Tibber power deal)
  • minPower (Min consumption since midnight (Watt))
  • averagePower (Average consumption since midnight (Watt))
  • powerReactive (Reactive consumption (Q+) at the moment (kVAr)) *
  • powerProductionReactive (Net reactive production (Q-) at the moment (kVAr)) *
  • minPowerProduction (Min net production since midnight (Watt))
  • maxPowerProduction (Max net production since midnight (Watt))
  • powerFactor (Power factor (active power / apparent power)) *
  • signalStrength (Device signal strength (Pulse - dB; Watty - percent)) *
  • timestamp (Timestamp when usage occurred)

* on Kaifa and Aidon meters the value is not part of every HAN data frame therefore the value is null at timestamps with second value other than 0, 10, 20, 30, 40, 50. There can be other deviations based on concrete meter firmware. In this QuickApp "null" values are replaced by their previous values. 

 

To communicate with the API you need to acquire a OAuth access token and pass this along with every request passed to the server.
A Personal Access Token give you access to your data and your data only. 
This is ideal for DIY people that want to leverage the Tibber platform to extend the smartness of their home. 
Such a token can be acquired here:

Please login or register to see this link.

 

When creating your access token or OAuth client you’ll be asked which scopes you want the access token to be associated with. 
These scopes tells the API which data and operations the client is allowed to perform on the user’s behalf. 
The scopes your app requires depend on the type of data it is trying to request. 
If you for example need access to user information you add the USER scope. 
If information about the user's homes is needed you add the appropriate HOME scopes.
If you have more than one home in your subscription, you need to fill in your home number the change between your homes. 


If the Tibber server disconnects the webSocket, the QuickApp wil do a re-connect for the amount in the QuickApp variable reconnect. 
If the re-connect fails for that amount, there will be a timeout for the seconds in the QuickApp variable timeout. 

 

Use this QuickApp at your own risk. You are responsible for ensuring that the information provided via this QuickApp do not contain errors. 
Tibber is a registered trademark being the property of TIBBER. TIBBER reserves all rights to the registered trademarks.
Information which is published on TIBBER’s websites belongs to TIBBER or is used with the permission of the rights holder. 
Making of copies, presentations, distribution, display or any other transfer of the information on the website to the public is, except for strictly private use, prohibited unless done with the consent of TIBBER. 
Published material on dedicated TIBBER press websites, intended for public use, is exempt from the consent requirement.
Also see:

Please login or register to see this link.

 

Guide Communicating with the Tibber API:

Please login or register to see this link.


Tibber API Explorer:

Please login or register to see this link.


Tibber gitHub:

Please login or register to see this link.


Tibber SDK NET:

Please login or register to see this link.


Fibaro webSocket manual:

Please login or register to see this link.


Fibaro Forum - Headers in webSocket:

Please login or register to see this link.


WebSocket++ Documentation:

Please login or register to see this link.


GraphQL over WebSocket Protocol:

Please login or register to see this link.


GraphQL query language:

Please login or register to see this link.

 

Version 3.0 (8th March 2023)

  • Removed Tibber old Websocket code
  • Prepared, not enabled: Check home.features.realTimeConsumptionEnabled has a true value always before reconnecting
  • Prepared, not enabled: Added button to disconnect or re-connect the Tibber webSocket
  • Prepared: Added quickapp variable homeNr (most of the time 1) to be able to check the response realTimeConsumptionEnabled


Version 2.3 (beta 8th December 2022)

  • Improved the 60 seconds interval child devices update, it now never skips a beat
  • Added translation for English (en), Dutch (nl), Swedish (se), Norwegian (no)
  • Changed the json response for the debugLevel=4 Offline Simulation mode, the date/time format was wrong
  • Added random (jitter) reconnection handleDisconnected and handleError between 10 and 15 seconds
  • Added random (jitter) reconnection interval handleDisconnected and handleError plus between 1 and 10 seconds
  • Added exponential backoff (increasing delay) between each timeout. The increase is limited to 10 times the value in the quickapp reconnect variable. 

 

Version 2.2 (20th November 2022)

  • Changed to new Tibber webSocket requirements, required from December 2022

Version 2.1 (15th October 2022)

  • Child devices are now updated every (whole) minute to reduce CPU load
  • Replaced zero values for Voltage L1 L2 L3 with the previous value

Version 2.0 (5th August 2022)

  • Added two child devices, Hourly Consumption and Hourly Production
  • Added re-connect routine to handleError. If an Tibber error occurs, the QuickApp will try to re-connect. Thanks @JcBorgs for testing. 
  • Improved routine to handle Tibber null values. Thanks @Darquan for testing. 
  • Changed labels a bit to save some space
  • Changed "volt" and "amp" text in the labels. Thanks @Morten22 for mentioning. 
  • Changed kWh device types from com.fibaro.electricMeter to com.fibaro.energyMeter

Version 1.0 (19th June 2022)

  • Initial webSocket version Tibber Live
  • Thanks @JcBorgs for testing all beta versions and great suggestion to improve the quickapp
  • Based on the Fibaro WebSockets/GraphQL demo by @petergebruers


Variables (mandatory and created automatically): 

  • token = Authorization token (see the Tibber website: https://developer.tibber.com)

  • homeId = Tibber Home ID (see the Tibber website: https://developer.tibber.com)

  • homeNr = Tibber home (nodes) number if you have more than one home (default = 1)

  • language = Preferred language (default = en) (supported languages are English (en), Swedisch (se), Norwegian (no) and Dutch (nl))

  • reconnect = Amount of re-connects after disconnect from Tibber server (default = 10)

  • timeout = Pause after maximum amount of re-connects (default = 300 seconds)

  • debugLevel = Number (1=some, 2=few, 3=all, 4=Offline Simulation Mode, 5=Live Test Mode) (default = 1)

 

Fibaro Firmware:

Minimal version 5.111.48 (beta)

 

Download the QuickApp here (download the file and un-zip):

Please login or register to see this link.

or from the Fibaro Marketplace:

Please login or register to see this link.


How to install: 

  1. Open the Configuration Interface
  2. Go to Settings > Devices
  3. Click  +
  4. Choose Other Device
  5. Choose Upload File
  6. Choose file from your computer with .fqa

 

 

 

 

 

Edited by SmartHomeEddy
  • Like 4
  • Thanks 4
Link to comment
Share on other sites

Recommended Posts

  • 0

The idea or point is that the energy panel summarizes the consumption measured on individual devices around your house with great detail. With energy metering installed on all power consuming devices this should then match the Tibber total values. In most cases any household will have a less than perfect coverage e.g 60-70-80% of the power consumption is measured and reported to the energy panel. This could be compensated by a devices that reports the difference between the Tibber consumption and the energy panel consumption. 

 

In my case as an example todays consumption is reported through Tibber to be 97.98 kWh while the energy panel only reports 74.18 kWh. I have 23.80 kWh today that has not been registered through thermostats, switches and so forth with a energy metering function. This value [Tibber consumption - Power panel consumption] could be a separate "delta consumption device" that is included in the energy panel to bring this up to a match with Tibber. 

 

This would then provide both the details of the energy panel on individual devices and sum up correctly. It of course would be possible to turn off energy reporting on all individual devices and only report the Tibber values but then all details would be lost. 

 

Added a few screenshot from my house to further show the point. Comparison of the energy panel data and Tibber data. 

 

(turned off energy reporting on the Tibber devices as this lead to double accounting)

 

Please login or register to see this attachment.

Please login or register to see this image.

/monthly_2022_10/1378823140_Skjermbilde2022-10-07235415.png.30bb434650c317a1bd1a6fd75ec68fa2.png" />

Please login or register to see this attachment.

 

Please login or register to see this attachment.

 

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Aaaah, thanks for your extensive post. That explains it completely. This sums it up

     

    11 hours ago, BigAndy said:

    It of course would be possible to turn off energy reporting on all individual devices and only report the Tibber values but then all details would be lost. 


    If you have a lot going on with energy reporting devices, and I think you do with a daily total consumption of almost 100 kWh, you want to see the reporting off all individual devices. 
     

    I think this is probably not a Tibber specific wish. I will have a look if I can work something out, within the Tibber Monitor quickapp or as a separate quickapp to solve the wishes for more users. In the P1 Monitor I do that with the power usage (not energy usage) and insert the power usage into an existing (physical) device. Let's see if it is also possible with energy. 
     

    The function would be, get the energy reporting value from the Tibber Monitor child device, sum up the energy usage from all energy reporting devices and insert the difference (also) in the energy panel. 

     

     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0

    Spot on!

     

    I agree that this is perhaps a more generic issue than I first thought. In principle this will apply for all "total energy metering devices" ragardles if it is Tibber Pulse, Futurehome HAN sensor,  Aeotec home power meter or any thing simlar. 
     

    I am playing a bit with logics and optimizations in order to shift or pause lower priority consuming devices i.e electrical heating in concrete floors. This in order to flatten or shift the consumption to lower price parts of the day and as grid cost is based on peak consumption. 

     

    Thanks. 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @BigAndy I have build a new QuickApp which does the job (I hope :-))

     

    I will send you a personal message PM if you can beta run it. 

    Link to comment
    Share on other sites

    • 0

    Hi, 

     

    is there a way to slow down the refresh rate?

    The QA is flooding my HC3L with updated consumption and power etc. etc. every few seconds. 

    Would like to set the refresh rate to once a minute or so. 

    Is that possible?

     

    Thanks, 

    Rob

    • Thanks 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks for your question @robbie11

     

    Updating the Child Devices gave a high CPU load on one of the cores of a HC3. The HC3 lite only has one core, so that could be a problem.

     

    I have published a new version of the Tibber Live QuickApp. In this new version the QuickApp runs like the previous version with fast updates from Tibber Live (it is a webSocket solution) but the Child Devices only update every (whole) one minute. This may not be a definite solution, but for this time it looks like a good solution without losing much functionality. 

     

    (A second change in this new version is: if there are zero values for Voltage L1 L2 L3 they will be replaced with the previous value. That way the voltage won't go from for example 230 Volt to 0 Volt. That was reported by @Patrick75, thanks Patrick.)

     

    The CPU load looks ok on my HC3. Let me know what your experiences are. 

     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0

    Hi! I couldn't update my child devices now, so I changed the test to: tonumber(os.date("%S")) > 45
    Tibber updates every 10 seconds. Now the child devices are updated once a minute approx. mm:50
    Thanks for your good work!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Some changes from Tibber are coming in December, also see the Tibber site: 

    Please login or register to see this link.

     

    I will have a look what it means for the Tibber Live QuickApp. 
     

     

    Breaking change in websocket subscriptions December 2022

    This API initally supported Graphql websocket subscriptions using 

    Please login or register to see this link.

     sub-protocol. However, that library is 

    Please login or register to see this link.

    . Thus, on March 31th 2022 support for 

    Please login or register to see this link.

     sub-protocol was added.

    Support for old protocol will be removed during December 2022. Also, at the same time, the URL for connecting to websocket server changes. Previously the connection could be established at 

    Please login or register to see this link.

    . After the change the URL must be queried via Graphql:

    Please login or register to see this code.

    Currently, the URL returned is 

    Please login or register to see this link.

    .

    For more information see 

    Please login or register to see this link.

     and 

    Please login or register to see this link.

    .

     

    Edited by SmartHomeEddy
    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Got some more info from Tibber:

     

    Both endpoints are operational so you can run the software for a test period and we'll remove it after we've confirmed everything works.

     

    The query for starting the subscription and upgrading to a webSocket still looks the same, it just needs to be sent to another server. For example:

    Please login or register to see this code.

    Also, after that the protocol for websocket communication has some changes: 

    1. Subprotocol name graphql-transport-ws
    2. Connection init message format structure and type (subscribe, not start)
    3. Returning message type (next, not data)
    4. Id must be string
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • With the help of forum members and Toni from Tibber I got the new webSocket working. Now for some finetuning and the new version will be available for everyone. 

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • The new quickapp Tibber Live is available for download.

     

    This new version is required from December 2022 because of changes to the Tibber webSocket. 

     

     

    (you can  copy-paste the lua code)

     

     

    Edited by SmartHomeEddy
    • Like 1
    Link to comment
    Share on other sites

    • 0

    Did test the new code but have issues……

     

    Child devices does not update at all, they stay static and at strange values…

     

    Did try to just copy&paste the code but didn’t work, so removed the entire QA and reinstalled it again. No sucess….

     

    Also when installing the QA from scratch it comes with predefined token&homeid… that populates the child devices with data. Would in my view be better to start without any token&homeid and the user had to enter their values to get data populated.

     

    If I loook at the main Tibber Live device it has values for Hourly Consumption and Todays consumption. But the child devices has completely different values. As an example Hourly Consumption i main device now says 0.8kwh but the corresponding child device says 3.48kWh… Same for Todays Consumprion where the main device says 35.9 KWh but the child device says 62.83kWh

     

    But the Tibber Live main device work as it should, gets data populated every 10sec

    Edited by JcBorgs
    Link to comment
    Share on other sites

    • 0

    Reverted back to old code and things started to work again. Installed as new QA and all other Tibber Live QAs removed from the HC3.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • The child devices get updated every 00 seconds to reduce load (already introduced in the previous version). So don’t expect the child devices, to change in the same rate as the main device. 
     

    If you have some debug information we could see what happens. 
     

     

     

     

    Edited by SmartHomeEddy
    Link to comment
    Share on other sites

    • 0

    Had it running with new code for at least 15 min and the child devices never updated

    Edited by JcBorgs
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Well, there is no need to delete or create the quickapps. Just copy-paste the code. Also the quickapp can be disabled if you don’t want it to work. if you want to make a smooth transfer, you can dupplicate the quickapp, by setting up a new one and disable the one or the other. 
     

    The debugLevel 3 can give more insight, otherwise it is just guessing. 

    Link to comment
    Share on other sites

    • 0

    Sure, will try the new code again and see what happends, with debug  level set to 3

    Link to comment
    Share on other sites

    • 0

    Please login or register to see this code.

     

    So had a working QA, just replaced all code with the code in the .lua file you posted and it gives the above in the log.

    So new connection does not seem to be working, connection fails 10 times and then waits 300 sec.

     

    Have removed my token from the log, but have the valid token and homeid that works with the old code in the variables of the QA

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...