State agnostic simulated switch?


(Jim McGhee) #1

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.


(Jimmy) #2

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.


(Ron) #3

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.


(Micheal ) #4

I have one too that I recommend with my Alexa Helper app. It is a stateless dimmer: http://thingsthataresmart.wiki/index.php?title=Alexa_Helper#Alexa_Switch_Installation


(Jim McGhee) #5

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:

physicalgraph.app.exception.UnknownDeviceTypeException:

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.


Stateless Virtual Switches
(Ron) #6

@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.


(Jimmy) #7

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!


(Micheal ) #8

No problem…glad it worked for you!


(Ron) #9

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.


(Jim McGhee) #10

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.


(Jim McGhee) #11

I had to change line 50 of the SmartApp from:

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

to
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?


(Ron) #12

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.