Skip to content

optimization based on quarter-hourly prices; use 48h price forecast; small changes to adjust battery capacity and consumption history, bug fix for new version of AppDeamon#20

Merged
CWILDMOUNTAIN merged 16 commits intobullitt186:mainfrom
CWILDMOUNTAIN:main
Dec 8, 2025

Conversation

@CWILDMOUNTAIN
Copy link
Collaborator

@CWILDMOUNTAIN CWILDMOUNTAIN commented Nov 27, 2025

This PR includes some major changes in the code and the way Wattwise will work.
As energy prices are given in 15min granularity from Epex Spot market it seems logic to do calculation and optimization based on 15 min steps. The following change have been made:

1. Use Epex Spot integration for HomeAssistant as energy price sensor

  • https://github.com/mampfes/ha_epex_spot
  • this makes Wattwise open for people who do not have a Tibber contract / use Tibber Integration
  • in combination with the free API from https://www.energyforecast.de you'll get price forecast for 48h
  • you you'll have to change the source sensor of the template-sensor Wattwise Energy Prices in the wattwise.yaml according to your setup
  • This sensor will use the energy prices in 15min granularity

2. Use more granular Solar Forecast Data and include forecast data of day 3

  • include forecast date for today, tomorrow and the day after tomorrow to match the 48h price forecast
  • Reads detailedForecast attribute (30‑min periods) from configured sensors.
  • Applies linear interpolation to generate values in 15-min resolution.

3. Consumption Forecast

  • Retrieves new history data in 15-min intervals
  • computes average consumption per 15‑min slot
  • produces consumption_forecast per 15-min slot

4. Optimization (optimize_battery)
(no changes in the optimization model per se)

  • runs every 15min.
  • extracts charge_solar, charge_grid, discharge, export, grid_import, consumption, soc, full_charge in 15-min steps

5. Cheapest / Expensive Hours

  • looks for 4x15-min slots to provide 1-8h windows
  • cheapest- / expensive hour-windows are now set for today, tomorrow and the day after tommorrow separately (considered time-window each 00:00-23:45)

6. configurable inputs of battery capacity, lower battery limit and consumption history days (via HomeAssistant input sensors)

  • battery capacity (you need to create the following sensor: sensor.soc_batterien_kwh)
    This allows you to easily change the battery capacity former defined in the apps.yaml. This might be helpful in winter if one likes to avoid low discharge and adjust lower battery limit
  • battery buffer (you need to create the following sensor: input_number.wattwise_battery_buffer)
    This allows you to easily change the lower battery limit former defined in the apps.yaml. This might be helpful in winter if one likes to avoid low discharge
  • consumption history days (you need to create the following sensor: input_number.wattwise_consumption_history_days)
    This allows you to easily change your consumption history. This might be useful if you go on holiday / come from holiday to reset the consumption history as this is the basis for consumption forecast.

minor bug fixes:

use entso-e as source for energy-prices (kept the name Tibber prices to stay out of trouble with the rest of the code)
Problem:
The check for cheapest / expensive hours is only done for the day the forecast is published at 2 p.m. for the same day as it compares now.date and forecast.date. When there are cheap hours e.g. 2-4 p.m. this very day but even cheaper hours from e.g. 11-14h the next day, the script will only pull the cheap hours from 2-4 p.m. but ignore the cheap hours from tomorrow, even if the price is lower the next day.

Solution:
When the date changes at 0:00 the script will redo the check for cheapest hours on the new day.

changes have been made for expensive hours respectively.


P.S.: it's the same PR as a few weeks before, linting errors should be fixed by now (I closed the last PR unintentionally)
using https://www.energyforecast.de to get 48h forecast energy prices, so need to fetch data for prices today, tomorrow and day after tomorrow 

P.S. you need the EPEX SPOT Integration (https://github.com/krombel/ha_epex_spot), the prices sensor in the wattwise.yaml has changed respectively
@CWILDMOUNTAIN CWILDMOUNTAIN merged commit 39e3f77 into bullitt186:main Dec 8, 2025
0 of 2 checks passed
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.

1 participant