G12W: Smart afternoon charging - use grid only when PV can't charge battery
Replaces fixed-threshold logic with energy budget calculation:
- Formula: PV_surplus_W * remaining_hours >= battery_deficit_Wh
- Battery capacity: 14336 Wh (280Ah LFP at 51.2V nominal)

'Włącz ładowanie dzienne 13:00' (12:55 trigger):
- Calculates if PV surplus over full 2h window >= battery deficit
- YES → Battery First, no grid charging needed
- NO → Load First + Grid at 100A (use cheap G12W tariff)

'Optymalizacja PV ładowania dziennego' (every 15min, 13:00-15:00):
- Recalculates with actual remaining time in window
- Dynamically switches between Battery First / Grid as cloud cover changes
- Only triggers grid charging when SOC < 95% and PV genuinely can't finish the job

Example: PV=3358W, Load=1188W, SOC=99%, remaining=1.38h
  Surplus=2988 Wh >> Deficit=143 Wh → Battery First, grid import drops 3100W→324W

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