Recurrent trigger with Condition

Hello Everyone,
i am facing a situation in a automation where i need some idea how to solve this.

I have to sensors:

  • pv-inverter-input (Watt)
  • wallbox-charging (true/false)

I’d like to trigger an event if:

if [pv-inverter-input is > 5000W for 5min] AND [wallbox-charging = true]
then
[turn on switch xyz]

I can set

pv-inverter-input is > 5000W for 5min as the trigger
and
wallbox-charging = true as the condition

but from my understanding the automation is only triggered at the point the “pv-inverter-input is > 5000W for 5min”. If wallbox-charging is false in this moment the action is not activated. If wallbox-charging is true later, the action is also not activated because the automation is not triggered…

What i can do is
Trigger:
“pv-inverter-input” changes
Condition:
[wallbox-charging = true] AND [pv-inverter-input is > 5000W]
then…
But this only takes the current state of “pv-inverter-input” and does not check the last 5 min

And idea how to solve this?

Thank you!

create a trigger sensor (template sensor) that becomes true when pv-inverter-input is > 5000w for 5 minutes

then trigger on both:
new sensor == true or wallbox-charging == true

condition:
new sensor == true and wallbox-charging == true

1 Like

Yeah, thought about that already, but i’d like to avoid to create helper sensors for these kind of things…
But thank you anyway, i will give it a try!

You don’t really have a choice in this situation. Best you can do without is something like:

trigger:
  - platform: numeric_state
    entity_id: sensor.pv_inverter_input
    above: 5000
    for: "00:05:00"
  - platform: state
    entity_id: binary_sensor.wallbox_charging
    to: 'on'
condition:
  - condition: numeric_state
    entity_id: sensor.pv_inverter_input
    above: 5000
  - condition: state
    entity_id: binary_sensor.wallbox_charging
    state: 'on'

That will activate when the wallbox charging sensor goes on if the PV is over 5000W — even if it has been high for less than five minutes.

You can’t implement for: on a numeric_state condition, which is why you need the helper.