Integration Solar inverter huawei 2000L

I had the same with RPi3. In most cases I just had to manually reload the integration, in some other cases had to restart the OS.
I believe it is due to the RPi3 being slow and/or low memory, as it never happened again since I moved to RPi4

Today I’ve found a workaround. I’ve deleted all the sensors with reference to the Huawei Solar integration. After that the communication starts to work again

Did you find a solution because I am interested. I got rid of rode read for other integration and I would like to avoid to integrate it back for Huawei. Managing dynamically the time of charge discharge & standby via home assistant would be great. Keep us posted if you make progress.

Hello,

I have different electricity rates. Full price from 6:00 a.m. to 10:00 p.m. and low price from 10:00 p.m. to 6:00 a.m. Friday from 10:00 p.m. it’s low price until Monday morning 6:00 a.m.

The goal is that if the next day the solar forecast is not sufficient, I would like to charge the battery before 6:00 a.m. at the low price. To avoid charging the battery too quickly, I created a time sensor which calculates the start time of charging so that the battery is full at 6:00 a.m., then charging stops.

Here is the sensor which calculates the start time of battery charging:

- name: "Solaire : Heure début charge batterie depuis réseau"
  device_class: timestamp
      icon: "mdi:clock-end"
      state: >
        {% set kwh_batterie_total_capacite = 10 %}
        {% set kwh_charge_from_grid = 4.7 %}
        {% if now().weekday() in [5, 6] %}
            {% set next_heure_tarif_plein = (now().replace(hour=6, minute=00, second=0, microsecond=0) + timedelta(days=1)) %}
        {% else %}
            {% set next_heure_tarif_plein = (now().replace(hour=6, minute=00, second=0, microsecond=0)) %}
        {% endif %}
        {% set batterie_kw_a_charger = kwh_batterie_total_capacite - ((states('sensor.battery_state_of_capacity_1') | float(default=0) | round(0) * kwh_batterie_total_capacite / 100 )) %}
        {% set seconds_to_charge = ((batterie_kw_a_charger / kwh_charge_from_grid) * 3600) | int(default=0) | round(0) %}
        {{ (next_heure_tarif_plein - timedelta(seconds=seconds_to_charge)) }}
  
      availability: >
          {{
            states('sensor.battery_state_of_capacity_1')  | is_number
          }}

I created an automation which is triggered at the time calculated by the sensor. The automation triggers an input_boolean which enables/disables the battery charging service :

alias: "Solaire : Time Batterie Charge ON depuis le réseau"
trigger:
  - platform: time
    at: sensor.solaire_heure_debut_charge_batterie_depuis_reseau
    id: Batterie_Charge
  - platform: time
    at: "05:58:00"
    id: Batterie_Stop_Charge
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - Batterie_Charge
        sequence:
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.solaire_batterie_charge_depuis_reseau
      - conditions:
          - condition: trigger
            id:
              - Batterie_Stop_Charge
        sequence:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.solaire_batterie_charge_depuis_reseau
mode: single

It often happens that the battery charging trigger time falls when the inverter is unfortunately disconnected from HA. So I have an uncharged battery in the morning at 6:00 :frowning:

What could I do to resolve the problem?

A check that sees if the battery charge is positive, everything is ok and if the battery charge is at 0, would there need to be a loop that activates the charge?

Do you have any ideas or solutions on how to program this?

Thank you and have a nice day at the forum

If this works and doesn’t stop at 100% then that is perfect. It is only for a few hours normally, but sometimes it gets to 100% and I don’t want it to discharge from the house battery into the EV


Hi guys,
I am trying to make an automation for my electric heater. I want the electric heater to turn on when the solar panels production is above 2kw.
I am not sure witch sensors should I use for this automation.
Does anyone can list the Huawei invertor sensors?
On my dev list in HA I have Huawei solar and Fusion Solar up and running.

This is the YAML code that I managed to script:

alias: Test Convector on
description: When PV  real-time > 2.3Kw, turn on the electric heater
trigger:
  - platform: numeric_state
    entity_id: sensor.******_realtime_power
    above: 2300
    for:
      hours: 0
      minutes: 2
      seconds: 0
