Tibber Binding

Ok, played around a bit, and there IS an endpoint to it, so it just has to be added to the binding, I guess?

subscription{
  liveMeasurement(homeId:"xxx"){
    timestamp
    power
    accumulatedConsumption
    accumulatedCost
    currency
    minPower
    averagePower
    maxPower
    lastMeterProduction
    lastMeterConsumption
  }
}

Last two arguments load 1-0:1.8.0 and 1-0:2.8.0. So its just not implemented in the current binding

Hi @kjoglums would you mind adding the lastMeterProduction channel ?

If you already configured the channels for the binding and later activated the Pulse, you have to restart the binding to fill/receive the items coming from the Pulse.
After I did restart it, the items got filled

After updating the binding to 3.4.2 from i think 3.3.0 or so the item TibberAPITomorrowPrices isn’t NULL anymore and contains the prices for tomorrow!

The item TibberAPITodayPrices is still NULL by the way. Seems like it’s not implemented yet or somthing. I think i will try another update in a few weeks!

Thanks for the support! :slight_smile:

Hi,

i just registered with Tibber too and also installed the Binding. I can read the data and i can also get the current price. However Tibber recommends to not use the current price but to get the price for the next day and cache it instead.

This also makes sense, if you want to calculate ahead, if it makes sense to plugin the car at night or start a specific consumer at a certain time and maybe also ask the user for feedback if it should be started or not, or send a reminder to plug in the car before going to sleep.

Writing such rules itself for me is not really a problem, however i have no experience with parsing dates and such in OH and to store them in a format where i can use them in rules.

Is there anyone that built rules already based on the prices when cached and only requested once per day in the afternoon?

I just need a sample, how to deal with them…

So i request tomorrow prices and get a result in json format like

[
  {
    "startsAt": "2022-09-27T00:00:00.000+02:00",
    "total": 3.8472
  },
  {
    "startsAt": "2022-09-27T01:00:00.000+02:00",
    "total": 3.0748
  },
...

What would be the best way, to store this as a value for using in rules? Should i just keep it in that format and create a rule to iterate throught each element in that array and then send a notification or start a certain task at a certain time?

Quite frankly, I use the aWATTar-Binding for that. The basic aWATTar-API is open without registration and the aWATTar-Binding already spits out two things: hourly prices in separate channels and an extra Thing, which can be configured to already calculate the “cheap hours”. So I use that for starting loading the EV and other high consumption devices.
There’s a discussion going on to streamline the efforts for dynamic pricing:

But for the time being, I just use the ready-made channel-configuration with aWATTar-things. :wink:
You can add the local surplus to the aWATTar-bridge (base price) and you’ll get the same exact pricing as you do with Tibber.

1 Like

Hi,

here is my example of parsing the hour values fron the JSON format:

rule "Determine maximal price on next day"
when
    Time cron "0 55 23 * * ?"
then   
    var price_tom_min = Float::parseFloat("100")
    var price_tom_max = Float::parseFloat("0")

    for (var i = 0; i <= 23; i++) {
    var newString = "$.[" + i + "].total"
    JSONPathexp.postUpdate(newString)
    var newValue = transform("JSONPATH", newString, TibberAPITomorrowPrices.state.toString)
    var Price = Float::parseFloat(newValue) * 100
    if (Price < price_tom_min)  price_tom_min = Price
    if (Price > price_tom_max)  price_tom_max = Price
    }

    PriceTomorrowMin.postUpdate(price_tom_min)    
    PriceTomorrowMax.postUpdate(price_tom_max)
    PriceTomorrowDiff.postUpdate(price_tom_max-price_tom_min)  
end

Enable the JSONPath Transformation in the Transformation Add-ons tab.
newString is for example “$.[0].total” to access the first hour of the day.

Thanks, this looks good for determining the best hours, in Germany we should rather use 0 05 14 * * ? as cron expression as the prices should be fixed after 2pm (at least on Awattar, guess it’s the same on Tibber?).

So the only other thing I’m missing right now is how to display that on Grafana. If I have 24 today values and 24 tomorrow values, how can i show that on Grafana? Any ideas?

Sorry for the late reply, but will have a look at getting lastMeterProduction channel included in the binding.

1 Like
1 Like

Feature request:

  • Add channels for lastMeterConsumption and minPower.

Reasoning:

  • lastMeterConsumption could be used to check the correctness of the hourly consumption values (I wouldn’t expect any discrepancies though - but who knows?).
  • minPower could be used to reduce the base load by identifying (and replacing) power guzzlers.
subscription{
  liveMeasurement(homeId:"XXXXXXXXX"){
    timestamp
    lastMeterConsumption
    power
    accumulatedConsumption
    accumulatedCost
    currency
    minPower
    averagePower
    maxPower
  }
}

Result:

{
  "liveMeasurement": {
    "timestamp": "2023-04-01T12:12:16.000+02:00",
    "lastMeterConsumption": 19957.8146,
    "power": 358,
    "accumulatedConsumption": 4.3593,
    "accumulatedCost": 0.817414,
    "currency": "EUR",
    "minPower": 105,
    "averagePower": 357.1,
    "maxPower": 4893
  }
}

Moderator’s request: read before posting.
Particularly so before asking someone to work for you.

I think they are already there? Channels live_lastMeterConsumption and live_minPower.

@laursen @mstormi
You are right, channels are available - I am sorry I did not check the documentation properly.

You didn’t even read this thread.

Proof?

I don’t have to give proof, but it’s the post right above your request.

Now you got me.

Actually that post was about lastMeterProduction, not lastMeterConsumption.

I’m experiencing dropouts in the live power data from the Tibber Binding:

Data feed persistence stopped and 22:00 CEST, resumed operation without my intervention at about 02:54 CEST, stopped again at about 09:00 CEST; manual restart of the Tibber Binding via Karaf console at 11:25, persistence and live power channel data stopped again, but Tibber API explorer was providing live measurement data, 2nd manual restart at 14:30 CET …

openhab> bundle:list | grep ibber
279 x Active x  80 x 3.4.0.202212140407     x openHAB Add-ons :: Bundles :: Tibber Binding

openHAB log (nothing at around 22:00 CEST yesterday):

2023-03-31 11:52:11.776 [WARN ] [ibber.internal.handler.TibberHandler] - IO Exception: java.util.concurrent.ExecutionException: java.io.EOFException: HttpConnectionOverHTTP@86e67c::DecryptedEndPoint@3ecd3a{l=/192.168.1.181:59660,r=api.tibber.com/52.210.45.21:443,OPEN,fill=-,flush=-,to=60030/0}
2023-03-31 19:56:10.889 [WARN ] [ibber.internal.handler.TibberHandler] - IO Exception: java.util.concurrent.ExecutionException: java.io.EOFException: HttpConnectionOverHTTP@1419228::DecryptedEndPoint@ff62c2{l=/192.168.1.181:50044,r=api.tibber.com/99.81.131.250:443,OPEN,fill=-,flush=-,to=60034/0}
2023-04-01 02:51:58.824 [WARN ] [ibber.internal.handler.TibberHandler] - IO Exception: java.util.concurrent.ExecutionException: java.io.EOFException: HttpConnectionOverHTTP@dcc3eb::DecryptedEndPoint@1f95775{l=/192.168.1.181:35542,r=api.tibber.com/99.81.131.250:443,OPEN,fill=-,flush=-,to=60008/0}
        at org.openhab.binding.tibber.internal.handler.TibberHandler$TibberWebSocketListener.sendMessage(TibberHandler.java:548) ~[?:?]
        at org.openhab.binding.tibber.internal.handler.TibberHandler.close(TibberHandler.java:391) ~[?:?]
        at org.openhab.binding.tibber.internal.handler.TibberHandler$TibberWebSocketListener.onWebSocketError(TibberHandler.java:466) ~[?:?]
        at org.openhab.binding.tibber.internal.handler.TibberHandler.close(TibberHandler.java:399) ~[?:?]
        at org.openhab.binding.tibber.internal.handler.TibberHandler$TibberWebSocketListener.onWebSocketError(TibberHandler.java:466) ~[?:?]
2023-04-01 02:52:45.384 [WARN ] [ibber.internal.handler.TibberHandler] - Websocket Client Stop Exception: java.lang.InterruptedException
2023-04-01 07:50:33.281 [WARN ] [ibber.internal.handler.TibberHandler] - CLOSE FRAME - Failed to stop websocket client: null
2023-04-01 11:24:55.262 [WARN ] [core.thing.internal.ThingManagerImpl] - Initializing handler for thing 'tibber:tibberapi:f3f7052db4' takes more than 5000ms.
2023-04-01 14:30:34.266 [WARN ] [core.thing.internal.ThingManagerImpl] - Initializing handler for thing 'tibber:tibberapi:f3f7052db4' takes more than 5000ms.

Not sure how to proceed with troubleshooting - any advise appreciated.

Is
Initializing handler for thing 'tibber:tibberapi:f3f7052db4' takes more than 5000ms.
something to worry about?