Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tibber] Missing channel for accumulatedReward (from Live API) #12273

Closed
skenhall opened this issue Feb 12, 2022 · 15 comments · Fixed by #14277
Closed

[tibber] Missing channel for accumulatedReward (from Live API) #12273

skenhall opened this issue Feb 12, 2022 · 15 comments · Fixed by #14277
Labels
enhancement An enhancement or new feature for an existing add-on

Comments

@skenhall
Copy link

Your Environment

openHAB 3.2

Description

According to Tibber's API documentation for live measurements https://developer.tibber.com/docs/reference#livemeasurement
there is also data available for the earnings (reward) for sold electricity:
accumulatedReward | Float | Accumulated reward since midnight; requires active Tibber power deal

Would be super to also get this data into openHAB!

@skenhall skenhall added the enhancement An enhancement or new feature for an existing add-on label Feb 12, 2022
@lsiepel
Copy link
Contributor

lsiepel commented Jan 10, 2023

@skenhall just looked at the binding and the API, this doesn't look very difficult te get into the binding. Alle the message parsing is allready in place and it looks like it is 4- lines of code or so. But, as i'm not able to use tibber myself, i need you to test my changes. Are you able to spend some time to test?

@skenhall
Copy link
Author

skenhall commented Jan 10, 2023 via email

@lsiepel
Copy link
Contributor

lsiepel commented Jan 10, 2023

There you go: https://1drv.ms/u/s!AnMcxmvEeupwjqJi0lZi9bodhlkFmw?e=dpcKLL
Uninstall current tibber binding, drop this file in you addons folder and it should be picked up in seconds.

You should then be able to bind an item to the channel: accumulatedReward it is of type reward:

	<channel-type id="reward">
		<item-type>Number:Dimensionless</item-type>
		<label>Total Reward</label>
		<description>Reward at given time interval (e.g. hourly, daily, accumulated since midnight)</description>
		<state pattern="%.3f"></state>
	</channel-type>

If you confirm the value is loaded, i'll file a PR for this change.

@skenhall
Copy link
Author

skenhall commented Jan 11, 2023 via email

@skenhall
Copy link
Author

skenhall commented Jan 13, 2023 via email

@jlaur
Copy link
Contributor

jlaur commented Jan 13, 2023

@skenhall - is it when using the JAR file? If yes, can you try to install the Air Quality binding and then try again?

@skenhall
Copy link
Author

skenhall commented Jan 15, 2023 via email

@jlaur
Copy link
Contributor

jlaur commented Jan 15, 2023

@skenhall - no, it's a problem when manually dropping JARs in the addons directory. In this case dependent features are not automatically installed. I had the exact same problem two days ago when working on an add-on in a clean 4.0 snapshot system not having any official add-ons installed.

@lsiepel
Copy link
Contributor

lsiepel commented Jan 15, 2023

You might need to re-create the thing before the new channel is shown. the screenshot seems to be missing from the post.

@skenhall
Copy link
Author

skenhall commented Jan 21, 2023 via email

@skenhall
Copy link
Author

Sorry to say, but no data is reported in channel "Total Reward".
Today I had a really small sales (0.02 SEK) and I can get that directly from Tibber's API explorer (see attached screen shot).
Live data Tibber API 2023-01-23

However if I connect OpenHAB Tibber binding to same account the "Total Reward" i NULL (see attached screen shot)
OpenHAB Tibber items 2023-01-23

Other data from API seems fine.

So probably something not right...

Can I switch on some more detailed logging, or how to continue debugging?

@lsiepel
Copy link
Contributor

lsiepel commented Jan 23, 2023

It will help if you enable debug logging and send the logs, also if you are able to send the related events.
From the console you can enable debug logging:
log:set debug org.openhab.binding.tibber

But i might have found the cause allready. The accumulatedReward was not yet added to the query. I thought it would be just another field that was returned, but due to your example, it came into my mind to look at the request.

Two test jars, pick one depending on your test systemen 3.x or 4.x
3.4.2: https://1drv.ms/u/s!AnMcxmvEeupwjqVH4mkQC4BrMOPcgw?e=GkFr43
4.0.0: https://1drv.ms/u/s!AnMcxmvEeupwjqVGznHUFOHls71Icw?e=HpEtvr

@skenhall
Copy link
Author

Success!

I can now confirm that the latest addon version you provided @lsiepel worked just fine:
image

@lsiepel
Copy link
Contributor

lsiepel commented Jan 25, 2023

Thanks, just filed the PR, now we wait for it to get merged.

@skenhall
Copy link
Author

skenhall commented Jan 26, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants