Newer
Older
homeassistant-infra / ha-configs / solcast_automations_g12w_v4_full_week.yaml

- alias: "Solcast - Raport poranny"
  description: "Dzienny raport o 7:00"
  trigger:
    - platform: time
      at: "07:00:00"
  action:
    - service: notify.persistent_notification
      data:
        title: "☀️ Prognoza PV"
        message: |
          Dziś: {{ states('sensor.solcast_pv_forecast_prognoza_na_dzisiaj') }} kWh
          Jutro: {{ states('sensor.solcast_pv_forecast_prognoza_na_jutro') }} kWh
          Bateria: {{ states('sensor.inverter_deye_battery_soc') }}%

# ============================================
# SOLCAST + TARYFA G12W
# Inteligentne ładowanie baterii
# Żarki, 5.0 kWp
# ============================================

- alias: "Solcast G12W - Bardzo pochmurnie (Pn-Pt)"
  description: "Maksymalne ładowanie gdy < 3 kWh"
  trigger:
    - platform: time
      at: "21:30:00"
  condition:
    - condition: time
      weekday: [mon, tue, wed, thu, fri]
    - condition: numeric_state
      entity_id: sensor.solcast_pv_forecast_prognoza_na_jutro
      below: 3
    - condition: numeric_state
      entity_id: sensor.inverter_deye_battery_soc
      below: 95
  action:
    - service: switch.turn_on
      target:
        entity_id: switch.inverter_deye_battery_grid_charging
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_1_charging
      data:
        option: "Grid"
    - service: time.set_value
      target:
        entity_id: time.inverter_deye_program_1_time
      data:
        time: "22:00:00"
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_2_charging
      data:
        option: "Grid"
    - service: time.set_value
      target:
        entity_id: time.inverter_deye_program_2_time
      data:
        time: "13:00:00"
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_3_charging
      data:
        option: "Disabled"
    - service: time.set_value
      target:
        entity_id: time.inverter_deye_program_3_time
      data:
        time: "15:00:00"
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_4_charging
      data:
        option: "Disabled"
    - service: time.set_value
      target:
        entity_id: time.inverter_deye_program_4_time
      data:
        time: "06:00:00"
    - service: notify.persistent_notification
      data:
    - service: number.set_value
      target:
        entity_id: number.inverter_deye_program_1_soc
      data:
        value: 100
        title: "🌧️ G12W: Bardzo pochmurnie!"
        message: "Prognoza: {{ states('sensor.solcast_pv_forecast_prognoza_na_jutro') }} kWh. Ładowanie 22-06 + 13-15!"

- alias: "Solcast G12W - Pochmurnie (Pn-Pt)"
  description: "Ładuj 80% gdy 3-6 kWh"
  trigger:
    - platform: time
      at: "21:30:00"
  condition:
    - condition: time
      weekday: [mon, tue, wed, thu, fri]
    - condition: numeric_state
      entity_id: sensor.solcast_pv_forecast_prognoza_na_jutro
      above: 3
      below: 6
    - condition: numeric_state
      entity_id: sensor.inverter_deye_battery_soc
      below: 95
  action:
    - service: switch.turn_on
      target:
        entity_id: switch.inverter_deye_battery_grid_charging
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_1_charging
      data:
        option: "Grid"
    - service: time.set_value
      target:
        entity_id: time.inverter_deye_program_1_time
      data:
        time: "22:00:00"
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_2_charging
      data:
        option: "Disabled"
    - service: time.set_value
      target:
        entity_id: time.inverter_deye_program_2_time
      data:
        time: "06:00:00"
    - service: notify.persistent_notification
      data:
        title: "🌥️ G12W: Pochmurnie"
        message: "Prognoza: {{ states('sensor.solcast_pv_forecast_prognoza_na_jutro') }} kWh. Ładowanie 22-06."

- alias: "Solcast G12W - Niedziela: Ładowanie na poniedziałek"
  description: "W niedzielę wieczorem ładuj na poniedziałek (od 15% SOC)"
  trigger:
    - platform: time
      at: "21:30:00"
  
  condition:
    # TYLKO NIEDZIELA
    - condition: time
      weekday:
        - sun
    
    # Bateria poniżej 90% (prawie zawsze będzie!)
    - condition: numeric_state
      entity_id: sensor.inverter_deye_battery_soc
      below: 90
  
  action:
    - service: switch.turn_on
      target:
        entity_id: switch.inverter_deye_battery_grid_charging
    
    # Program 1: Ładowanie 22:00 z sieci
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_1_charging
      data:
        option: "Grid"
    
    - service: time.set_value
      target:
        entity_id: time.inverter_deye_program_1_time
      data:
        time: "22:00:00"
    
    - service: number.set_value
      target:
        entity_id: number.inverter_deye_program_1_soc
      data:
        value: 100
    
    # Program 2: Stop o 06:00 (poniedziałek)
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_2_charging
      data:
        option: "Disabled"
    
    - service: time.set_value
      target:
        entity_id: time.inverter_deye_program_2_time
      data:
        time: "06:00:00"
    
    - service: notify.persistent_notification
      data:
        title: "🌙 G12W: Niedziela → Poniedziałek"
        message: |
          🔋 Bateria: {{ states('sensor.inverter_deye_battery_soc') }}%
          ☀️ Prognoza pon: {{ states('sensor.solcast_pv_forecast_prognoza_na_jutro') }} kWh
          ⚡ Ładowanie 22:00-06:00 (8h)
          🎯 Cel: 100% SOC na poniedziałek
          💰 Koszt: ~2.60 zł (weekend=tania!)
          📊 Rozładowanie: do 15% = optymalne!

- alias: "Solcast G12W - Sobota: Bez ładowania"
  description: "W sobotę wieczorem nie ładuj - ZERO wyjątków!"
  trigger:
    - platform: time
      at: "21:30:00"
  
  condition:
    # TYLKO SOBOTA
    - condition: time
      weekday:
        - sat
  
  action:
    # Wyłącz ładowanie z sieci
    - service: switch.turn_off
      target:
        entity_id: switch.inverter_deye_battery_grid_charging
    
    # Program 1: Disabled
    - service: select.select_option
      target:
        entity_id: select.inverter_deye_program_1_charging
      data:
        option: "Disabled"
    
    - service: notify.persistent_notification
      data:
        title: "☀️ G12W: Sobota - relaks"
        message: |
          🌤️ Prognoza niedz: {{ states('sensor.solcast_pv_forecast_prognoza_na_jutro') }} kWh
          🔋 Bateria: {{ states('sensor.inverter_deye_battery_soc') }}%
          💤 ZERO ładowania - G12W = weekend tani, nie potrzeba!
          📉 Rozładowanie do 15% = OK!
          💡 Niedziela 21:30: Ładowanie na poniedziałek (bez względu na prognozę)

- alias: "Solcast G12W - Raport poranny"
  description: "Raport 07:00 z taryfą"
  trigger:
    - platform: time
      at: "07:00:00"
  action:
    - service: notify.persistent_notification
      data:
        title: "☀️ Prognoza + G12W"
        message: |
          Dziś: {{ states('sensor.solcast_pv_forecast_prognoza_na_dzisiaj') }} kWh
          Jutro: {{ states('sensor.solcast_pv_forecast_prognoza_na_jutro') }} kWh
          Bateria: {{ states('sensor.inverter_deye_battery_soc') }}%
          {% if now().weekday() < 5 %}Taryfa: 13-15, 22-07{% else %}Weekend: Cała doba tania!{% endif %}