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

Allow configuring charge speed per hour of the day. #225

Open
dagstuan opened this issue Nov 15, 2023 · 2 comments
Open

Allow configuring charge speed per hour of the day. #225

dagstuan opened this issue Nov 15, 2023 · 2 comments
Labels
feature request Request of a new feature

Comments

@dagstuan
Copy link

Is your feature request related to a problem? Please describe.
I live in a place where we have fixed energy tariffs depending on how much power is being used each hour. Because of this I have already incorporated smart control of my water heater, so I'm calculating which hours of the day to run my water heater based on the electricity price, same as this integration.

This however, poses an interesting issue when using this integration. I'm controlling the speed of the EV charging based on the power draw of the house, and while the water heater is running, the speed of the EV charger will automatically be reduced to make sure I stay below the fixed tariff level I want. This means that the charging speed of my EV is not linear. And since I'm only able to input a single number as the charging speed with this integration, its hard to know which number to input, since the speed might be lower if the calculated hours for the water heater correspond with the EV charging hours.

Describe the solution you'd like
I would like to be able to set the EV charging speed individually per hour of the day. Lets say I calculate in advance that the water heater should run between 2am and 4am in the night, during that time I would like to set the charging speed lower, and in other hours it can be set higher since I know the water heater won't be running then. With such a solution, this plugin could take the lower-speed hours into consideration when calculating which hours to charge the EV.

I'm not entirely sure of the cleanest way of implementing this with HA-entities. 24 inputs for each hour of the day seems excessive, so I'm open to input on how to solve this as clean as possible.

@jonasbkarlsson jonasbkarlsson added the feature request Request of a new feature label Nov 24, 2023
@jonasbkarlsson
Copy link
Owner

I understand your situation, but this kind of improvement will make the integration much more complex. It is also related to similar tariffs schemes were your monthly fee depends on how the maximum power per hour that you consume. Not sure when or if this integration will be able to support these more complicated cases. But if it will, my thinking has been to switch from "% per hour" in charging speed to "kW", in order to make more advance functions. After such a change, it might be possible to also do what you describe.

@corvy
Copy link

corvy commented Jul 26, 2024

I use a few settings to accomplish this. Since my EV charger is by far the largest consumer it does most of the work (most of the changes), like in your example. My setup is more or less like this:

  1. Nordpool sensor, with added cost for distribution and power costs during night / day. In Norway the grid has an extra cost during daytime, but is lower during night. Also it is lower during weekends and holidays. Putting this all into the NordPool sensor makes sure the EV chargeplanning is done based on the actual price, not just the cost of the kWh.
  2. The power level control is a separate setting. The cost for this is based on levels, e.g. the highest cost for 3 hours on 3 different days inside the same month. This is a separate complexity, and I handle this by setting a "target" for my house based on my experience of what is an achievable level. First I calculate the current level (my case with Elvia integration), set my level at the first of the month to my target, and then dynamically change this if the level gets breached. Set it to a reasonable level is smart. If the EV is charging then I dynamically change the charging speed to keep the powerdrain below (but as close to) the target. Then if I am about to breach the level (done with a sensor that continuously calculates the power usage estimation for the rest of the hour) I will start different measures. Like turning off the waterheater or heatercables.

My inspiration for my setup is from there: https://github.com/kimmilde/home-assistant

I have adapted this for my own use-case. The Nordpool sensor setup I have set up like this (Elvia / Oslo + Tibber):

  - platform: nordpool
    VAT: true
    currency: "NOK"
    low_price_cutoff: 0.95
    region: "Oslo"
    precision: 6
    price_type: kWh
    friendly_name: "Nordpool med Elvia"
    additional_costs: >-
        {% set s = {
          "winter_day": 0.3959,
          "winter_night": 0.3209,
          "summer_day": 0.4825,
          "summer_night": 0.4075,
          "hourly_fixed_cost": 0.0295
        } %}
        {% set helligdager = ["0101",
                              "0328",
                              "0329",
                              "0401",
                              "0501",
                              "0509",
                              "0517",
                              "0520",
                              "1225",
                              "1226"] %}
        {# Strømstøtte på 90% på priser over 91,25 øre (ink. mva) trekkes ifra #}
        {% set pb = max((current_price - 0.9125) * 0.9, 0.0) %}
        {# Er i dag en ukedag, og ikke helligdag? #}
        {% if now().isoweekday() <= 5 and now().strftime("%m%d") not in helligdager %}
            {# Sommerpriser fra april til og med desember #}
            {% if now().month >= 4 and now().month <= 12 %}
                {% if now().hour >= 6 and now().hour <= 22 %} {# dagtid mellom 5 og 22 #}
                    {{ (s.summer_day + s.hourly_fixed_cost - pb) | float }}
                {% else %} {# ellers er det natt #}
                    {{ (s.summer_night + s.hourly_fixed_cost - pb) | float }}
                {% endif %}
            {% else %} {# ellers er det vinter #}
                {% if now().hour >= 6 and now().hour <= 22 %}
                    {{ (s.winter_day + s.hourly_fixed_cost - pb) | float }}
                {% else %}
                    {{ (s.winter_night + s.hourly_fixed_cost - pb) | float }}
                {% endif %}
            {% endif %}
        {% else %} {# ellers er det helg eller helligdag #}
            {% if now().month >= 4 and now().month <= 12 %}
                {{ (s.summer_night + s.hourly_fixed_cost - pb) | float }}
            {% else %}
                {{ (s.winter_night + s.hourly_fixed_cost - pb) | float }}
            {% endif %}
        {% endif %}

Only downside to this Nordpool sensor is that it should be integrated with workday, but since I have to use it in configuration.yaml it seems not to work. So therefor I have an automation to alert me 1st of january to update the holidays for the next year.

Hope this is food-for-thought at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request of a new feature
Projects
None yet
Development

No branches or pull requests

3 participants