Dashboard template for light flash

I'm curious in the Dashboard is there a way to turn on and off flash function for a light. My kids enjoy this feature and I would like so when I'm ready for my 10 year old to get up in the morning I could turn that feature on through the dashboard instead of having to go to the device... Thanks for your help!

You can definitely do this, but what you're looking for isn't really a specific "template" for this command--none of the stock templates have way to directly execute this command, which is sort of a pseudo-standard command that many but not all lights implement. My recommendation would be to create a virtual button (with one button), then expose that button to Dashboard (using the button template, choosing 1 for the button to push when the Dashboard tile is tapped). Then, create an automation that runs the flash() command on your light(s) when button 1 on your virtual button is pushed.

That's the general idea. If you need specifics, I'd be happy to expand on any of this!

1 Like

Yes if you could expand and show me how to accomplish this. I'm still fairly new hubitat but really like the customization and ability to do things like this. Question will this virtual button give the ability to turn on and off the flash feature with the same button? Thanks again.

Sure! So before you start, I'd make sure your lights support the flash() command. I'm guessing you've already done this since it sounds like you've made it happen, but if not, check the device page (Devices on the left, then find your device on the right and click into its page) and see if there's a "Flash" button in the list of commands/buttons at the top, and verify that it works as expected. (If not, you could fake the same effect with some workarounds, but it's likely to be less reliable.)

Assuming it will work: first, create the virtual button. Again, on the "Devices" page, click the "Add Virtual Device" button at the top. Put in whatever you want for "Device Name." This is how it will display on the Dashboard. (You can also put in something for "Device Label," which will become the display name if present; some people separate the two for some purpose, but the name is the only thing required.) You can leave the automatically-generated Device Network ID or change it to any unique value of your choosing. For "Type," choose "Virtual Button"--that's the most important part. (You could also choose "Virtual Switch," which would let you use this device with voice assistants, but then it would appear as a switch instead of a button on your Dashboard, which you may not like. I'd also recommend setting the auto-off feature in that case, and your rule will have to be set up a bit differently--feel free to ask again if you're not sure and do want to do this.)

After clicking "Save Device," you should be brought to the page for this button device. You really don't need to change anything here, though for the sake of simplicity, you may wish to change "Number of physical buttons" to "1" and click "Save Device."

