Fix load estimation: use daily avg instead of instantaneous power
Replaced all occurrences of:
  load_w = inverter_deye_load_power | int(1000)
with:
  today_kwh = inverter_deye_today_load_consumption | float(0)
  elapsed_h = [now().hour + now().minute / 60.0, 2.0] | max
  load_w = [(today_kwh * 1000 / elapsed_h) | int, 800] | max

Motivation: heat pump cycles off midday (temp setpoint reached),
causing instantaneous load to drop to ~530W at 12:55. With old
formula: 530W x 7h = 3.7 kWh projected for 15-22h. Actual
consumption: ~1.7 kW x 7h = 11.9 kWh → battery would run out
during expensive tariff.

With today's avg (e.g. 22 kWh / 12.9h = 1.71 kW at 12:55):
  projected 15-22h = 11.9 kWh → correct target SOC calculation

Also fixes night automations (20:30) where pump may temporarily
be off. Minimum floor: 800W to avoid extreme underestimates.

Affects: all 20 occurrences across:
- Włącz ładowanie dzienne 13:00 (12:55 decision)
- Optymalizacja PV ładowania dziennego (every 15min)
- Ustaw ładowanie nocne (Mon-Thu 20:30)
- Niedziela ładowanie na poniedziałek (Sun 20:30)

Weekend tariff already handled correctly:
- Fri 21:30: Piątek wyłącz auto turns off grid charging
- Sat/Sun: no charging automations (weekday filter)
- Sun 20:30: Niedziela auto charges for Monday

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c724bf8 commit 2459c3b8acead2a5c154cbb4ba7607bfa0d0d528
Wojciech Konieczny authored on 5 Mar
Showing 1 changed file
View
ha-configs/151/automations.yaml