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

I know it’s an old thread, but I was just facing the same problem and replied for future readers. I also wanted a numeric state triggered more then once, since somehow a state change didn’t end up in calling the action and therefore left my boiler in the wrong state for the whole day.

By reading the documentation of Numeric state triggers and other types of triggers, I figured that i need to trigger base on a (regular) State trigger and use conditions to actually call my actions. In summary the Numeric state triggers are only triggered once when a certain threshold is met.

I came up with the following automation which currently is triggered every 10 seconds since that is the interval of my P1 reader.

alias: Overproduction - TOGGLE
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.power_produced
    id: turn_on
  - trigger: state
    entity_id:
      - sensor.power_consumed
    id: turn_off
conditions:
  - condition: or
    conditions:
      - type: is_power
        condition: device
        device_id: 2320851f51d64572cfc564797046d2f9
        entity_id: 82fc57c70b51f90f3d7b83d930d34963
        domain: sensor
        above: 400
      - type: is_power
        condition: device
        device_id: 2320851f51d64572cfc564797046d2f9
        entity_id: 64f204730671f3bcc4bd13b71c489f07
        domain: sensor
        above: 100
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - turn_on
        sequence:
          - action: input_boolean.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: input_boolean.overproductie
      - conditions:
          - condition: trigger
            id:
              - turn_off
        sequence:
          - action: input_boolean.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: input_boolean.overproductie
mode: single

Regular state triggers have the same behavior. They only fire when they go from not true to true. The reason it works because it now triggers on any change, not a specific one. It will still not fire if the state is unchanged, but I guess that is not a problem here.

Thanks for the quick reply! They might have the same behavior, however it’s not possible for a Numeric trigger to don’t have any threshold (above or below). Therefore I choose this somewhat more complex automation to archieve the goal.

1 Like