Skip to content

New features usefull for sollar panels/home battery owners#114

Open
voroniys wants to merge 20 commits intotibber:mainfrom
voroniys:new_features
Open

New features usefull for sollar panels/home battery owners#114
voroniys wants to merge 20 commits intotibber:mainfrom
voroniys:new_features

Conversation

@voroniys
Copy link

@voroniys voroniys commented Apr 1, 2025

Hi Tibber,

I'm a Tibber customer and therefore using Tibber Homey App in a lot of Flows I have at home.
So I decided to create a PR - may be you'll be willing to include these changes to main version.
What I've added:
Home driver:

  • Show current/highest/lowest/average price
  • Add average price for today to the token list of 'Price Changed' trigger
  • Add some capabilities that not shown in UI, but providing a tags to be used in workflows with netto energy prices, not rounded to allow more precise actions
  • Add new trigger called Energy prices became negative that sets a local workflow tag with the duration of negative prices in hours. This one is future-proof when price is switched to 15 minutes interval it will provide duration like 1,25 hour.
  • Add capability that indicates how many minutes of negative energy price period left.

Pulse driver:

  • Show cumulative production and rewards since midnight
  • Add corresponded triggers for production and rewards
  • Add day total cost capability - consumption cost - production reward
  • Add extra tokens for production, rewards and total cost to daily report

The App with all these changes is successfully running on my Homey Pro 2023 model and I'm quite happy with it. Hope you can make other users as happy as I'm :)

And I'm still working on some more advanced functionality which I'm missing in my advanced flows. So probably this is not the last PR :)

@voroniys voroniys requested a review from a team as a code owner April 1, 2025 14:19
@jstaro
Copy link
Member

jstaro commented Apr 2, 2025

Thanks for contributing! From an initial look, you've definitely added some useful things here.

This is big enough a contribution that we want to try this out a bit on our Homeys we think, but we can start reviewing parts of it still.

We'll try to do a "mob review" (we'll be friendly though!) this week.

Copy link
Member

@jstaro jstaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to know your use cases a little more in-depth because this is quite a lot of new stuff added in one go.

First of all, what market are you in? We're a bit reluctant to start exposing prices without tax (can easily get a bit messy) unless there's a real and clear benefit. You wrote something about faster reacting automations?

The negative price trigger, does that really need to be its own trigger or can't you just use the normal price changed trigger and do your logic on that, or is the fact that it's triggering on negative spot price without tax a real benefit here? It's unclear to us, but we might be in different markets where things work differently reward/cost-wise.

Is the main use case to, say, turn off your inverter during these periods, or to turn on other loads to prevent export?

Great stuff with including production and reward in the so-called daily consumption report.

Also we wonder a little bit if all these lowest/highest/average capabilities could just be trigger tokens instead?

@voroniys voroniys requested a review from jstaro April 3, 2025 21:25
@voroniys
Copy link
Author

@jstaro Are you still interested in looking into this PR?

@jstaro
Copy link
Member

jstaro commented Apr 28, 2025

@voroniys
Yes, I'm trying to gather some more input from team members and I'm afraid this app keeps on being far down in priority. Thanks for your clarifications.

@jstaro
Copy link
Member

jstaro commented Apr 29, 2025

when it is rounded to just 0,15 it makes all comparisons a bit unprecise: 0,15 is too big, 0,14 is too small. That is why for automations in Flow, at least here in the Netherlands, it is much better to use 'netto' prices not rounded, That is what I'm actually making available in the capabilities. Not rounded because I want netto price -0,0003 to be in comparison less then 0, but if it would be rounded to 0,00 it is equal 0

