mletenay / home-assistant-goodwe-inverter

Experimental version of Home Assistant integration for Goodwe solar inverters
https://discord.gg/TaXyWXT
MIT License
143 stars 38 forks source link

Work Mode set but not applied - ES 4.6kw #22

Closed GIJOE-SA closed 2 years ago

GIJOE-SA commented 3 years ago

Hi, although the HA goodwe.set_work_mode service sets the work mode and you can actually see it as set in PV Master it does not take effect. When you reapply in PV Master it does take effect.

tinuva commented 2 years ago

Ok so after looking into this, I think I know what the issue is.

The set work mode code to me looks like it is working 100%. However, we need another service call that in essence "Reboots" the inverter. Even in PV Master this is how it works. If I change the work mode without rebooting the inverter, the work mode doesn't take effect.

I would like to see this functionality in the addon, although I guess there has to be some caution here. We don't want the inverter to reboot too often, but we do need it if we change work mode and also, the reboot means no PV/Battery for about 1-2 minutes fro what I can tell, my inverter switches to grid passthrough only during the reboot process. So essentials do not go down, but PV generation is missing. The voltage shows but 0amp/0watt. The battery also stop charging or stop being used.

Here is my packet captures I did, to reboot the inverter. But I still have to get time to look into them to understand. goodwe-5048es-captures.zip

192.168.241.143 = inverter 192.168.241.11/12 = home assistant ips so will be addon communication

@mletenay I hope this can help to get this to work for us?

mletenay commented 2 years ago

I believe the work mode switching on ES/EM inverters was finally addressed, please verify.

tinuva commented 2 years ago

Can confirm this now works for me in 0.9.7

After setting the mode I can see the inverter reboot, including the click sounds it make and then after the new mode as was set, is in effect.

GIJOE-SA commented 2 years ago

Thank you gents, will only be upgrading by the end of next week when I am back but i am sure if it is working for David it will work on my side.

GIJOE-SA commented 2 years ago

Hi, I decided to to upgrade today remotely and luckily everything worked fine. I can confirm that the mode setting is working thank you very much.

Unfortunately the new way of doing this without the services broke some of my automations. This were particularly helpful when Eskom load shedding shows that there were will be power outages and I used the service to set the discharge depth to 0 (Without restating the Inverter). This forced it basically to use Eskom power and any access solar power to charge batteries through automations with no human intervention.

The new way uses number.depth_of_discharge_on_grid value which I can set but it does not take effect, it even shows on the slide bar that it changed but has no effect until you use the slide bar itself.

Is there another way I can use the new method to achieve this? If not, is it possible to bring the services back?

Thanks for the help

tinuva commented 2 years ago

@GIJOE-SA

You can still use it in automations. I manage my DoD multiple times a day and it still works as previously.

Instead of a service, just update the number.

This works for me:

      - alias: "Set DoD on inverter"
        service: number.set_value
        data:
          value: >
            {{ dod }}
        target:
          entity_id: number.depth_of_discharge_on_grid

My complete script looks (will work for automations too) look like this:

script:
  ######################################################################
  # Re-usable script to set the DoD via input
  ######################################################################
  # Example:
  ######################################################################
  # - service: script.goodwe_set_dod
  #   data:
  #     forecast: "50"
  ######################################################################
  goodwe_set_dod:
    sequence:
      - alias: "Set variables"
        variables:
          dod: >
            {% set forecast_int = forecast|int %}
            {% if forecast_int >= 28 %}70
            {% elif forecast_int >= 23 and forecast_int < 28 %}65
            {% elif forecast_int >= 20 and forecast_int < 23 %}60
            {% elif forecast_int >= 18 and forecast_int < 20 %}55
            {% elif forecast_int >= 16 and forecast_int < 18 %}50
            {% elif forecast_int >= 12 and forecast_int < 16 %}40
            {% elif forecast_int >= 10 and forecast_int < 12 %}30
            {% else %}16{% endif -%}
      - alias: "Set DoD on inverter"
        service: number.set_value
        data:
          value: >
            {{ dod }}
        target:
          entity_id: number.depth_of_discharge_on_grid
      - alias: "Log action taken"
        service: script.log
        data:
          icon: ':zap:'
          object: 'GoodWe'
          message: >
            Setting DoD to {{ dod }} based on {{ forecast }}kWh forecast
tinuva commented 2 years ago

I know it works, because it takes affect as long as you are back in general mode.

Jayksopp commented 2 years ago

@GIJOE-SA

You can still use it in automations. I manage my DoD multiple times a day and it still works as previously.

Instead of a service, just update the number.

This works for me:

      - alias: "Set DoD on inverter"
        service: number.set_value
        data:
          value: >
            {{ dod }}
        target:
          entity_id: number.depth_of_discharge_on_grid

My complete script looks (will work for automations too) look like this:

script:
  ######################################################################
  # Re-usable script to set the DoD via input
  ######################################################################
  # Example:
  ######################################################################
  # - service: script.goodwe_set_dod
  #   data:
  #     forecast: "50"
  ######################################################################
  goodwe_set_dod:
    sequence:
      - alias: "Set variables"
        variables:
          dod: >
            {% set forecast_int = forecast|int %}
            {% if forecast_int >= 28 %}70
            {% elif forecast_int >= 23 and forecast_int < 28 %}65
            {% elif forecast_int >= 20 and forecast_int < 23 %}60
            {% elif forecast_int >= 18 and forecast_int < 20 %}55
            {% elif forecast_int >= 16 and forecast_int < 18 %}50
            {% elif forecast_int >= 12 and forecast_int < 16 %}40
            {% elif forecast_int >= 10 and forecast_int < 12 %}30
            {% else %}16{% endif -%}
      - alias: "Set DoD on inverter"
        service: number.set_value
        data:
          value: >
            {{ dod }}
        target:
          entity_id: number.depth_of_discharge_on_grid
      - alias: "Log action taken"
        service: script.log
        data:
          icon: ':zap:'
          object: 'GoodWe'
          message: >
            Setting DoD to {{ dod }} based on {{ forecast }}kWh forecast

From this do I understand correctly if you set the DoD above the current DoD the invertor will start charging the battery until it reaches that DoD? What do you use to determine the forecast value? Is it based on sol cast? Or do you have a way to include weather forecast etc as well?

tinuva commented 2 years ago

@Jayksopp

From this do I understand correctly if you set the DoD above the current DoD the invertor will start charging the battery until it reaches that DoD?

No. If you set the DoD to lets say 60%, it means, when there is no sunlight and you are in general mode, that the inverter will use 60% of the battery, eg. it will go down to 40% charge left, before it switches the load over to grid.

What do you use to determine the forecast value? Is it based on sol cast? Or do you have a way to include weather forecast etc as well?

I do use solcast. You can see my solcast config here --> https://github.com/tinuva/home-assistant-config/blob/master/packages/energy/solcast_rest.yaml My DoD automation are here --> https://github.com/tinuva/home-assistant-config/blob/master/packages/energy/goodwe_dod.yaml

I see I still need to remove the old input I used.

GIJOE-SA commented 2 years ago

@tinuva

I know it works, because it takes affect as long as you are back in general mode.

Thank you very much David. The service: number.set_value is indeed working. I have tried yesterday setting the value using developers tools without using the number.set_value which obviously did not work. Very nice script you wrote there.

tinuva commented 2 years ago

@Jayksopp

From this do I understand correctly if you set the DoD above the current DoD the invertor will start charging the battery until it reaches that DoD?

I think I understood the question wrong first time. If you set DoD above the current DoD, inverter will not charge it, but will only use the battery if it goes even higher than the last DoD set which is now higher.

mif11k commented 2 years ago

I struggled a week with the problem related to setting the DoD value, almost going crazy. After finding this thread, I checked again by setting the value of number.depth_of_discharge_on_grid entity. I found out, that decreasing the value works always, but you can increase the value only up to 89. If you set any higher value (90 -99) it is ignored by the inverter, however it looks just fine in the HA.