State agnostic simulated switch?

Is there a simulated switch that always triggers when turning it on/off even if it’s already on or off?
I want a switch called ‘Everything’ that will always turn on or off all my lights.

I believe you are looking for a Simulated Button. “Press” it and X happens. This way you don’t have to worry about the state of a switch.

I have one I wrote it’s here.
EDIT: I improved the button by adding descreet On and Off buttons.

Here is the Smart App which crates these buttons for you.

I have one too that I recommend with my Alexa Helper app. It is a stateless dimmer:

1 Like

I tried this but when I tried to add a switch I get an ‘An Unexpected error has occurred’ message when I click done. Do I need to turn on OAuth or something? Here’s the log:

Device type ‘Stateless On-Off Button Tile’ in namespace ‘gouldner’ not
found. @ line 50

The Stateless On/Off Button Tile does exist and is published.

@jimmcghee Looks to me like to failed to install and publish the Device code before you tried to create the device with the Smart App. They both have to be installed for it to work.

First Installed the device in “My Device Handlers” using the source just paste it in, save and publish (for me).

Then install the smart app code into “My SmartApps” (Which you already did)

Then create an instance of the smart app which will create the button.

This worked great! Using it with rule machine for my door lock. Don’t have to worry about syncing the virtual switch and the lock state now. Thanks!

1 Like

No problem…glad it worked for you!

The advantage of a Stateless switch is one device for both On and Off. The only difference between stateless and one that maintains state is the stateless issues the event regardless of current state of the switch. If you use button for actions then you need two one for On and one for Off. But it does work pretty much the same that way so it’s a matter of taste I guess. I like fewer devices.

1 Like

I’ve been using Alexa Helper for quite some time but I hadn’t realized how much you’ve improved it. The Alexa Switch works as advertised (stateless) and the ability to create one in the helper app is really handy. Thanks for aiming me at it and thanks for the great work creating the Alexa Helper app.

I had to change line 50 of the SmartApp from:

    def childDevice = addChildDevice("gouldner", "Stateless On-Off Button Tile", deviceId, null, [label: switchLabel])

def childDevice = addChildDevice(“gouldner”, “Stateless On/Off Button Tile”, deviceId, null, [label: switchLabel])

in order to not get the ‘Unexpected error’ message. It doesn’t seem to trigger my test rule though.
Did I manage to pick up an old version?

You are correct. You change is correct, not sure why my test was working. Maybe I changed it after I tested ?

I fixed it now.

What is your test rule ? I was able to add this to rule machine and test just fine.

  1. Create virtual Stateless Switch TEST2

The test rule I created was

  1. Trigger: When TEST = ON
  2. Action: Turn on kitchen light

And this worked.

I don’t understand how to configure Rule Machine to have one switch mirror another without making two rules I tried

  1. Trigger: Then TEST = ON or TEST = OFF
  2. Action : Kitchen light capture state

But this didn’t work and honestly I don’t understand what “capture state” means so perhaps that was just wrong. Only way I see is two rules like my first test, one for on and one for off but there must be a way to do this with one rule.