hello,
I have just install PV system and a huawei solar inverter.
I have ask the provider to enable tcp-modbus and upgrade the firmware of the dongle.
I have installed the huawai solar integration through HACS. and connect to the dongle on port 502 and get many parameters
I guess the pv production is sensor.inverter_active_power
I guess power to grid is sensor.power_meter_active_power
cannot find household consumption
no idea how to integrate the energy dashbord.
can you help ?
Hey there, if you look at the wiki of the repo, you should find what you are looking for.
What I read from the screenshots is:
Total Yield could be set for Solar Panels.
Total charge/discharge for battery.
Exported and Consuption for the grid.
Huawei Solar Integration
I had a Huawei solar inverter installed along with 21 panels of 450W on my roof, without a battery.I found the offered integrations unpalatable and preferred to create my own simpler version. Myintegration does not include a battery and does not take electricity prices into account My inverter has a dongle that connects to my network. The address is on the router (box for theFrench); I fixed the IP address in the DHCP settings. Confirm with the installer that the TCPModbus value is enabled and that the firmware version matches the documentation(V200R022C10SPC114 for me).
Installation
Through HACS, install Huawei Solar and reboot. In settings, integration, add Huawei Solar. Enter the parameters IP, port 502, slave ID 1, elevate permissions. No need for an installer profile. Set thehidden parameters to enable. It created 7 entities: inverter, meter, and 5 inverters. I also integrated the Zappi car charger from Energi, but thatâs another story.It is easy to find the following parameters:
**name sensorname myname **
Production sensor.inverter_active_power prodpv
Power togrid sensor.power_meter_active_power togrid
Additional Parameters
I also need the following additional parameters. I created 3 templates with the availability option. Ittook me a day to figure out how to do it. A simple subtraction did not work.
name sensorname myname Formule
Puissance conso sensor.energie_conso prodpv (prod - togrid)|abs
Puissance togridsold sensor.energie_togridpos togridpos togrid if togrid > 0 else 0
Puissance consomées des PV energie_consopv consopv conso if togrid > 0 else
prodpv
I love Markdown cards and made the following one
markdown card.
-## huawei solar
inverter active power = PV {{ (states(âsensor.inverter_active_powerâ) | float) }}
power meter active = togrid {{(states(âsensor.power_meter_active_powerâ) | float) }}
difference = homeconso {{ (states(âsensor.inverter_active_powerâ) | float) -
(states(âsensor.power_meter_active_powerâ) | float) }}
***variable puissance
variable energie_conso {{ (states(âsensor.energie_consoâ))}}
variable energie_prodpv {{ (states(âsensor.energie_prodpvâ))}}
variable energie_togridpos {{ (states(âsensor.energie_togridposâ))}}
variable energie_consopv {{ (states(âsensor.energie_consopvâ))}}
variable energie_togrid {{ (states(âsensor.energy_togridâ))}}
****energy
variable conso_energy {{ (states(âsensor.conso_energyâ))}}
variable togridpos_energy {{ (states(âsensor.togridpos_energyâ))}}
variable prodpv_energy {{ (states(âsensor.prodpv_energyâ))}}
Carte Graphique Historique
esy to do example
type: history-graph
entities:
- entity: sensor.energie_conso
- entity: sensor.energie_consopv
- entity: sensor.energie_prodpv
title: Consommation et prod maison
hours_to_show: 8
Template
-# togrid - name: âenergie_togridâ
unit_of_measurement: âWâ
state: â{{ (states(âsensor.power_meter_active_powerâ) | float(0)) }}â
-# prodpv plus comprĂ©hensibe - name: âenergie_prodpvâ
unit_of_measurement: âWâ
state: â{{ (states(âsensor.inverter_active_powerâ) | float(0)) }}â
-# consommation totale - name: âenergie_consoâ
unit_of_measurement: âWâ
device_class: power
state_class: measurement
unique_id: energie_conso
state: >
{% set prodpv = states(âsensor.inverter_active_powerâ) | float(0) %}
{% set togrid = states(âsensor.power_meter_active_powerâ) | float(0) %}
{{ (prodpv - togrid)|abs }}
availability: >
{{ states(âsensor.inverter_active_powerâ) not in [âunavailableâ, âunknownâ, ânoneâ] and states(âsensor.power_meter_active_powerâ)
not in [âunavailableâ, âunknownâ, ânoneâ] }}
-# energie vendue - name: âenergie_togridposâ
unit_of_measurement: âWâ
state: >
{% set togrid = states(âsensor.power_meter_active_powerâ) | float(0) %}
{{ togrid if togrid > 0 else 0 }}
availability: >
{{ states(âsensor.inverter_active_powerâ) not in [âunavailableâ, âunknownâ, ânoneâ] }}
device_class: power
unique_id: energie_togridpos
state_class: measurement
-# consopv = pv si togrid negatif - name: âenergie_consopvâ
unit_of_measurement: âWâ
state: >
{% set prodpv = states(âsensor.inverter_active_powerâ) | float(0) %}
{% set togrid = states(âsensor.power_meter_active_powerâ) | float(0) %}
{% set conso = states(âsensor.energie_consoâ) | float(0) %}
{{ conso if togrid > 0 else prodpv }}
availability: >
{{ states(âsensor.inverter_active_powerâ) not in [âunavailableâ, âunknownâ, ânoneâ] and states(âsensor.power_meter_active_powerâ)
not in [âunavailableâ, âunknownâ, ânoneâ] }}
device_class: power
unique_id: energie_consopv
state_class: measurement
Sensor
-# Consommation totale - platform: integration
source: sensor.energie_conso
name: âconso_energyâ
unit_prefix: k
round: 2
method: trapezoidal
-# Energie_vendue - platform: integration
source: sensor.energie_togridpos
name: âtogridpos_energyâ
unit_prefix: k
round: 2
unit_time: h
method: trapezoidal
-# - platform: integration
source: sensor.energie_prodpv
name: âProdpv_energyâ
unit_prefix: k
round: 2
unit_time: h
method: trapezoidal
unique_id: prodpv_energy
Energy tab can be easily done.
Hope ths help
Cheers
Hello guys, I join the request to understand how to implement the total household consumption per day. I canât figure out how to configure it.
Iâm not a developer, so please explain it in a simple way.
It would be helpful if you provided more information where you stand.
Did you set up the energy dashboard? Then you can see the house consumption there and get the graph with energy cards on your dashboard.
If you want a sensor install this prefferably with HACS then include this in your configuration.yaml like this:
homeassistant:
packages:
huawei_solar_energy_flow_card: !include huawei-solar-energy-flow-card-package.yaml
Be sure to get the file names right.
To upload or edit code use the addons File Editor or Terminal & SSH
I have done this
But the graph does not correspond related to fusion solar app (I know that there is a delay)
For instance, I have Solar production in my card = 12,15kw, but into fusion solar is 16,15kw
So you use the Cloud intergration with fusion solar?
If you want local control, better data resolution and more sensors use the setup I wrote above.
If you are wondering how to get the home consumption just add Importata and Autopdodatta. Not 100% sure what that means but it seems to add up.
Generally your house consumption is Import + Solar - Battery Input + Battery Output - Export
Iâm using Huawei solar via hacs with the information retrived in real time via SDongle huawei.
How i can add " just add Importata and Autopdodatta" ?
Sorry but iâm new
Thanks
Oh yes sorry forgot to add that.
Under settings, devices, helpers add a template sensor with
Code: {{states('sensor.importata') | float + states('sensor.autopdodatta') | float}}
Unit o.M.: kWh
Device Class: Energy
State Class: total
Iâve created a card to visualiza/manage my Battery but i need an editor to manage TOU Periods
Here my card (i can send the yaml if interested)
Has anyone among you developed this type of editor?
Thanks for your help
Hi everyone,
I wasnât able to find clear information about how to stop the battery from discharging via automation.
What Iâd like to achieve:
When my car is charging, I want to prevent the Huawei battery from discharging (so it doesnât assist the charging load).
After charging, Iâd like to return to the default behavior.
I asked ChatGPT, and it suggested this automation using modbus.write_register
to block battery discharge:
yaml
CopiaModifica
alias: Block battery discharge when charging Tesla
trigger:
- platform: state
entity_id: sensor.teslamate_charging_state
to: 'Charging'
condition: []
action:
- service: modbus.write_register
data:
hub: huawei_inverter
unit: 1
address: 47089
value: 1 # Charge only
mode: single
And this one to restore normal behavior:
yaml
CopiaModifica
alias: Restore battery after Tesla charging
trigger:
- platform: state
entity_id: sensor.teslamate_charging_state
from: 'Charging'
to: 'Disconnected'
condition: []
action:
- service: modbus.write_register
data:
hub: huawei_inverter
unit: 1
address: 47089
value: 0 # Automatic mode
mode: single
But before this, I need to add the Modbus connection in configuration.yaml
:
yaml
CopiaModifica
modbus:
- name: huawei_inverter
type: tcp
host: 192.168.1.xxx # IP address of the inverter or dongle
port: 502
delay: 1
timeout: 3
retries: 10
Does this approach seem correct to you?
Or is there a better/official way to do this with the Huawei inverter?
Thanks!
Till 29-03-2025 my Huawei solar integration worked, bud from dat date it stopped working after an update. I do not know if the home assist update or an update for the dongel or inverter was the problem, but now it is still not working anny more.
Hello,
Iâm facing the same issue! Do you found a solution?
Worked again, my ip address changed of the inverter due to network updates. After reconfiguring the device in HomeAssistant and inserted the new IP, it worked again (FYI @Fofuracer )
same issues here, log says:
Timeout while waiting for connection. Reconnecting
Traceback (most recent call last):
File â/usr/local/lib/python3.13/asyncio/tasks.pyâ, line 507, in wait_for
return await fut
^^^^^^^^^
File â/usr/local/lib/python3.13/asyncio/locks.pyâ, line 213, in wait
await fut
asyncio.exceptions.CancelledErrorThe above exception was the direct cause of the following exception:
Traceback (most recent call last):
File â/usr/local/lib/python3.13/site-packages/huawei_solar/huawei_solar.pyâ, line 141, in _communication_lock
await asyncio.wait_for(
âŠ<2 lines>âŠ
)
File â/usr/local/lib/python3.13/asyncio/tasks.pyâ, line 506, in wait_for
async with timeouts.timeout(timeout):
~~~~~~~~~~~~~~~~^^^^^^^^^
File â/usr/local/lib/python3.13/asyncio/timeouts.pyâ, line 116, in aexit
raise TimeoutError from exc_val
TimeoutError