Solar Surplus not triggering when already above X for?

Hey i am trying to make a automation for solar surplus energy go into my Car and Pool Heater im using the entitiy and Above feature. but when it is already above that Limit for X time then it just dont triggers it only triggers if the power was below the limit and got over again i guess? How can i make it always Triggering when Above the Limit for X time? I will make a condition that it will not trigger when already turned ON.

alias: PoolPumpe anschalten
description: ""
trigger:
  - type: power
    platform: device
    device_id: fbbbe5546de8ef2c6efa4d3bb91687fd
    entity_id: d177b729f7906d263a5f6963c17dce0e
    domain: sensor
    above: 1700
    for:
      hours: 0
      minutes: 3
      seconds: 0
condition:
  - type: is_not_charging
    condition: device
    device_id: 3873e820643f5e3833a0ac270741fa86
    entity_id: 263fb13bfaf4117fd28041e9de3eddde
    domain: binary_sensor
  - condition: and
    conditions:
      - type: is_battery_level
        condition: device
        device_id: 3873e820643f5e3833a0ac270741fa86
        entity_id: 98d483f7b6e9631323379604d22f5e02
        domain: sensor
        above: 77
        enabled: true
        below: 100
      - condition: and
        conditions:
          - condition: device
            type: is_off
            device_id: cc1a459559736dbdc01fde672776104d
            entity_id: e62821740ad6580b2553921807d1d213
            domain: switch
action:
  - type: turn_on
    device_id: cc1a459559736dbdc01fde672776104d
    entity_id: e62821740ad6580b2553921807d1d213
    domain: switch
  - device_id: 3e23df18cd486658efac1d46c1cd4a29
    domain: mobile_app
    type: notify
    message: Pool & Wärmepumpe wurden angeschaltet.
    title: PoolPumpe AN
mode: single

any idea or help would be appreciated

Before I explain, first 2 other observations, unrelated but useful:

  1. avoid device triggers, conditions and actions, use state/numerical state triggers, conditions or service calls instead: Why and how to avoid device_ids in automations and scripts
  2. and conditions are not something you place between conditions, but above. All things below it need to be true. So putting only one condition below an and condition is of no use. You do not even need an and condition here. if you place conditions below one another it is and by default, unless you are within an or condition (Inside an or condition is the only place you might need an and condition).

Now back on topic:

You are right that the trigger only happens when the state becomes what you asked for exactly the duration that you specified. A trigger is something happening, not something being a certain way.

“Always” triggering is not an option. Always as in every microsecond, again and again? A timed solution would work, but that is not recommended.

The thing is, you need to take into account all things that might happen that would create the situation where you’d want to perform the action. If three things need to be true, you need to watch for changes in all three things to see when to act. Because either condition could be the last one that you needed for all of them to be true.

The general pattern for automations where multiple conditions must be met simultaneously is:

trigger:
  requirement 1 becomes true
  requirement 2 becomes true
  requirement 3 becomes true
  ...
condition:
  requirement 1 is met
  requirement 2 is met
  requirement 3 is met
  ...
action:
  do something

In your case you are having three conditions, so you need three corresponding triggers, that look pretty similar to the conditions that you need to be true. When doing so, Home Assistant will only check the automation when needed, and does not need to check continuously.

1 Like