Prices are already stored in memory and compared with up to 4 decimals for triggering purposes, right?
measure_price_total's capabilityOptions was indeed changed to have (max) 2 decimals 2 years ago, but I think that is used only for presentation in the UI, is it not? If not we might want to increase that to 3. People in Norway and Sweden disliked it because in NOK and SEK the third decimal is not a whole currency subunit and quite devoid of value, but it's ~10x the value in Euro markets, so not as useless. We also used to set it manually on every update with toFixed(2) but IIRC people even disliked what they felt were extraneous zeroes (e.g. when you have 1.40). We could be smarter though and remove the capability option and handle decimals ourselves so we could allow for higher precision but remove "extraneous" zeroes.

We're also thinking that the number of decimals could be set automatically on pairing the home device depending on the currency of your home subscription.

You seem to like up to 4 though. With that many, we would probably need a user setting or Norwegians and Swedes could become unhappy.

We're a bit concerned that adding all these parallel price capabilities will make it pretty difficult to maintain the app. If we'll do it, we'll have to think of really good naming here, and it's unfortunate that we have this old internal name energy leaking out into labels and whatnot. We might want to deprecate that and add a new label and name all the other pure spot price capabilities accordingly.

But we're wondering if your use case(s) cannot be supported by an opt-in advanced setting on the home?

Like a home device setting (off by default) to not include the tax/fees (works a bit differently in different markets) part of the price and use pure spot prices and then we'll just switch between checking/emitting total/energy everywhere?
Would that work for you?

If not, I think we need to do a more thorough review and perhaps do a bit of refactoring/restructuring because it's a bit hard to follow right now (not necessarily the fault of this PR, but the preexisting code).

@voroniys
Copy link
Author

voroniys commented Apr 29, 2025

The driver capabilities are rounded to 2 decimals. But mine issue is that capabilities are not only for presentations. Any capability is becoming a tag available to use in logic app for instance, or in homeyscripts. And here this rounding becomes an issue and that is why I've created hidden capabilities, not presented in UI, but available as tags for other apps and/or homeysript. And that is why I want to use netto energy price without rounding. I'm mostly using them outside this app in homeyscripts. The same is also true for such hidden capabilities, like remaining time of negative prices. It is used in calculations in homeyscripts to adjust some parameters of hybrid inverter.

The fact that conditions inside app use not rounded values is not enough. In my flows I'm using a lot (advanced)logic app as well as homescript and all this external usages are based on rounded capabilities values which is not really convenient.

In this PR the changes to the Pulse driver are mostly for the nicer presentation layer - to show both usage and production and generate nicer report at the end of the day.

But changes to home driver as you can see are mostly intended to give extra tags available to external usage outside the Tibber app. Of course all these changes are only useful for advanced users, who is using advanced flows and only refers to the capabilities tags provided by this app as input. That is why these capabilities are hidden from UI - they are not intended for presentation, they are aimed for automation.

Of course all my changes are very much specific to the Dutch market that is why I tried to not interfere too much with the current functionality and I just extended it with new features and hidden capabilities that are only available as tags for external use in automation flows.

Presentation changes I've made to my mind should be useful for any market - such as display not only current, bat also min/max/avg prices in Home driver and production/saldo in pulse driver. IMHO this extra information would be useful for everyone in any country. Of course they are only useful for users who has solar panels and/or home battery. If you think it would be useful I can add a setting to have a possibility to switch these capabilities off from the presentation layer for users without production facilities.

It is also possible to create opt-in setting for all those extra hidden capabilities in Home driver, but IMHO this will only add unnecessary complexity - as these capabilities are hidden and not present in UI they are never will confuse anyone. They are only visible as tags for those who uses advanced flow automation.

@voroniys
Copy link
Author

voroniys commented Oct 6, 2025

@jstaro I've updated this PR by adding the possibility to work with 15 min slots instead of hours (this quarter electricity prices are active on a Dutch market since 1 October)
The triggers/conditions like "for the next N hours" lrft as is, but hours is internally re-calculated to quarter slots.
The triggers/conditions like "among N lowest/highest prices" is changed to "among N lowest/highest slots"
This app version is running on my Homey Pro with no issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants