Help to trigger v switch after power off duration

This damn rules Api in the app has me pulling out my hair at times

How do I create an automation that opens a virtual sensor but is based on watts staying below set amount for x time duration?

I’m looking to
Device watts stays below x amount for x duration

Switch on v switch

Seems simple enough but not with the current automation creator


The outline for this automation was to create an alarm in Amazon’s Echo to alert us about a freezer getting accidently switched off, kind off seemed like an easy automation to begin with until I tried

At time of writing I cannot see a way to set a duration period when creating an automation with power wattage included

There may be another way to do this but this is what I had to do to setup a simple automation based on watts used for a duration

Power sense plug attached to freezer
1 X virtual switch
1 x virtual open close sensor

Virtual switch
Power sense plug power above 3 watts
turn on virtual switch

Power sense plug power below 3 watts
turn off virtual switch

Virtual open close
Virtual switch off
Duration period (user defined)
Turn on open close sensor

The virtual open close sensor can be seen in Echo and from there you can then set up a routine in Echo to suit

1 Like

Upon application of input voltage, the time delay relay is ready to accept trigger signals . Upon application of the trigger signal, the relay is energized and the preset time begins. … Continuous cycling of the trigger signal at a rate faster than the preset time will cause the relay to remain energized.

Did you try the “remains” function in the Rules API?
That would help you do the automation directly instead of creating virtual devices. I think it’s worth the try.
There’s an example in the official repo where:

  1. IF the dim value of Switch1 changes to a number less than 25
  2. and remains like that for 20 seconds
  3. The Switch2 is turned OFF

Let me know if you have any doubts! :smiley: