NB - Post rewritten to make the intention more clear.
Hi all,
I am trying to set the limit of a solar inverter according to the power consumption (wattage) in my household during nights. I want the inverter to feed only the wattage that’s needed into the household, up to a maximum of 150W.
The Inverter limit can be set through MQTT. I also have a sensor that measures the power consumption in my household (Shelly 3em) and I configured a sensor to calculate the excess wattage which is being fed into the grid.
The excess should be as little as possible and the amount of power the inverter is feeding in to my household should be as close as possible to my power consumption, but not less that 75W.
I am testing following sensor at the moment, but some times the limit drops to low which apparently shuts down the inverter.
- name: "inverter limit v2"
unique_id: "inverterlimitv2"
unit_of_measurement: W
state: >
{% if states('sensor.excess_wattage') | float(0) > 0 %}
{{ states('input_number.inverter_limit_night')|float(0) - states('sensor.excess_wattage') | float(0) }}
{% else %}
{% if states('sensor.total_power_consumption')|float(0) <= states('inverter_limit_night')|float(0) %}
{{ states('sensor.total_power_consumption')|float(0) }}
{% else %}
{{ states('input_number.inverter_limit_night')|float(0) }}
{% endif %}
{% endif %}