Skip to content

Automations

Marcin Gaszewski edited this page May 25, 2026 · 2 revisions

Automations

A collection of ready-to-use automation examples. Replace {prefix} with your inverter's entity ID prefix (e.g. sunsynk or my_house_5kw) and {serial} with your inverter's serial number where required.


Battery management

Notify when battery is low

automation:
  - alias: "Battery low alert"
    trigger:
      - platform: numeric_state
        entity_id: sensor.{prefix}_battery_soc
        below: 20
        for: "00:05:00"
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "⚡ Battery Low"
          message: "Battery SOC is {{ states('sensor.{prefix}_battery_soc') }}%"
    mode: single

Stop discharging when SOC is critical

automation:
  - alias: "Stop discharge at critical SOC"
    trigger:
      - platform: numeric_state
        entity_id: sensor.{prefix}_battery_soc
        below: 10
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_discharge_current
        data:
          value: 0

Resume normal discharge when SOC recovers

automation:
  - alias: "Resume discharge when SOC recovers"
    trigger:
      - platform: numeric_state
        entity_id: sensor.{prefix}_battery_soc
        above: 30
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_discharge_current
        data:
          value: 100

Grid and sell management

Zero export at night

automation:
  - alias: "Zero export at night"
    trigger:
      - platform: time
        at: "22:00:00"
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_zero_export_power
        data:
          value: 0
      - service: switch.turn_off
        target:
          entity_id: switch.{prefix}_setting_solar_sell

  - alias: "Enable sell in morning"
    trigger:
      - platform: time
        at: "06:00:00"
    action:
      - service: switch.turn_on
        target:
          entity_id: switch.{prefix}_setting_solar_sell

Disable sell during peak grid demand hours

Useful in countries where grid operators request reduced export during evening peaks.

automation:
  - alias: "Disable sell during peak hours"
    trigger:
      - platform: time
        at: "17:00:00"
    action:
      - service: switch.turn_off
        target:
          entity_id: switch.{prefix}_setting_solar_sell

  - alias: "Re-enable sell after peak"
    trigger:
      - platform: time
        at: "20:00:00"
    action:
      - service: switch.turn_on
        target:
          entity_id: switch.{prefix}_setting_solar_sell

Solar forecast based

Boost charge current when tomorrow's forecast is poor

Charge the battery more aggressively from the grid/PV today when tomorrow looks cloudy.

automation:
  - alias: "Boost charge current when poor forecast tomorrow"
    trigger:
      - platform: numeric_state
        entity_id: sensor.solar_forecast_tomorrow
        below: 5
        for: "00:10:00"
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_charge_current
        data:
          value: 100
    mode: single

  - alias: "Normal charge current when good forecast tomorrow"
    trigger:
      - platform: numeric_state
        entity_id: sensor.solar_forecast_tomorrow
        above: 10
        for: "00:10:00"
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_charge_current
        data:
          value: 50
    mode: single

Daily morning forecast notification

automation:
  - alias: "Morning solar forecast notification"
    trigger:
      - platform: time
        at: "07:00:00"
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "☀️ Solar Forecast"
          message: >
            Today: {{ states('sensor.solar_forecast_today') | round(1) }} kWh
            Tomorrow: {{ states('sensor.solar_forecast_tomorrow') | round(1) }} kWh
            Cloud cover: {{ states('sensor.solar_forecast_cloud_cover') }}%

Switch to self-use mode on cloudy days

automation:
  - alias: "Self-use mode on very cloudy days"
    trigger:
      - platform: numeric_state
        entity_id: sensor.solar_forecast_today
        below: 3
        for: "00:30:00"
    condition:
      - condition: time
        after: "08:00:00"
        before: "12:00:00"
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_sys_work_mode
        data:
          value: 3   # Self-use mode

Reporting and monitoring

Daily energy summary at sunset

automation:
  - alias: "Daily solar summary"
    trigger:
      - platform: sun
        event: sunset
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "🌅 Today's Solar Summary"
          message: >
            PV: {{ states('sensor.{prefix}_pv_generation_today') }} kWh
            Load: {{ states('sensor.{prefix}_load_energy_used_today') }} kWh
            Import: {{ states('sensor.{prefix}_grid_import_today') }} kWh
            Export: {{ states('sensor.{prefix}_grid_export_today') }} kWh
            Battery: {{ states('sensor.{prefix}_battery_soc') }}%

Alert on grid outage

automation:
  - alias: "Grid outage alert"
    trigger:
      - platform: state
        entity_id: sensor.{prefix}_grid_status
        to: "0"
        for: "00:00:30"
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "⚠️ Grid Outage"
          message: "Grid is offline. Running on battery/solar. SOC: {{ states('sensor.{prefix}_battery_soc') }}%"

  - alias: "Grid restored alert"
    trigger:
      - platform: state
        entity_id: sensor.{prefix}_grid_status
        from: "0"
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "✅ Grid Restored"
          message: "Grid is back online."

Temperature alert

automation:
  - alias: "Inverter overtemperature warning"
    trigger:
      - platform: numeric_state
        entity_id: sensor.{prefix}_inverter_ac_igbt_temperature
        above: 75
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "🌡️ Inverter Hot"
          message: "IGBT temperature is {{ states('sensor.{prefix}_inverter_ac_igbt_temperature') }}°C — check ventilation."

Time-of-use tariff

Built-in feature available — v1.6.0 added the Tariff Manager, which handles cheap-rate charging and expensive-rate discharging automatically based on any HA price sensor. No automations needed — configure it through Settings → Devices & Services → Sunsynk → Configure.

If you prefer manual control or need logic the Tariff Manager doesn't cover, use these as a starting point:

Charge during off-peak, sell during peak (time-based)

automation:
  - alias: "TOU — cheap rate: charge battery"
    trigger:
      - platform: time
        at: "00:00:00"
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_charge_current
        data:
          value: 100

  - alias: "TOU — peak rate: sell from battery"
    trigger:
      - platform: time
        at: "16:00:00"
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_discharge_current
        data:
          value: 100

  - alias: "TOU — restore normal after peak"
    trigger:
      - platform: time
        at: "20:00:00"
    action:
      - service: number.set_value
        target:
          entity_id: number.{prefix}_setting_discharge_current
        data:
          value: 50

React to Tariff Manager mode changes

Trigger other automations when the Tariff Manager changes mode:

automation:
  - alias: "Notify when tariff charging starts"
    trigger:
      - platform: state
        entity_id: sensor.{prefix}_tariff_mode
        to: "charging"
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "🔋 Cheap rate charging"
          message: "Battery charging at cheap rate. SOC: {{ states('sensor.{prefix}_battery_soc') }}%"

  - alias: "Notify when tariff discharging starts"
    trigger:
      - platform: state
        entity_id: sensor.{prefix}_tariff_mode
        to: "discharging"
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "💰 Selling to grid"
          message: "Battery discharging at peak rate. SOC: {{ states('sensor.{prefix}_battery_soc') }}%"