Zero feed with a Hoymiles inverter - z-master42/solarflow GitHub Wiki
Zero feed with a Hoymiles inverter
I realised the zero feed for myself as a script[^1] in Home Assistant, which is called via an automation at a set interval. Five seconds has proven to be a good interval.
For the whole thing to work, the script needs to know your home consumption, i.e. what your electricity meter is measuring. Some use a Shelly EM 3 for this. However, there are various other sensors that work on the same principle. The main thing is that you can integrate them into Home Assistant.
Also particularly important here: The measured value (the current power) must be the netted value, otherwise the script will not work.
Since I already had a modern electricity meter with an infrared interface, I decided to try Volkzszaehler at the time. In the meantime, however, I only use the vzlogger and pull the read-out data into my Home Assistant via MQTT. Here, too, there are various other sensors that could make use of the infrared interface.
-
In Home Assistant, go to Settings - Automations & Scenes - Scripts and create a new empty script. Use the three dots at the top right to switch from visual to YAML editing mode and simply copy my template into it. Of course, you may have to change the entity names I used to yours.
-
If you also want to take over the automation in this way, proceed almost exactly the same way. Go to Automations, create a new empty automation, switch to YAML mode using the three dots at the top right and copy my template into it.
-
Don't forget to save both, of course, but Home Assistant will also remind you of this when you want to leave the page.
alias: Anpassung Wechselrichter Leistung
sequence:
- if:
- condition: state
entity_id: binary_sensor.wechselrichter_reachable
state: "on"
alias: Wechselrichter erreichbar
alias: "-"
then:
- variables:
altes_limit: >-
{{
states('number.wechselrichter_limit_nonpersistent_absolute') |
float(1) }}
grid_sum: >-
{{ states('sensor.stromzahler_aktuelle_leistung') | float(1)
}}
maximum_wr: "{{ 600 | float(1) }}"
minimum_wr: "{{ 50 | float(1) }}"
setpoint: "{{ (grid_sum + altes_limit - 5.0) | float(1) }}"
alias: Variablen definieren
- if:
- condition: template
value_template: "{{ setpoint > maximum_wr }}"
alias: Neues Limit > 600 W
then:
- service: number.set_value
data:
value: "{{ maximum_wr }}"
target:
entity_id: number.wechselrichter_limit_nonpersistent_absolute
alias: Setze Limit auf 600 W
else:
- if:
- condition: template
value_template: "{{ setpoint < minimum_wr}}"
alias: Neues Limit < 50
then:
- service: number.set_value
data:
value: "{{ minimum_wr }}"
target:
entity_id: number.wechselrichter_limit_nonpersistent_absolute
alias: Setze Limit auf 50 W
else:
- if:
- condition: template
value_template: "{{ setpoint != altes_limit }}"
alias: Neues Limit != Altes Limit
then:
- service: number.set_value
data:
value: "{{ setpoint | float(1) }}"
target:
entity_id: number.wechselrichter_limit_nonpersistent_absolute
alias: Setzte neues Limit
alias: "-"
alias: "-"
alias: "-"
mode: single
icon: mdi:vector-link
Notes
- No energy plan is set in the SolarFlow app. PV hub output power and acceptable inverter input power are set to what the inverter can do at maximum. [^1]: The script is based on the work of Peter F. from H., who realised the zero feed as a Python script: https://gitlab.com/p3605/hoymiles-tarnkappe/-/blob/main/hoymiles_setlimiter.py?ref_type=heads