Hey there,
I need some help creating an automation for a pool pump.
The pump has three stages (stage 1 = 300W, stage 2 = 550W, stage 3 = 875W).
I have a sensor, which states the current energy consumed/returned from/to the grid. Also there is a sensor telling the current power consumption of the pump.
I want to create an automation which sets the stage of the pump according to the available energy.
I manged to set up a template:
value_template: >
{% set uberschuss = -1 * (states('sensor.uberschuss_mittel') | float(0)) %}
{% set leistung1 = 300 %} # Leistung bei Stufe1
{% set leistung2 = 550 %} # Leistung bei Stufe2
{% set leistung3 = 875 %} # Leistung bei Stufe3
{% set puffer = 150 %} # verbleibender Puffer
{% set aktleistung = states('sensor.garage_schaltsteckdose_leistung') | float(0) %}
# {% set aktleistung = 300 %}
{{ 3 if uberschuss + aktleistung - leistung3 > puffer else
2 if uberschuss + aktleistung - leistung2 > puffer else
1 if uberschuss + aktleistung - leistung1 > puffer else
0 }}
Calculation is:
(power returned to grid) + (actual consumption of pump) - (consumption of (new) stage) must be greater than the buffer.
This seems to work.
Now I want to create an automation which monitors the above mentioned sensor (pump stage) and sets a new pump stage only when it was set for more than 5 (or x) minutes. I don’t want to switch stages every x seconds…
At the moment I don’t switch anything - just a telegram-message
But this seems to work.
The only problem is - when the calculated pump-stage is already “3” (or what else) and does not change, the trigger does not work since there is no change (to “3”).
There must be four different actions since each pump stage is controlled via a seperate physical HomematicIP-Switch.
if stage 3 > switch all other stages off > switch 3 on…
if stage 1 > switch all other stages off > switch 1 on…
And the next thing I don’t know how to handle:
I would like to create a virtual switch (“automatic” vs. “manual”). This switch I would like to add to the automation as a condition - only when it is “automatic” then set the pump-stage. In manual mode nothing should happen…
You could probably do all this in your template sensor.
If you store the time the stage changed in an attribute, you can compare that time with the current time. If it’s been more than five minutes you change the stage and update the time attribute.
Yeah - maybe this is possible.
But it won’t be possible for me
I am neither an expert in programming nor in HomeAssistant-logics, -sensors, -templates…
I have to do all this via copy-paste, try-and-error etc.
Normally I set up a helper, a helper for the helper and maybe some helpers for the helpers-helper to get all this working.
And after all I have to work with lots of #comments to be able to understand all that after a few weeks and months and maybe to do some troubleshooting…