Automation runs only once, should run more

I have an issue with my automation that I can’t seem to solve, hope someone can help me; here’s my issue;

My house has a pool and I have solar panels. Due to high energy prices I want the pump only to run when my solar panel produce more then 1500 Watts for at least 60 seconds. My HA is connected to the Solar inverter and to a Shelly switch which control the on/off for the pump. When the solar production reaches 1500 Watts the pump goes on, when less then 1500 watts for 10 seconds it switches off. However, it switches ON only once, not multiple times (but I see on my Solar meter that from time to time I am above and below 1500 Watts in the day). To switch OFF works always fine, the problem is in switching ON…

Here are my automations:

To switch ON:
type: power
platform: device
device_id: a4c4166db55914d7fdf56f4858add016
entity_id: sensor.grid_power
domain: sensor
above: 1500
for:

  • hours: 0*
  • minutes: 1*
  • seconds: 0*

and to switch off:

type: power
platform: device
device_id: 3b0495f2d99842305ecca1de106fc24e
entity_id: sensor.power_consumption
domain: sensor
above: 0
for:

  • hours: 0*
  • minutes: 0*
  • seconds: 10*

Hope someone can help please…

Please put your code between </> so the formatting is preserved, spacing is relevant for yaml.

  • About the question, I assume you do realize the solar power needs to go from below 1500 to above, and stay that way continuously for 1 minute for this to trigger. Just being above a few times does not add up.
  • The automation actions themselves, is there something that takes a long time in it?
  • Those * behind the duration, are they really there in the automation?
  • Are you sure grid power is the right entity? I’d expect solar power.

For me what I understand is that the pump will go on if you are sending back to the grid 1500 watts during 1 minutes (sensor.grid_power) and switch off the pump when you consume power for more than 10 seconds… which is different to what you expect… but I could misinterpreting your automations…

We need more details on what sensor.grid_power and sensor.power_consumption are calculated or what they represent.

Yes you are correct, when SOLAR power is above 1500 Watts it should switch ON the pump. It does this only once and never after anymore. So for this automation I get the info from the solar inverter (SMA) as to how much solar power is produced)

As for switching OFF the pump, the electricity usage should be above 0 Watts, this automation always works (perfectly). For this automation I get the information from the Smart electricity meter (P1 port).

Hope this clarifies