Automation: Trigger on 2 sensor values within a timeframe

Hi,

I am struggling with an automation that should cut off my electric car charging at a specific point (percentage of charge). I have a shelly Plus 1PM at my wall outlet that I use to charge my car.
I investigated a 10h charging and recognized two peaks in the power measurement (power is going down from 2.3 kW to around 2 kW, duration 2s, within a short timeframe of around 3 Mins). These two peaks are absolutely unique within the 10h charging period and maybe it’s a good trigger to cut off the charging at around 80%, which is my goal (the car charges to 100% at any time and that cannot be adjusted).
I know how to build an automation to measure the shelly power sensor, but I have no clue how to add the timeframe. So the trigger condition would be that the sensor is showing something between 1900 and 2100 W, two times, and these two events happen within a timeframe of 5 Mins.

Any hints would be highly appreciated !

Regards

Wolfgang

You could trigger on the first time the power drops to the desired value (2KW?) then inthe actions you could make the first step a “wait for trigger” for the power to drop a second time and have a timeout value of 5 minutes. And if the trigger doesn’t happen in that time frame then you can abort the automation.

here is an example (modified from the docs:

- wait_for_trigger:
    - platform: numeric_state
      entity_id: sensor.your_power_sensor
      below: 2.1
  timeout:
    minutes: 5
  continue_on_timeout: false

you need to make sure the automation is set to single mode to prevent it from re-triggering until the wait times out .

Thanks finity,

already implemented and will try/test during the next charge.

Many thanks

Wolfgang

1 Like