energy dashboard: on solar energy production, battery consumption is added
This give a fake solar energy production at night. How can I subs tract the battery use to correct this?
See picture
I’m just gonna kick this topic because I experience the same problem.
Hopefully someone can help us solve this problem
The following picture was during my holiday so there’s no real consumption but it’s shows that my battery is charged between 9.00 and 18.00 and that the battery discharged is displayed as solar energy.
I’m experiencing the same issue, with the same setup. I assume you’re using this integration too: GitHub - Emilv2/huawei_solar: Home Assistant custom component for Huawei inverters.
@Emilv2, would it be possible to publish an aggregated yield sensor, subtracting the battery discharge? I tried to implement it with a template sensor, but HA’s Energy panel doesn’t seem to support it:
# in this example, there are 2 inverters and 1 battery
template_solar_total_yield:
friendly_name: "Accumulated solar yield"
unit_of_measurement: 'kWh'
device_class: power
value_template: >
{{ (states('sensor.inverter_total_yield_1') | float + states('sensor.inverter_total_yield_2') | float - states('sensor.battery_total_discharge_1') | float ) }}
I managed to get it to work!
I was using the old sensor syntax, and the wrong device_class
.
For anyone facing the same issue (CCing @Plaatjesdraaier @hifihifi), this did the trick for me:
template:
sensor:
- name: "Accumulated solar yield"
unique_id: sensor.template_solar_total_yield_2
device_class: energy
unit_of_measurement: 'kWh'
state_class: measurement
state: >
{{states('sensor.inverter_total_yield_1') | float + states('sensor.inverter_total_yield_2') | float + states('sensor.battery_total_charge_1') | float}}
attributes:
last_reset: '1970-01-01T00:00:00+00:00'
availability: >
{{ not (is_state("sensor.inverter_total_yield_1", "unavailable") or is_state("sensor.inverter_total_yield_2", "unavailable") or is_state("sensor.battery_total_charge_1", "unavailable")) }}
Now I’ve discovered modbus doesn’t work when the internet is down : https://forum.huawei.com/enterprise/en/huawei/m/ViewThread.html?tid=1019116&pid=5374760&lang=en