Next, create an automation that will call flash() on your lights when button 1 on this virtual button is "pushed." Here's my recommendation for how, though you can use whatever way you know if you already have something in mind:

  1. Go to "Apps" on the left-side menu. If you don't already have Rule Machine installed (you'd see it on the right), install it: click "Add Built-in App" and choose "Rule Machine."
  2. Open Rule Machine, click "Create New Rule," and call it whatever you want (I like to name all my apps with the app name or an abbreviation at the beginning, something like "Rule - Flash Light XYZ on Virtual Btn," but whatever you want will work).
  3. Click "Select Trigger Events," choose "Button Device" as the capability, and choose your virtual button when asked.
  4. Click "Add Button Action," then choose button number 1 and the pushed action. (These options gradually appear as you click into things--it should become apparent how to do this if it's not originally.)
  5. Click "Select Actions for button 1 pushed" (which should have just been added to the UI after you completed the above). For "Select Action Type to Add," choose "Control Switches, Push Buttons," then choose "Flash Switches" when asked to select an action. Choose the light/switch you want to flash, and click "Done with this action."
  6. If your light stops flashing on its own or you have another idea in mind to stop flashing, you could be done. Skip to step 7. If not, I'd consider adding more actions to stop the flashing. For "Select Action Type to Add," you could do "Control Switches, Push Buttons" again, then choose "Turn switches on" or "Turn switches off," depending on how you want the light to end up, and assuming an on() or off() command stops the flashing on your lights (it does on any I've tried, but that's far from all). You could also do a "Capture" before you start flashing and a "Restore" after if you want the bulb to end up however it was before, or you can use other actions to choose a specific level/color/color temperature or whatever you want. Whatever you do, if you want something like this, also check the "Delay" box and choose however long you want to wait for this action to stop the flashing (on, off, restore, etc.) to happen.
  7. When totally done, click "Done with actions for button 1 pushed," then "Done." Your rule should now be configured so that your light flashes when the virtual button is pushed (you could test this by going back to the device page for the virtual button, entering "1" under the "push" button, and clicking that button--this will generate a button 1 pushed event for that device and should trigger the rule and in turn run the actions).
  8. Now just add the button to your dashboard! Under "Apps" (not "Dashboards") on the left, find your Dashboard under the Hubitat Dashboard app. Click into it, and make sure your virtual button is selected under "Choose Devices" or that you have the "Use all devices" option selected (note that this option may make your Dashboard load more slowly than choosing specific devices). Then click "Local LAN Link to Dashboard" (or cloud if you really want) to get into the Dashboard to edit it. Click "+" to add your virtual button and place it wherever you want: choose it under "Pick a Device," choose "Button" as the template, and put "1" as "Button Number" under "Options." Then you should be good to go.

Hope this helps!

5 Likes

Bertabcd1234 - Thanks for those instructions. It worked just the way you stated. I would like to see if I could create a virtual switch so I can turn on the flashing and know that it is flashing and then turn off the GE Switch which is plugged into regular light.

Flash isn't really a standard capability, just a pseudo-standard command some bulb and switch drivers implement. As such, there is no standard for how it works. With most, the light will just start flashing when you issue the flash command and stop when you issue an off of on command, but there is no standard attribute whose value you could subscribe to and "sync" with a virtual switch to represent that status. You could create workarounds (e.g., if you only ever start flash from a specific rule, turn on a virtual switch, and have another rule that listens for on or off commands and turns off that switch then, but I'm thinking that still won't work if the bulb was on, started flashing, and then you issue another "on" to stop it), but given this, I'm not sure how reliable it would be, and it depends on the driver and lights you're using.

EDIT: As of platform 2.2.6 (spring 2021), "Flash" actually is a standard capability with one requirement, a flash() command. So, there is a bit more standardization on this now, and perhaps more apps will take advantage of it in the future. But the above workaround is still necessary for Dashboard as of now--being part of a defined Capability at the platform level still doesn't mean an arbitrary app will have a direct way to do exactly what you want to do with any associated commands or attributes.

1 Like

There's no such thing as a pseudo-standard command.

Flash is not a standard command, is not required in any driver spec, and is done at least 3 different ways that I've seen in various drivers. Since it is all in software, it is up to the whim of the driver writer on how they do it.

As it isn't standard, and not required, I don't add it to any of my user drivers as I don't use it. :man_shrugging:

1 Like

So from what I'm reading there is no way to see on the dashboard that my switch is the flash mode. Can I set that virtual button or in rule machine to 1 turn on switch 2. turn on flash 3. turn off switch... I hope that makes sense?

PS. It would be nice to incorporate the flash option in the dashboard since with the alarm feature it is used and if tripped you would then see in the dashboard your light or switch is now in flash mode not on or off.

Of course not because it's a term I made up. :slight_smile:

Yes, that is my point, "pseudo" meaning "not real."

My calling it "pseudo-standard" comes from the fact that despite not being standard (which I'd define as a command that is required by some Capability), it is so common that Rule Machine includes an action to run it as if it were. That's all I meant. Again, there is no requirement that it be implemented in any certain way or at all, in line with my advice above.

You could create a virtual switch, then a rule that turns the bulb on and sends a flash command when turned on, then sends a off when the virtual switch is turned off. Is that what you're looking for? Then as long as you only start and stop flash in this way, it would probably reflect that state (assuming your light flashes indefinitely until you stop and you don't do anything else in between like turn on or off from another rule or app).

1 Like

Sounds good to me. My only question is I get a little confused when it comes to setting that up using the same dashboard virtual button. I'm assuming that I need to somehow set that up in the rule machine right?

That would be the best way, I think. You'd need a virtual switch and not a button. For your rule, trigger on the virtual switch changed. Make you actions something like:

IF Virtual Switch On THEN
  On: Light   
  Flash Light
ELSE 
  Off: Light
END-IF

With regards to Step #6 and the Capture/Restore Action...

I have a button I want to use to set a light flashing. But I want to use a 2nd press of that button to turn off the flashing and then restore the light to the captured state....

How would I write that in Rule Machine?

It seems your question was also asked and answered here: