-
Notifications
You must be signed in to change notification settings - Fork 36
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
Feature request: Additional costs #10
Comments
This would be challenging because every country handles this differently. In some countries the dynamic price is calculated with Entsoe energy price + fix energy price + additional cost. A couple of years ago I setup as a sensor in HA that calculates this. |
This flexibility is what this feature request have. You can configure almost whatever you want with a template. |
Getting additional costs per kWh in there is done pretty quickly, however variable costs in summer/winter, day/night or week/weekends is much more work. Especially to get this user friendly. The templating that the Nordpool integration uses is pretty nice, but I think it can be done more user friendly in the initial configuration. A solution can be using the config flow to set up their template by selecting night/day split, week/weekend split etc. and asking the user for additional costs of these splits. Come to think of it: A nice solution would be maintaining a list of energy providers and its templates. Then in the initial setup configuration, the user can select their energy provider based on the country they selected and the integration automatically uses the template that comes with that provider. I am not sure if this idea is feasible though. We can start by implementing a template, like the Nordpool integration does, and work our way up to the list solution. What do you think? |
The Nordpool way of doing this is not very user friendly, I agree on that :-) But not sure a list is feasible. For Norway alone, this list must have 160 different companies/areas. They change their prices each year and sometimes twice a year. It will be a huge job maintaining this list. |
You're right. That's hopeless work, however it only makes sense to do this for energy providers with hourly tariffs. In the Netherlands there's only 4 energy providers who have this. How is that in Norway? It could be possible to have a list of known templates and if your provider is not in the list you can select the option to make your own template. We can open a discussion where people can upload their templates to keep the list updated and make use of the power of the community :). Anyway, I will start a new branch to get the templating into this integration. Any help is welcome! |
Just want to 👍 I'm also https://github.com/custom-components/nordpool user and its "additional_costs" is absolutely genius feature and it would be great to have it in hass-entso-e. Currently I'm using it to cover
It could also be used to handle
|
Alright, additional cost support has been added in the additional cost branch . You can now add your template in the config flow. Example template:
|
I merged it in the new commit, let me know if you have any issues with it. |
So how do I interpret this? I live in NL and all we have is additional costs per kWh (Inkoopkosten, Energiekosten, ODE) and additional costs per hour (Netbeheerkosten & Vaste Leveringskosten). Is it possible to add both types of costs in the template? |
You're so quick @JaccoR :) A few comments: I got
after the first (re)start after updating (but not yet configuring) the component. Also, after restart, the whole configuration was initially empty, API key etc. had to be re-entered. However after that it worked. The one-line input textfield isn't exactly optimal for holding a 30+ line template. I wonder what's the HASS philosophy for stuff like this. In the nordpool plugin I used to put everything in configuration.yaml, which is convenient to store in version control and it's clear where the data is, but if "config flow" is used, does a copy of the template need to be stored separately somewhere or how should it be versioned? Now I also realized one thing. The additional_costs, at least as supported by nordpool plugin, allows adding (possibly time-dependent) fixed (per kWh) costs. But it doesn't know the spot price, so it's not possible to calculate price-dependent relative costs such as VAT, or is it? Yes it is, was added very recently, custom-components/nordpool#165 Created separate issue about VAT: #17
The template, as in the example above, adds additional costs per kWh. Could you please clarify with an example what is additional cost per hour? So if it's really X €/h depending on hour (but not on kWh), then I'm afraid that's not possible to express that as part of hourly electricity price which is in €/kWh. |
We pay a monthly fee to use the network for our electricity. For me this is €20,10 network management per month and €5,40 delivery fee per month. |
@jpulakka Thanks for the remarks!
I am aware of this. Ideally both the .yaml version and config flow should be possible. I tried a function setting up the platform using yaml, however I could not get it to work (yet). #18
Good one! I quickly looked at nordpools code and I think it should be fairly easy to add current price into the template. I'll look into this. In the nordpool integration, the VAT can be added by a checkbox, but I already saw that the VAT of the Netherlands is outdated. Updating this for all countries could be a bit tiring. Any ideas on how this could be done nicely?
Prices of the integration are in EUR/kWh. Monthly fees are not and the integration does not know how many kWh you consume. Therefore these costs can not be expressed in EUR/kWh. The template is meant for additional costs per kWh. |
So what exactly is the "hourly_fixed_cost": 0.0, ? |
Thanks for creating #18 ! I may be in the minority preferring configuration.yaml over config flow but I'm not the only one :) Also, it's excellent to get current price available in additional costs. With that (and (fake) time, which it already has) it should be possible to handle anything imaginable in the template.
As discussed in #17 it's probably best to just let it be a percentage number, to be edited by the user. Very little extra inconvenience for the user, very much relief for the maintainer = excellent trade-off. |
hourly fixed cost is whatever you want it to be. It could be the base price. If you dont need it, simply remove it and create a template for your own needs. It could be additional_costs: "{{0.05|float}}" if the additional costs are not dependent on time of day and €0.05 |
I was working on getting price dependent additional costs in when i stumbled on a discussion point. In the Netherlands VAT is added as a percentage of the day-ahead-price + extra cost as a whole. So intuitively I set the template as:
This is not right as I should have set the added cost instead of altering the price. It should have been:
I had to think twice to realize the added cost template is not altering the price but is something that is added to the price. What do you think: Should the template alter the price as shown in the first example or should it only represent the added cost as in the second example? |
@JaccoR Yep, there are two ways in which it could work. I don't have strong opinions about which way it should be, but I have an opinion that the functionality should be reflected by the name. Nordpool's additional_costs are additional, as the name says. It made perfect sense originally, when it could only be used to add (time-dependent) constants to the price. But when current_price was provided to the template, then it became maybe just a bit more confusing intuitively, even though it still does exactly what it says. If we would modify the price directly in the template, rather than provide something to be added to the price, then it should be called something like "price_modifier" rather than "additional_costs", to make it clearer what exactly it does from the name. |
With modified prices we are able to do currency conversion in the template. But perhaps not that interesting as most of europe is using euro anyway.......... |
I think the price modifyer is more intuitive. I will go with that one and call it Price Modifyer Template, |
I did a test with this template: {% if now().isoweekday() >= 1 and now().isoweekday() <= 5 %} and I got these prices: prices:
|
This doesn't look right
You probably want to have or there. |
Of course. It is one of those days, today ......... So forget my previous post. Everything is OK, except me which needs one more cup of coffee |
For the NL I use this template:
|
This one gives: Invalid Template, Check https://github.com/JaccoR/hass-entso-e when trying to add? |
Hi! Nice to see that somebody created a entso-e sensor! This was my backup plan when nordpool shutdown the api. Just a couple to tips to reduce the amount of in unneeded issues. (And save yourself some headache) consider raising an exception if current_price is missing from the template. allow the user to set the currency in the settings. It’s possible to use the template to convert the price to a different currency, but the sensors currency will still be wrong. Nice work! 👏 |
updated the post |
I opened a discussion category where you can find and share templates! If you share, please mention the country and the energy provider, so people can copy it. |
Thanks!
Good thinking! I will add it to my todo list.
Yes I was already thinking about it. The ENSTO-e API only gives price in EUR. As exchange rates change over time this means you have to keep updating the template when using the template for this. When an exchange rate is provided by the integration it means this exchange rate needs come from an API or something. See #9. |
@JaccoR imo you don’t need to solve the currency. The user should provide a sensor that has the convertion rate and do the calculation in the template. If they cant be bothered they can always use the nordpool integration as their api support multiple currency |
Is it possible to support a syntax like this? {{(current_price * states("sensor.currency")) | float}} I dont know the system for evaluating template values in an integration like this, but if other sensor values could be evaluated, then this is an easy solution for currency conversion. |
@Hellowlol I think in many cases it's not "can't be bothered" but more "have no idea how to". I'm in that last category, i can spend hours making some copy-pasta and half the time somehow make it work, but I would certainly appreciate an easy solution. |
@SVH-Powel tbh i have no idea if that would work. Would probably work though! |
@JaccoR @SVH-Powel thats the idea. It should work out of the box. You can easily test this in the template page in ha. You have to substitute current_price with some random value ofc |
Yes, it works and is a perfect solution for me {% set s = { |
I'll close this issue for now. |
In Norway, and probably other countries as well, we dont pay for the energy alone. We also have to pay a local company for grid connection. Some of this additional costs are fixed monthly costs, but some are also energy costs added to the price entso-e are providing. And these additional costs are variable based on weekday and time of day.
The Nordpool integration, https://github.com/custom-components/nordpool , handles this quite elegantly by overriding the now() function. Look at the documentation and also on line 265 in https://github.com/custom-components/nordpool/blob/master/custom_components/nordpool/sensor.py on how this is implemented. Also note that all prices the Nordpool integration provides, has these additional costs added, also the list of future prices.
My own configuration is like this:
`
additional_costs: >-
The text was updated successfully, but these errors were encountered: