StephanJoubert / home_assistant_solarman

Home Assistant component for Solarman collectors used with a variety of inverters.
Apache License 2.0
507 stars 191 forks source link

Deye Microinverter Zero feed-in (Nulleinspeisung) #598

Closed cliely closed 3 weeks ago

cliely commented 3 weeks ago

Hi everyone,

For those guys who are looking for a working solution to give the Deye microinverter e.g. 600W or 800W a zero feed-in, I would like to share my script here:

  1. make a template "Nulleinspeisung" (zero feed-in):
{# set your max Power of your Inverter in Watt: #}
{% set maxInverterPower = 800 %}
{# set your max Inverter Regulation e.g. 100 or max 120 in percent: #}
{% set maxInverterRegulation = 100 %}
{# If your Inverter is making an offset, you can change it here in Watt: #}
{% set inverterPowerOffset = 0 %}
{# Set here your min amount of your base load in your house in Watt: #}
{% set minSolarLimit = 100 %}
{# Here can you change the Zero Point goal e.g. -5, o or +10 in Watt: #}
{% set zeroPointGridAdj = -5 %}

{% set newSolarLimit = 0 %}
{% set newRegulationLimit = 0 %}

{# Put in your current Grid sensor in Watt: #}
{% set curGridUsage = states('sensor.tasmota_stromzahler_strom_power_curr') | float * -1 | replace('W','') | int %}
{#Put in your current Solarpower sensor in Watt e.g. a shelly 2pm (the inverter sensor is too lazy): #}
{% set curSolarProd = states('sensor.solaranlage_solar_leistung_power') | float (0) | replace('W','') | int %}

{% set newSolarLimit = (curSolarProd - (curGridUsage + zeroPointGridAdj)) %}

{% if newSolarLimit <= minSolarLimit %}
  {% set newSolarLimit = minSolarLimit %}
    {% elif newSolarLimit >= maxInverterPower %}
       {% set newSolarLimit = maxInverterPower %}
{% endif %}

{% set newRegulationLimit = ((newSolarLimit * maxInverterRegulation) / (maxInverterPower - inverterPowerOffset)) %}

{{ newRegulationLimit | round (0) }}
  1. Make an automation "Nulleinspeisung" (zero feed-in):
alias: Solar Nulleinspeisung
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.solaranlage_solar_leistung_power
    to: null
    from: null
    enabled: true
condition:
  - condition: state
    entity_id: sensor.solarman_on_off_enable
    state: "ON"
action:
  - service: solarman.write_multiple_holding_registers
    metadata: {}
    data:
      register: 40
      values: "{{ states('sensor.kalkulation_nulleinspeisung') | replace('%','') }}"
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
mode: single
  1. Enjoy to seeing the Gauge Display between -5 & 5 Watts 😁👍

Bye,

Mathias