Device on for n minutes per hour?

I have a Peanut pocket socket that I bought primarily as a Zigbee relay.

Now I have an application where I’d like to turn the socket on for some number of minutes out of each hour. Exact schedule isn’t important, just an interval in each hour, 24 hours, 7 days a week.

It’s not obvious how I can do this.

I’m not sure what’s available in the new V3 app custom automation creator for this. There might be something there.

In the classic V2 app, it’s straightforward although there is a little setup to do. :sunglasses:. You just set up a virtual switch to act as a timer and then daisychain them.

So real switch comes on and you use the power allowance feature to have it turn itself off after seven minutes.

Then you have the real switch turning off trigger the virtual switch to come on, and set up a power allowance feature on the virtual switch to turn itself off after 53 minutes.

Then you have one more rule to have the real switch turn on when the virtual switch turns off.

This will create an infinite loop where virtual switch comes On for 53 minutes (with no result in the real world, it’s just acting as a timer). It turns itself off. Real switch comes on for seven minutes then turns itself off. Real switch turning off triggers the virtual timer to come back on for the next 53 minute period. And so on.

You could also use two virtual switches with the real switch mirroring only one of them which would then give you the option of turning the real switch on in other ways and leaving it on for more than seven minutes.

There are lots of other ways to do this, including webcore, so it just depends on what you want.

Or, like I said, it might be an option in the V3 app, I don’t know that one very well.

Here’s the wiki article on creating a virtual timer in the V2 app that should give you more ideas:


Time to hit WebCore :slight_smile: Very easy to do. Here is my pool controller which has most of what you want; just delete what you don’t need. You can import this with the key in the picture.


Thanks, couple of things to try.

So far I haven’t had to resort to WebCore. So I’ll most likely use @JDRoberts’s suggestion.

1 Like

Webcore will give you a lot more options, but The daisychain should work as well if all you need is a cycling timer for a fixed interval. Up to you. :sunglasses:

I set this up several weeks ago and it worked fine. I checked the history every once in a while for a couple of weeks and saw events timed as expected. Then forgot about it.

I noticed today that it had stopped cycling. No events for either the virtual or the outlet for at least the 7 day period the old app stores.

Any idea what would stop the power allowance timers? Maybe firmware updates to the hub?

Yes, I believe that a firmware update would reset any timers for power allowance, so whatever your initial trigger was for your infinite Loop would have to be run again.

1 Like


How can I copy this and paste it into the IDE, with out retyping ?

You can create a new piston (restore using backup code I beleive) by using the code c8r4 in the top of the clip. This should make the code for you but without my devices. You will just have to edit the piston and change the placeholders to your devices.
I have change the code since I posted it as I was having too many air bubbles building up with the schedule so you may have to do some changes to what you need.