Integration Solar inverter huawei 2000L

1 Like

how did set up the historical chart in dashboard?

I’m using the Custom “Plotly Graph Card” from HACS.

Hi Michele

Thank you for your answer


the problem does not lie in the graph where the data is correct, what I can not do, is to correctly position the values of the graph in the respective bubbles 


I use Lovelace, and this is the code in body1.

I use the sensors created by the integration of EmilV2 “Huawei Solar”

  - type: horizontal-stack
    cards:
    

      - type: 'custom:tesla-style-solar-power-card'
        name: Flusso Energia
        # 7 flows between bubbles
        grid_to_house_entity: sensor.grid_consumption                           #
        grid_to_battery_entity: sensor.battery_day_charge                       #grid_battery_charge
        generation_to_grid_entity: sensor.grid_exported                         #grid_feed_in
        generation_to_battery_entity: sensor.battery_day_charge                 #battery_charging
        generation_to_house_entity: sensor.grid_consumption                     #solar_consumption
        battery_to_house_entity: sensor.battery_day_discharge                   #battery_consumption
        battery_to_grid_entity: sensor.input_power                              #battery_to_grid
        
        
#        # extra values to show as text above icons
        battery_extra_entity: sensor.battery_day_charge                          #battery_charge
        house_extra_entity: sensor.internal_temperature                          #current_temperature
#        generation_extra_entity: sensor.percent_cloud_coverage                  #percentuale di copertura nuvolosa??
#        grid_extra_entity: sensor.monthly_feed_in
        
        
#        # optional appliances with consumption and extra values
#        appliance1_consumption_entity: sensor.car_consumption
#        appliance1_extra_entity: sensor.car_battery_state_of_charge        
#        appliance1_icon: mdi:water-boiler                              #icona consumo 1 elettrodomestico
        
#        appliance2_consumption_entity: sensor.heating_consumption
#        appliance2_extra_entity: sensor.heating_operation
        
        
#        # optional 4 main bubble icons for clickable entities
        grid_entity: sensor.grid_active_power                                      #grid_consumption
        house_entity: sensor.active_power                                          #house_consumption
        generation_entity: sensor.input_power                                      #solar_yield
        battery_entity: sensor.charge_discharge_power                              #battery_consumption

Hi!
I just got my solar panels up and running, and the integration seem to be working great.
I am also interested in controlling the battery in home assistant. I live in Sweden and have electricity-prices that change every hour. For example, tomorrow between 05:00 and 06:00 the price is 21 swedish öre / kWh. Between 08:00 and 09:00 the price is 247 öre. That is 11 times more. Hopefully, the sun is giving me energy in the morning, which would be better to sell and delay the battery charge until 11:00 when the price is back down to 30 öre. I can see the configuration parameter to change the working mode in home assistant. But, are the time-parameters (to set when to charge/discharge) also available? Otherwise, could those be added? I could probably help with that. My first problem is that if I try to change the battery Working Mode, I get a “permission denied”. I have configured the installer-password, and is using the internal access-point through an OpenWRT-router. What would be the best way of debugging this to find out what is the problem?
Thanks!

Your battery will only charge with the excess electricity produced by your solar panels. So I don’t see why you want to delay charging the battery until later? You want to rather inject it to the grid in the morning?

Feel free to make a bug report with your permission denied issue, but include extensive logging (cfr bottom of readme ).

This is already implemented in the underlying library, but it’s very hard to expose as configurable entities in HA. There is nothing that has close to all the necessary attributes: start time, end time, day(s) of week + charge/discharge. All of these must be replicated for each charge/discharge TOU setting.

To be able to add this to HA, we need a custom frontend component. If anybody wants to volunteer in making this, I’m open for collaboration!

Hello! Two weeks I spent in configurations and I still got the “Reading from the inverter failed.” message in wclrs huawei_solar integration. I am connected to the inverter AP with address 192.168.8.1, the port 502 is open and also have ping to 192.168.8.1. When I start the emilv2 integration everything wokrs fine, but when I start the wclrs integration I got that message. Does anyone knows how to fix that? Thank you!

beware! sensor.grid_consumption is an energy sensor and not a power sensor!

you can’t configure a power integration such as tesla-style-solar-power-card with energy sensors

Yes. Since I get paid (approximately) the same when selling electricity to the grid as when buying, I want to sell electricity during expensive hours.
If we make a simplified example. In the morning, the price is 2 kr / kWh. If I charge my 5 kWh battery during this time, I will not sell electricity and get 2 * 5 = 10 kr. A couple of hours later, the price is 0,2 kr / kWh. If I charge the battery then, I will not sell electricity for 0,2 * 5 = 1 kr. So I have made 10 - 1 = 9 kr in profit by just delaying the charging of the battery for a couple of hours.
This works due to the sometimes extreme difference in electricity prices here in Sweden. And often it is expensive in the morning, when the sun rises and the battery starts charging after being discharged during the night.

Thank you! I will take a closer look. But there should not be any configuration (apart from configuring the admin-pwd) that must be done for it to work?

Interesting! Is it possible to run those api-calls from an automation/script in HA? I do not really need UI-configurable entities for this.

I will try to find time to understand the HA-framework. I am reasonably skilled at programming, but I have not looked into the internals of HA.

As a follow-up on this: I configured extensive logging, restarted HA, and of course it worked!
That is good. I can now see the battery changing from “Maximise self consumption” to “TOU” (I verified that FusionSolar also updated this). So a simple reboot solved it!
So now I am really curious of getting to the time-settings.
Do we need additional code to use them at all, or can I test somehow by calling the API from HA?

The tou settings are not exposed in HA due to the mentioned complexity which HA does not support

I would guess that it is simple to achieve by setting the maximum charging power to 0? No need to fiddle with those complicated TOU settings.

Hmmm. That is a very interesting point. I did not think about that solution. I saw the TOU in the Huawei documentation, and got stuck in that thought
 Yes, I guess modifying both max charge and max discharge parameters should give me full control. Thanks for the suggestion!

1 Like

I tested this manually today. Works perfectly. BUT (there is always a but, isn’t it
), there seems to be some kind of timeout (or logout time) in Huawei. After some time, you start getting “Permission denied” when writing to the registers. If you only reload the Huawei-integration, it starts working again. So maybe, you should have some kind of re-login (or reconnect) when this happens? This morning, it worked for at least 2,5 hours, but when I tried to change this evening, the permission denied started. My guess is that Huawei somehow log out the write permission. Reading registers keeps working, because I can see my sensors updating. I will add a bug-report. I have my home-assistant on debug-log, so hopefully it contains enough info.

Thank you @wlcrs for the very fast update on the permission bug! I have updated to the new 1.01 version now and will check that it works!

which of these entities is used solar to house energy? image
Lovelace code. it was working fine for me until i had to change back to sd card to a failure of the SSD. now I see the solar used in the home as zero.

type: custom:tesla-style-solar-power-card
name: 'Power Flow '
threshold_in_k: 4
hide_inactive_lines: 0
show_gap: true
change_house_bubble_color_with_flow: 1
grid_to_house_entity: sensor.template_grid_consumption
generation_to_grid_entity: sensor.template_grid_feed_in
generation_to_house_entity: sensor.template_curent_solar_consumption
house_entity: sensor.house_consumption_daily
generation_entity: sensor.daily_yield
grid_entity: sensor.grid_import_solar_daily_energy
house_extra_entity: sensor.grid_import_solar_daily_energy
generation_extra_entity: sensor.daily_yield
grid_extra_entity: sensor.grid_export_solar_daily_energy

configuration.yaml code

sensor:
  - platform: template
    sensors:
      # sensor used to show power flow from Panels to Grid, but shows a negative at night
      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

even though there is no difference in code tesla card config code - Diff Checker

Finally got my connection to inverter working in a very fun way.
Using an extender besides Inverter → Another Extender extending that single and then outputting a Eth to a Eth dongle to my NUC HA server which runs Debian/Proxmox.

Just wanted to say thank you to the person making this integration and the information around this.
The hardest part was to get 2 networks into one VM that allowed HA to use both since I am a linux noob =)

1 Like

Hello.
I got a question about something this thread started which is this solution:

I am a bit of a configuration.yalm, I try to do all in the GUI and I get issues depending on my formatting as:
“duplicated mapping key at line sensor”
“homeassistant missed comma between flow collection entries at line”

Does anyone have a working example how to add these 2 setups to configuratiion.yalm which does not collide with other sensors?
Feels like the “-name” one is missing something?

can you post the code you are using?

Pretty much trying to add this to configuration.yalm as described, changing the W of inverter and verified the sensor name.

- name: "input_power_with_efficiency_loss"
  unique_id: "input_power_with_efficiency_loss"
  unit_of_measurement: "W"
  device_class: power
  state_class: measurement
  state: >-
    {% set inverter_rating = 10000 %} # adjust this value to the rated power of your inverter
    {% set inpower = states('sensor.input_power')|float(0) %}
    {% if inpower < (inverter_rating*0.1) %}
      {{ inpower * 0.90 }}
    {% elif inpower < (inverter_rating*0.2) %}  
      {{ inpower * 0.95 }}
    {% else %}
      {{ inpower * 0.98 }}
    {% endif %}

This gives me preview errror of:

end of the stream or a document separator is expected at line 98, column 1:
    - name: "input_power_with_effici ... 
    ^