condition:
  - condition: device
    type: is_off
    device_id: *******
    entity_id: **********
    domain: light
  - condition: device
    device_id: **********
    domain: climate
    entity_id: ************
    type: is_hvac_mode
    hvac_mode: "off"
action:
  - device_id: *********
    domain: climate
    entity_id: *********
    type: set_hvac_mode
    hvac_mode: heat
  - type: turn_on
    device_id: **********
    entity_id: **********
    domain: light
    brightness_pct: 100

THX!

With WLCRS integration you’d be looking at the Active Power entity:

sensor.inverter_active_power_1 (from memory if you have 1 inverter)
sensor.inverters_active_power (if you have multiple inverters and defined a sensor for all of them).

What are you using for the automation / trigger to turn the heater off ?

Instead of the 2 minute statement to trigger you’ve used,you need something to provide a averaged out kW over a 3-5min period instead. I’m not sure if you could use the Derivate sensor to potentially provide a sensor showing the average over 5min ?

Also wouldn’t you be needing to say you need Active Power to be ‘whatever household base load is’ + 2.3kW before turning on the heater? i.e. no use if your PV are producing 3kW, you have the oven running and using 2kW (so 1 spare), but as production is 3kW your heater turns on, putting you at -1.3kW ?

Thx for responding!
My ideea was to turn on the electric heater on when the PV production is above 2.3kwh. If the oven goes on it means that the house will need at least 3.3kw and the the electric heather will have to turn off to give priority to the oven( the oven is not smart so I will need to get the instant power house consumption from one of the power meter or huawei solar sensors).

I have a 8Kwh system, monophasic with two 4kw Huawei inverters and one Dongle and a power meter.

The electric heater should resume when one of the big appliances( oven, dishwasher, washing machine) finishes their job.

Unfortunally for the last three weeks the Sun is hiding under the clouds and I cant test this automation in real environment.

With this weather I m stuck and I cant find the sensors that I need to run this automation.

So, I need your help to guide me to find the correct sensors.
Thank you!

Hi all,

I need some help with this integration. I’m trying to connect to Huawei using the SDongleA-05.
I can connect to the Dongle, but HA is only finding out one entity, the power meter. Hence all the sensor data associated with the Inverter I can’t see.

The only Slave ID I could connect to is 2. The dongle firmware is V100R001C00SPC125 and inverter is V100R001C00SPC153.

Is it possible there are other Slave IDs. I have tried 0,1,3 with no success.

Can someone help?

Answering myself, this was a bug in HA 2023.08

Thanks for sharing your Flow!
Looks really interesting.

But unfortunately I have syntax error by importing via copy & paste into node red.

Can you please share this flow via file for direct upload into node red?

Hi all,

I’ve been using this integration for a few years successfully, but recently it appears that the setting to set the amount of power discharged by the LUNA2000 has disappeared. This has resulted in my automations charging the battery to 100% in the offpeak tariff, and then all that saved battery being eaten during the offpeak overnight period by my EV which is also charging.
Previously I had it set so that my LUNA2000 would have a maximum discharge wattage of 0 when the offpeak period started and it would be set to 5000w once the offpeak period ended. How do I achieve this with the currently exposed controls from this integration?
Thanks,
Mike.

1 Like

Latest version:

flow.json downloaded from “export” in node red contains this

