Flash lights, please help


This works for pulsing my alarm switch, and could be used on a light. You could also capture the state, do the repeat section and then restore the original state. Rule machine 3.0 is so anazingly powerful, I love it.

@daniel.john.edge @Kasper

I have just updated GitHub with a completely new version of 'Flasher'
This no longer requires the 'Cobra Apps' container.. see code header for details.

This app now gives you the ability to set however many flashes you want.
It will also attempt to restore lights to pre flash settings (Has worked well for me so far)

Check it out and let me know how you get on :slight_smile:

Please note this is released under my new license agreement.



Works perfectly Andy! Thanks for releasing this..

Do you know if its technically possible to toggle on/off at a rate < 1 second?


I recoded tonight for a decimal input and added quite a bit of extra code to test this.

I tried setting 0.5 & 0.8 seconds..
There are two major problems..

  1. No lights I tested could 'ramp' up and down quick enough in less than a second to go to full brightness
    (I didn't get much more than a flicker)

  2. 0.5 seconds doesn't seem enough time for the app to collect the current states of more than a couple of lights to be able to restore (especially with hue lights - couldn't even do it with one)
    So, although technically possible.. it isn't really practical.

I'm sorry, I won't be adding this.


One thing you can do which should speed things up a bit...

Currently, the app turns the lights:
off - wait a second (or whatever is configured)
then on - wait a second (or whatever is configured)
then off again - wait a second.. (or whatever is configured)

Then it loops back to the beginning (until it's done it the configured number of times.)

So... technically, it's turning them off twice (once at the end then once at the beginning of the next go around)

If you comment out lines (by putting // in front of them):

219 & 220

It will actually flash a bit quicker because it's only turning the lights off once

I may well configure this as an update because I think it's cleaner


Thanks for the reply - Iโ€™ll give this a go.


Hey @Cobra,
is there anyway this could be for a switch / button VS time. I want to turn on 3 bulbs, set the level, hue & sat then continually flash until the switch is turned off. Is that possible with flasher ?

The flashing routine does not setLevel or hue etc.
It just turns things on/off.

It depends what you think of as being continuous flashing.. for a day? Forever?

Forever it canโ€™t do...
But if you set the app to flash for one second on and one second off then set it to flash:
43200 times.. that would be about 24hrs!

Currently, the flashing does not stop if the switch is turned off.


Hey @Cobra
I have a scene which currently sets the level, hue and sat to red.
I have another scene that has the default level, hue and sat to white.
So if the flashing could be to turn on scene X and to run it until button press, or is this something I should just be trying to work on in RM ?

You are a star and I will have to start learning to code in grovvy...

Can Flasher be improved to flash whilst another 'control' switch is ON and stop when OFF?
Or is it easier to code this in RM3 anyone? will take advice

I am considering flashing non-flashable lights to attract attention in our house, PANIC mode or intrusion when house alarmed etc

Comments welcomed :wink:

It will require writing a whole new routine for this.
Iโ€™ll have a look next week if I get time (I donโ€™t code at the weekends)


This sounds like what I have been trying to accomplish for a light outside my home office... have it trigger by a ST button to have it flash when I am on a conference call - like an On-Air Light.

My challenge is using the same button trigger to toggle it off as well, when I am done.

  • Simple Lighting offers the toggle on/off option with it's rules but lacks the Flashing option within the switch control.
  • Rule Machine offer the flashing option, but doesn't offer the toggle off with the same button trigger to stop the flashing. (in testing I actually had the light flashing and had to delete the rule an reset the device to get it to stop)

Any advice would be appreciated.


The ST button supports double tap so you can trigger your off with that. You would need to use Rule Machine or the Button Controller app. Rule Machine is probably the better choice.

I am using an ST button to lock and unlock my garage entry door. Here I am using a combination of the Button Controller app and a RM 4.0 rule only because I was too lazy to recreate the button in RM.

1 Like

What I would do is as follows:

  1. Set up a virtual switch in HE.
  2. In Rule machine, have the on action for that switch be to start flashing and the off action be to turn the bulp off.
  3. In button controller or whereever you you control your button, change the action to toggle the switch.