As @dd77 mentioned here is his code to be pasted in configuration.yaml
template:
- sensors:
template_grid_feed_in:
friendly_name: "Solar 2 Grid"
unit_of_measurement: 'W'
device_class: power
value_template: >
{% if states('sensor.grid_active_power') | int > 0 %}
{{ states('sensor.grid_active_power') }}
{% else -%}
0
{% endif %}
# sensor used to show power flow from Panels to Grid and doesn't allow it to show a negative number only positive numbers
template_grid_consumption:
friendly_name: "Grid 2 House"
unit_of_measurement: 'W'
device_class: power
value_template: >
{% if states('sensor.grid_active_power') | int > 0 %}
0
{% else -%}
{{ (states('sensor.grid_active_power') | int) | abs }}
{% endif %}
# shows the solar power being fed to the house and doesn't allow it to show a negative number only positive numbers
template_curent_solar_consumption:
friendly_name: 'Solar 2 House'
unit_of_measurement: 'W'
device_class: power
value_template: >-
{% if states('sensor.template_grid_consumption') | float > 0 %}
{{ states('sensor.active_power') }}
{% else -%}
{{ (states('sensor.active_power')| float - states('sensor.template_grid_feed_in')| float) }}
{% endif %}
utility_meter:
grid_import_solar_daily_energy:
source: sensor.grid_consumption
cycle: daily
grid_export_solar_daily_energy:
source: sensor.grid_exported
cycle: daily
Hi!
Fyi.
The latest home assistant update finally includes a simple tool to adjust or correct data stored under “Statistic”. In our case for example it helps and make easier to adjust this exporadic issue related to spurius error measured data by grid sensor when a home grid outage/shutdown has taken place.
This is most likely an indentation error.
I am no expert in yaml, but I would advise using VS-code to edit the configuration.yaml file. https://code.visualstudio.com/.
It also gives me some problems with the sensors …, could you kindly still enter your code ayyually in use “.Yaml” there are inconsistencies with the names of the sensors
I tried it, but I just can’t get this card to work properly …
The values are not correct, the energy flows are not correct … I struggle to understand
I renew the question, there is someone who is kindly willing to post their own code (card + configuration.yaml) at least to have a starting point with the correct sensors (those used are from EmilV2), I have always been trying for 2 days with negative results and surely the English language does not help me …
sensor:
- platform: template
sensors:
template_grid_feed_in:
friendly_name: "Solar 2 Grid"
unit_of_measurement: "W"
device_class: power
value_template: >
{% if states('sensor.grid_active_power') | int > 0 %}
{{ states('sensor.grid_active_power') }}
{% else -%}
0
{% endif %}
# sensor used to show power flow from Panels to Grid and doesn't allow it to show a negative number only positive numbers
template_grid_consumption:
friendly_name: "Grid 2 House"
unit_of_measurement: "W"
device_class: power
value_template: >
{% if states('sensor.grid_active_power') | int > 0 %}
0
{% else -%}
{{ (states('sensor.grid_active_power') | int) | abs }}
{% endif %}
# shows the solar power being fed to the house and doesn't allow it to show a negative number only positive numbers
template_curent_solar_consumption:
friendly_name: "Solar 2 House"
unit_of_measurement: "W"
device_class: power
value_template: >-
{% if states('sensor.template_grid_consumption') | float > 0 %}
{{ states('sensor.active_power') }}
{% else -%}
{{ (states('sensor.active_power')| float - states('sensor.template_grid_feed_in')| float) }}
{% endif %}
this is the correct indentation, you will need to check in the dev. tools that you actually have the correct values in those sensors after restarting.
I also had similar problem with Emilv2 integration but in my situation I lose connection after upgrade my inverter to 141 firmware. When i downgrade to ver. 136 integration start to work although home assistant is 2022.4.5
It seems they have released a new firmware version for SUN2000L inverters, V200R001C00SPC119.
The one I’m using now is V200R001C00SPC117 and it’s working nicely with the internal Wifi and a WiFi Bridge, and I was wondering if anybody has tried with version 119.
I’m not too confident to update as I’m concerned that they will definitely close TCP modbus over internal WiFi at some point. I’ve seen a moderator write this in a Huawei forum post:
The SUN2000L1 supports data read and write only when the FusionSolar app is directly connected to the inverter at the local end. Modbus TCP connections to devices except FusionSolar will not be supported in the future.
Also, if a customer needs to use a third-party device, use Modbus TCP to connect to the device. Currently, only Dongle supports this function and must comply with the Modbus TCP protocol provided by Dongle.
I did the upgrade to the new 119 firmware and can attest that the integration still works as good as spc117.
The integration communicates in exactly the same way as the “device commissioning” part of the FusionSolar app. I even reverse-engineered the login and subsequent heartbeat methods. I think it would be very impractical for Huawei to change this interface in such a way that the integration would completely break.
Using Hass in a docker (Synonlogy) connected via eth0. How can I connect the inverter local AP over wlan. My NAS is to far away from the Inverter AP for direct bridge. The inverter got Wlan/lan access but not direct NAS<->Inverter AP.