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

Support for fixed time based pricing #262

Open
gijs007 opened this issue May 9, 2024 · 2 comments
Open

Support for fixed time based pricing #262

gijs007 opened this issue May 9, 2024 · 2 comments

Comments

@gijs007
Copy link

gijs007 commented May 9, 2024

I really like how this integration plans the optimal moment to charge the car, based on SOC, charge speed and the net pricing.
Would it be possible to add support for fixed time based prices?

Currently I have a contract similar to below:
monday - friday 7:00-23:00 at 0,31 euro per kwh (high), and outside this period its 0,25 euro per kwh (low).

This way I can use the integration to charge from the grid at the optimum time (when required). Which would be ideal as I can charge with excess PV energy the rest of the time.

What would also be neat, is if we can use the actual tariff data from a P1 / DSMR meter (sensor.power_tariff). This sensor reports only the current tariff (high/low), but can be used to detect exceptions such as holidays.

@jonasbkarlsson
Copy link
Owner

Hi! With v1.11.0 there is the possibility to use a template sensor to generate the price information. It should also be possible to achieve what you ask for. If you are skilled in template sensors, and can made one yourself, please post it here so that I can add it to the Wiki page.

Otherwise, I will try to make one. But it might take some time.

@phanja
Copy link

phanja commented Oct 17, 2024

Here is a workable template I've been using:

template:
  - sensor:
      - name: "energy_price"
        state: 00.00
        unit_of_measurement: "¢/kWh"        
        attributes:
          prices_today: >
            [
              {
                "time": "{{ (now() ).strftime('%Y-%m-%d 00:00:00+01:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() ).strftime('%Y-%m-%d 01:00:00+01:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() ).strftime('%Y-%m-%d 02:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() ).strftime('%Y-%m-%d 04:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() ).strftime('%Y-%m-%d 06:00:00+02:00') }}",
                "price": 00.00
              },
               {
                "time": "{{ (now() ).strftime('%Y-%m-%d 08:00:00+02:00') }}",
                "price": 00.00
              },
               {
                "time": "{{ (now() ).strftime('%Y-%m-%d 10:00:00+02:00') }}",
                "price": 00.00
              },
               {
                "time": "{{ (now() ).strftime('%Y-%m-%d 12:00:00+02:00') }}",
                "price": 00.00
              },
               {
                "time": "{{ (now() ).strftime('%Y-%m-%d 14:00:00+02:00') }}",
                "price": 00.00
              },
               {
                "time": "{{ (now() ).strftime('%Y-%m-%d 16:00:00+02:00') }}",
                "price": 00.00
              },
               {
                "time": "{{ (now() ).strftime('%Y-%m-%d 18:00:00+02:00') }}",
                "price": 00.00
              },
               {
                "time": "{{ (now() ).strftime('%Y-%m-%d 20:00:00+02:00') }}",
                "price": 00.00
              },
               {
                "time": "{{ (now() ).strftime('%Y-%m-%d 22:00:00+02:00') }}",
                "price": 00.00
              }
            ]
          prices_tomorrow: >
            [
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 00:00:00+01:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 01:00:00+01:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 02:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 04:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 06:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 08:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 10:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 12:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 14:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 16:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 18:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 20:00:00+02:00') }}",
                "price": 00.00
              },
              {
                "time": "{{ (now() + timedelta(days=1)).strftime('%Y-%m-%d 22:00:00+02:00') }}",
                "price": 00.00
              }
            ]

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

No branches or pull requests

3 participants