Automation based on consumed power

Hi,

I’m looking for a way to detect if a specific smartplug (and the device behind it) is no longer consuming energy, in this case a water heater.

I created an automation to trigger when the smartplug is activated and on the condition that the power is < 1W. But this isn’t functioning because the eventual power consumption is starting 1-2 seconds after the trigger.

I need an automation to detect if the smartplug is no longer consuming power within x seconds after each activation (relay on) of this smartplug, can someone help me?

It helps if you share your automation yaml, correctly formatted for the forum using the </> button in the post toolbar. But all it requires is your trigger for the switch to be on for 2 seconds before checking the power like this:

triggers:
  - trigger: state
    entity_id: switch.smart_plug
    to: 'on'
    for: 2  # this is the bit you need. wont trigger until the plug has been on for 2s
conditions:
  - condition: numeric state
    entity_id: sensor.smart_plug_power
    below: 1
actions:
  - action: etc...

Thank you for your help. I managed to get it working thanks to your yaml example. I’ll not forget to add my yaml in future posts.