Huawei SUN2000 + LUNA2000: how to control TOU / battery discharge from Home Assistant?

Hi everyone,

I have a Huawei solar installation with:

  • SUN2000-6KTL-M1 inverter
  • LUNA2000 10 kWh battery
  • Huawei Smart Dongle
  • Modbus TCP enabled
  • Home Assistant on Raspberry Pi 5
  • Huawei Solar custom integration v2.1.5
  • Home Assistant OS 18.3
  • Supervisor 2026.09.2
  • Home Assistant can successfully read the inverter and battery data, including SOC, charge/discharge power, pack values, temperatures, voltage, current, etc.

In FusionSolar, I can change the battery Working Mode to TOU (Time of Use) and configure charge/discharge periods.

For example, I can set:

08:00–22:00 → Discharge to load

Outside that period, the battery stops discharging to the house. This works correctly in FusionSolar and allows me to reserve battery energy during the night.
What I would like to achieve is the same control from Home Assistant.

Is there a supported or reliable way to:

  • change the battery Working Mode between Maximum Self-Consumption and TOU;
  • configure TOU charge/discharge periods;
  • temporarily stop battery discharge;
  • or change these settings through the Huawei Solar integration / Modbus TCP?

At the moment I can see the battery sensors in Home Assistant, but I do not see an obvious writable entity for these settings.

Has anyone successfully done this with a SUN2000-M1 + LUNA2000 + Smart Dongle?

If yes, does it require:

  • Elevate permissions;
  • installer credentials;
  • a Home Assistant action/service;
  • or specific Modbus registers?

I would prefer a supported/reliable method rather than raw register writes that may depend on firmware versions.

Thanks!



hello!

In summary, something like this should work for you:

  - action: select.select_option
    metadata: {}
    target:
      entity_id: select.pv_battery_pack_working_mode
    data:
      option: time_of_use_luna2000
      # etc.

More in detail, I also have a SUN2000 + LUNA2000 + Smart Dongle setup, and use the 2 scripts below to switch between Peak Shaving for the day and either TOU or Forced Charge for the night, as part of my energy optimization setup (which has a very more scripts and variables at plan) – you should be able to adapt them to your setup.

alias: Set Battery to High Cost Time Range Configuration
description: ''
triggers:
  - trigger: time
    at: '06:56:00'
conditions: []
actions:
  - action: huawei_solar.stop_forcible_charge
    metadata: {}
    data:
      device_id: 0886083e26925dc07a86848e8f862e3d
  - action: number.set_value
    metadata: {}
    target:
      entity_id: number.pv_inverter_grid_charge_cutoff_soc
    data:
      value: '100'
  - action: number.set_value
    metadata: {}
    target:
      entity_id: number.pv_battery_pack_peak_shaving_soc
    data:
      value: '10'
  - action: select.select_option
    metadata: {}
    target:
      entity_id: select.pv_battery_pack_working_mode
    data:
      option: maximise_self_consumption
mode: single

and

alias: Set Battery to Low Cost Time Range Configuration
description: ''
triggers:
  - trigger: time
    at: '22:56:00'
conditions: []
actions:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.pv_battery_pack_state_of_capacity
            above: input_number.night_battery_target_level
        sequence:
          - action: number.set_value
            metadata: {}
            target:
              entity_id: number.pv_battery_pack_peak_shaving_soc
            data:
              value: '{{ states(''input_number.night_battery_target_level'') | float }}'
          - action: select.select_option
            metadata: {}
            target:
              entity_id: select.pv_battery_pack_working_mode
            data:
              option: maximise_self_consumption
    default:
      - action: number.set_value
        target:
          entity_id: number.pv_inverter_grid_charge_cutoff_soc
        data:
          value: >
            {% set target = states('input_number.night_battery_target_level') |
            float %} {% set minimum = state_attr(
                'number.pv_inverter_grid_charge_cutoff_soc',
                'min'
              ) | float %}
            {{ [target, minimum] | max }}
      - action: select.select_option
        metadata: {}
        target:
          entity_id: select.pv_battery_pack_working_mode
        data:
          option: time_of_use_luna2000
mode: single

Hi Ezio,
thank you very much for your detailed reply and for sharing your scripts. This is very helpful for me and gives me a much clearer idea of how to control the LUNA2000 working mode from Home Assistant. I really appreciate your help and the time you took to explain it. Thanks again!