springfall2008 / batpred

Home battery prediction and charging automation for Home Assistant, supporting many inverter types
https://springfall2008.github.io/batpred/
129 stars 44 forks source link

Add support for Energi Data Service #1560

Open woopstar opened 1 month ago

woopstar commented 1 month ago

Is your feature request related to a problem? Please describe. Energy Rates are needed to do the calculations. Currently, the UK market is supported.

We could quickly implement Energi Data Service as a provider to enable the DK market.

Everyone heavily uses it in Denmark.

https://github.com/MTrab/energidataservice

Describe the solution you'd like Add support for Energy Data Service with the provided sensors.

gcoan commented 1 month ago

Predbat supports different energy rates, not specifically the UK (although yes it was developed in the UK)

https://springfall2008.github.io/batpred/energy-rates/

If you are able to create a template sensor to reformat the Energi Data Service output to one of the formats Predbat already accepts this would make it easier than extending Predbat for specific energy integrations. Happy to add it to the documentation as an example for other DK users.

woopstar commented 1 month ago

@gcoan Can you provide the formats Predbat already accepts? Then I can look into creating a template sensor that reformats Energi Data Service to be supported.

woopstar commented 3 weeks ago

@springfall2008 can you help me out here, so I can try to make a template sensor. Also on what properties they should be used in? I suspect its the rates_import and rates_export ?

gcoan commented 2 weeks ago

@gcoan Can you provide the formats Predbat already accepts? Then I can look into creating a template sensor that reformats Energi Data Service to be supported.

Sorry overlooked responding.

The format of the rates sensor is defined in the documentation for Bottle Cap Dave's Octopus integration. Here's a fragment of the event.octopus_energy_METERID_current_day_rates (import) sensor, the export_current_day_rates is the same:

event_types: octopus_energy_electricity_current_day_rates
event_type: octopus_energy_electricity_current_day_rates
rates: 
- start: '2024-11-02T00:00:00+00:00'
  end: '2024-11-02T00:30:00+00:00'
  value_inc_vat: 0.173985
  is_capped: false
- start: '2024-11-02T00:30:00+00:00'
  end: '2024-11-02T01:00:00+00:00'
  value_inc_vat: 0.196245
  is_capped: false
- start: '2024-11-02T01:00:00+00:00'
  end: '2024-11-02T01:30:00+00:00'
  value_inc_vat: 0.178815
  is_capped: false
- start: '2024-11-02T01:30:00+00:00'
  end: '2024-11-02T02:00:00+00:00'
  value_inc_vat: 0.17199
  is_capped: false

There's some more attributes after those but I think the key ones are the rates which comprise of start and end time and value. I have a fixed 15pence export rate and the export rate sensor also repeats all the 30 minute time blocks even though the rate is the same throughout the day.

springfall2008 commented 2 weeks ago

Is your feature request related to a problem? Please describe. Energy Rates are needed to do the calculations. Currently, the UK market is supported.

We could quickly implement Energi Data Service as a provider to enable the DK market.

Everyone heavily uses it in Denmark.

https://github.com/MTrab/energidataservice

Describe the solution you'd like Add support for Energy Data Service with the provided sensors.

If you install this service and snapshot what the data is like I maybe able to help?

woopstar commented 2 weeks ago
image

Does this work ?

There is also forecast available in another attribute:

image