[{"id":"03a07ff174a11e10","type":"tab","label":"ESS charging","disabled":false,"info":"","env":[]},{"id":"8ff595318edc8f68","type":"server-state-changed","z":"03a07ff174a11e10","name":"Tempo demain","server":"e187081d.522548","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.tempo_demain","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":400,"wires":[["d2be1c8798d6a94b"]]},{"id":"d2be1c8798d6a94b","type":"switch","z":"03a07ff174a11e10","name":"Switch couleur","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"TEMPO_BLEU","vt":"str"},{"t":"eq","v":"TEMPO_BLANC","vt":"str"},{"t":"eq","v":"TEMPO_ROUGE","vt":"str"},{"t":"eq","v":"NON_DEFINI","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":220,"y":320,"wires":[["882ac79a448c3ff5","a3b53d4c2fea19ad"],["b1968273fe677df9","83c219867a1c742d","dc6d97f5a6a54c16"],["f259b5113bb3a749","403255bf6645e899","e00e064958e4ccd5"],[]]},{"id":"59e063edbec6a8aa","type":"api-call-service","z":"03a07ff174a11e10","name":"Grid charge OFF","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["switch.battery_charge_from_grid"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":120,"wires":[["2ca76e95e171f4aa"]]},{"id":"3a784d3913969b27","type":"api-call-service","z":"03a07ff174a11e10","name":"Excess to grid","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"select","service":"select_first","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["select.battery_excess_pv_energy_use_in_tou"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":140,"y":760,"wires":[[]]},{"id":"54967e49970c5254","type":"api-call-service","z":"03a07ff174a11e10","name":"Excess to battery","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"select","service":"select_last","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["select.battery_excess_pv_energy_use_in_tou"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":950,"y":400,"wires":[["6a1639bcadb77b49"]]},{"id":"340bcd57b44313a7","type":"api-call-service","z":"03a07ff174a11e10","name":"Excess to battery","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"select","service":"select_last","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["select.battery_excess_pv_energy_use_in_tou"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":720,"wires":[[]]},{"id":"0b3b7c7bb9e157f9","type":"api-call-service","z":"03a07ff174a11e10","name":"Grid charge OFF","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["switch.battery_charge_from_grid"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":950,"y":360,"wires":[["54967e49970c5254"]]},{"id":"55c23718a29ab2de","type":"api-call-service","z":"03a07ff174a11e10","name":"Discharge to 20%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_discharge_soc"],"data":"{\"value\":20}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":690,"y":80,"wires":[["d90437b55e1ea821"]]},{"id":"f57219c2d1cbfe93","type":"api-call-service","z":"03a07ff174a11e10","name":"Discharge to 20%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_discharge_soc"],"data":"{\"value\":20}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":320,"wires":[["91ecc05810b31259"]]},{"id":"882ac79a448c3ff5","type":"ha-wait-until","z":"03a07ff174a11e10","name":"wait for 22:00","server":"e187081d.522548","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"22:00","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":480,"y":80,"wires":[["55c23718a29ab2de"]]},{"id":"d90437b55e1ea821","type":"api-call-service","z":"03a07ff174a11e10","name":"Charge to 100%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_charge_soc"],"data":"{\"value\":100}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":80,"wires":[["59e063edbec6a8aa"]]},{"id":"91ecc05810b31259","type":"api-call-service","z":"03a07ff174a11e10","name":"Charge to 100%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_charge_soc"],"data":"{\"value\":100}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":320,"wires":[["0b3b7c7bb9e157f9"]]},{"id":"a74bcd534039c830","type":"api-call-service","z":"03a07ff174a11e10","name":"Charge to 100%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_charge_soc"],"data":"{\"value\":100}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":720,"wires":[["340bcd57b44313a7"]]},{"id":"8a27a414b21db6d6","type":"api-call-service","z":"03a07ff174a11e10","name":"TOU 3:00 23:59 -","server":"e187081d.522548","version":5,"debugenabled":true,"domain":"huawei_solar","service":"set_tou_periods","areaId":[],"deviceId":[],"entityId":[],"data":"{\"periods\":\"03:00-23:59/1234567/-\",\"device_id\":\"4f1c2381da520ac3261aed46ff17811b\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":150,"y":600,"wires":[[]]},{"id":"9c83f1ae804cdc5f","type":"api-call-service","z":"03a07ff174a11e10","name":"Grid charge OFF","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["switch.battery_charge_from_grid"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":150,"y":720,"wires":[[]]},{"id":"5a65fef314094541","type":"api-call-service","z":"03a07ff174a11e10","name":"Charge to 100%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_charge_soc"],"data":"{\"value\":100}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":150,"y":640,"wires":[[]]},{"id":"81b2dbbdaa1afc59","type":"api-call-service","z":"03a07ff174a11e10","name":"Discharge to 3%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_discharge_soc"],"data":"{\"value\":3}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":150,"y":680,"wires":[[]]},{"id":"c4252b1ed884d68b","type":"comment","z":"03a07ff174a11e10","name":"Summer","info":"","x":120,"y":560,"wires":[]},{"id":"e15c56ac6befa546","type":"comment","z":"03a07ff174a11e10","name":"Winter","info":"","x":90,"y":40,"wires":[]},{"id":"bbf94447df3444cc","type":"comment","z":"03a07ff174a11e10","name":"Blue","info":"","x":450,"y":40,"wires":[]},{"id":"7241f9310589d0f6","type":"comment","z":"03a07ff174a11e10","name":"White","info":"","x":450,"y":280,"wires":[]},{"id":"4614e832d5522516","type":"comment","z":"03a07ff174a11e10","name":"Red","info":"","x":430,"y":480,"wires":[]},{"id":"2ca76e95e171f4aa","type":"api-call-service","z":"03a07ff174a11e10","name":"Excess to grid","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"select","service":"select_first","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["select.battery_excess_pv_energy_use_in_tou"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":160,"wires":[["e2bcacebe4c2c595"]]},{"id":"b1968273fe677df9","type":"ha-wait-until","z":"03a07ff174a11e10","name":"wait for 21:59","server":"e187081d.522548","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"21:59","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":480,"y":320,"wires":[["f57219c2d1cbfe93"]]},{"id":"6a1639bcadb77b49","type":"api-call-service","z":"03a07ff174a11e10","name":"TOU 6:00 22:00","server":"e187081d.522548","version":5,"debugenabled":true,"domain":"huawei_solar","service":"set_tou_periods","areaId":[],"deviceId":[],"entityId":[],"data":"{\"periods\":\"06:00-22:00/1234567/-\",\"device_id\":\"4f1c2381da520ac3261aed46ff17811b\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":440,"wires":[[]]},{"id":"e2bcacebe4c2c595","type":"api-call-service","z":"03a07ff174a11e10","name":"TOU 21:50 22:00","server":"e187081d.522548","version":5,"debugenabled":true,"domain":"huawei_solar","service":"set_tou_periods","areaId":[],"deviceId":[],"entityId":[],"data":"{\"periods\":\"21:50-22:00/1234567/-\",\"device_id\":\"4f1c2381da520ac3261aed46ff17811b\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":200,"wires":[[]]},{"id":"eb0310c0d90d874d","type":"api-call-service","z":"03a07ff174a11e10","name":"Grid charge OFF","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"switch","service":"turn_off","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["switch.battery_charge_from_grid"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":680,"wires":[[]]},{"id":"56dbf2792a97da1e","type":"comment","z":"03a07ff174a11e10","name":"Avoid parasitic charge during red day","info":"","x":990,"y":640,"wires":[]},{"id":"fc83998c26b51363","type":"comment","z":"03a07ff174a11e10","name":"End charge SOC should depend on weather forecast","info":"","x":1000,"y":520,"wires":[]},{"id":"48677e76e04bbcce","type":"api-call-service","z":"03a07ff174a11e10","name":"Discharge to 1%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_discharge_soc"],"data":"{\"value\":1}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":680,"wires":[["eb0310c0d90d874d","a74bcd534039c830"]]},{"id":"d4c77b01da61d276","type":"api-call-service","z":"03a07ff174a11e10","name":"Discharge to 5%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_end_of_discharge_soc"],"data":"{\"value\":5}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":360,"wires":[["91ecc05810b31259"]]},{"id":"f259b5113bb3a749","type":"ha-wait-until","z":"03a07ff174a11e10","name":"wait for 10:00","server":"e187081d.522548","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"10:00","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":460,"y":720,"wires":[["48677e76e04bbcce"]]},{"id":"83c219867a1c742d","type":"ha-wait-until","z":"03a07ff174a11e10","name":"wait for 10:00","server":"e187081d.522548","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"10:00","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":480,"y":400,"wires":[["d4c77b01da61d276"]]},{"id":"a3b53d4c2fea19ad","type":"ha-wait-until","z":"03a07ff174a11e10","name":"wait for 10:00","server":"e187081d.522548","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"10:00","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":480,"y":120,"wires":[["55c23718a29ab2de"]]},{"id":"dc6d97f5a6a54c16","type":"ha-wait-until","z":"03a07ff174a11e10","name":"wait for 06:00","server":"e187081d.522548","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"06:00","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":480,"y":360,"wires":[["d4c77b01da61d276"]]},{"id":"403255bf6645e899","type":"ha-wait-until","z":"03a07ff174a11e10","name":"wait for 06:00","server":"e187081d.522548","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"06:00","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":460,"y":680,"wires":[["48677e76e04bbcce"]]},{"id":"e00e064958e4ccd5","type":"ha-wait-until","z":"03a07ff174a11e10","name":"wait for 15:00","server":"e187081d.522548","version":2,"outputs":1,"entityId":"sensor.time","entityIdFilterType":"exact","property":"state","comparator":"is","value":"15:00","valueType":"str","timeout":"0","timeoutType":"num","timeoutUnits":"seconds","checkCurrentState":true,"blockInputOverrides":true,"outputProperties":[],"entityLocation":"data","entityLocationType":"none","x":460,"y":560,"wires":[["b719229ece6196ac"]]},{"id":"b719229ece6196ac","type":"api-call-service","z":"03a07ff174a11e10","name":"Grid Charge ON","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["switch.battery_charge_from_grid"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":700,"y":560,"wires":[["031d836c1c4f1231"]]},{"id":"031d836c1c4f1231","type":"api-call-service","z":"03a07ff174a11e10","name":"Grid Charge to 100%","server":"e187081d.522548","version":5,"debugenabled":false,"domain":"number","service":"set_value","areaId":[],"deviceId":["4f1c2381da520ac3261aed46ff17811b"],"entityId":["number.battery_grid_charge_cutoff_soc"],"data":"{\"value\":100}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":560,"wires":[["29250f204b3fcb25"]]},{"id":"29250f204b3fcb25","type":"api-call-service","z":"03a07ff174a11e10","name":"TOU 6:00 22:00 - 02:00 05:59","server":"e187081d.522548","version":5,"debugenabled":true,"domain":"huawei_solar","service":"set_tou_periods","areaId":[],"deviceId":[],"entityId":[],"data":"{\"periods\":\"06:00-22:00/1234567/-\\n02:00-05:59/1234567/+\",\"device_id\":\"4f1c2381da520ac3261aed46ff17811b\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":890,"y":600,"wires":[[]]},{"id":"73cb8f2f853d6f6c","type":"comment","z":"03a07ff174a11e10","name":"Set night charge at 15:00 before hibernation to be sure","info":"","x":580,"y":520,"wires":[]},{"id":"e187081d.522548","type":"server","name":"Home Assistant","addon":true}]

I would like to create a notification showing the daily total value from the solar_energy_riemann total in my energy dashboard is there any sensor where I can get this value?

Hi

Does anyone know why sun2000 started (again) constantly losing connection after the last HA update?

only works if HA’s hardware is rebooted, and after a couple of minutes fails again

Logger: pymodbus.logging
Source: custom_components/huawei_solar/__init__.py:92
Integration: Huawei Solar ([documentation](https://github.com/wlcrs/huawei_solar/wiki), [issues](https://github.com/wlcrs/huawei_solar/issues))
First occurred: 18:35:55 (6 occurrences)
Last logged: 18:45:29

* Failed to connect
* Failed to connect [Errno 113] Connect call failed ('192.168.200.1', 66
Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py:184
First occurred: 18:36:00 (1 occurrences)
Last logged: 18:36:00

Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 500, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 178, in create
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 107, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 241, in get
    return (await self.get_multiple([name], slave))[0]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 276, in get_multiple
    response = await self._read_registers(registers[0].register, total_length, slave)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 396, in _read_registers
    async with self._communication_lock():
  File "/usr/local/lib/python3.11/contextlib.py", line 204, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 145, in _communication_lock
    raise err
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 141, in _communication_lock
    await asyncio.wait_for(self._client.connected_event.wait(), WAIT_FOR_CONNECTION_TIMEOUT)
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 502, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

I’m not sure if it’s the best or correct way, but this is how I do it


I use the TOU (time of use) periods to have the periods where I want the battery to be charging or discharging.

I then switch between “maximise self consumption” modes and “time of use” to determine if I want the battery to be used or not.

For periods where I want to charge the battery, I’m in TOU mode with a period of “+” and “charge from grid” enabled, with a limit of what I want (usually 3000).

To stop charging, but without discharging, I disable charge from grid.

Period 1: 00:00-07:59/1234567/+
Period 2: 08:00-13:59/1234567/-
Period 3: 14:00-17:59/1234567/+
Period 4: 18:00-21:59/1234567/-
Period 5: 22:00-23:59/1234567/+

For any other time when I want to use the battery I move back to “Maximise Self Consumption”.

Anyone else got a problem with the battery working mode as of late?

Have a script for changing the battery working mode that’s been working for 6 month. Haven’t used it for a few weeks and now it cant change to anything other then Adaptive. All other modes render an error.
Have updated to the latest 1.3.1 version.
Is there any change to the naming for calling the different work modes?

See below for a snippet of the code from my testing in the Development tools


service: select.select_option
target:
  entity_id: select.battery_working_mode
data:
  option: Time Of Use

edit:
If I try anything other than “Adaptive” as option, HA returns that its not valid option for select.battery_working_mode
Also tried to revert to V1.3.0 but same fault.

had to install HA Beta to solve this


Okey so I have solved this after some fiddeling.
After going back and forth between different version of this integration and finally updating HA to 2024.1
I got a new error message that actually showed all valid options and not only a general error.

So for anyone who stumble across this, here is the correct options that you can use to
change the battery working mode:

adaptive
fixed_charge_discharge
maximise_self_consumption
fully_fed_to_grid
time_of_use_luna2000

This is a sample of my code that now works

service: select.select_option
target:
  entity_id: select.battery_working_mode
data:
  option: time_of_use_luna2000
1 Like

Hi,
I’m attempting to integrate my SUN2000-10KTL-M1 into my HA running on a RP4 and double checked that unrestricted Modbus TCP is enabled in the communication settings of the inverter via the installer account in FusionSolar. I tried all network connection variants mentioned in the documentation and adjusted the installer PW in const.py to match mine but keep running into below error and out of ideas. Any help and suggestions are highly appreciated.

Logger: huawei_solar.huawei_solar
Source: /usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py:184
First occurred: 00:21:40 (11 occurrences)
Last logged: 20:19:51

Aborting client creation due to error.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 349, in _do_read
    raise ConnectionInterruptedException(message)
huawei_solar.exceptions.ConnectionInterruptedException: Modbus client is not connected to the inverter.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 178, in create
    await huawei_solar._initialize()
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 107, in _initialize
    self.time_zone = (await self.get(rn.TIME_ZONE)).value
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 241, in get
    return (await self.get_multiple([name], slave))[0]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 276, in get_multiple
    response = await self._read_registers(registers[0].register, total_length, slave)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 398, in _read_registers
    return await _do_read()
           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 159, in retry
    await _call_handlers(on_giveup, **details, exception=e)
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 37, in _call_handlers
    await handler(details)
  File "/usr/local/lib/python3.11/site-packages/backoff/_async.py", line 16, in f
    return coro_or_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/huawei_solar/huawei_solar.py", line 327, in backoff_giveup
    raise ReadException(f"Failed to read register {register} after {details['tries']} tries")
huawei_solar.exceptions.ReadException: Failed to read register 43006 after 6 tries