Question on alexa and enable/disable rules

I have a couple of lights that i use motion to turn on and have written rules using "physical switch" to pause and resume the rule, so that i can turn on and leave on (with their same switch) and not have the motion turn on or off.

I would a way to do this with alexa.. is there any way.. For instance would I create a virtual switch and have that turn on the light when it turns on and then have a rule using that switch to disable the motion lighting.. and similiarly a rule to re-enable it if i ask alexa to turn it off?
The problem with this approach is I would have to name the actual switch something stupid to not conflict with the alexa name?

thanks , or is there a more direct way to trigger on alexa turning something on/off in the rules vs another method.

Someone might have a more creative workaround or maybe I don't fully understand the use case, but it seems to me like creating a virtual switch with your desired name and exposing that to Alexa instead of the "real" switch (assuming you'd get a name conflict there) would work. Hubitat doesn't technically care if you have two devices with the same name, but it may be confusing for you--but to make it less confusing, I've found Alexa also ignores parenthetical portions of devices names, so I can say "Kitchen Switch" for something that's really called "Kitchen Switch (Alexa)," for example. Alternatively, you could name the device whatever you want on Hubitat and then put it in an Alexa group with your desired name on the Alexa side, a trick some people use to "camouflage" device names with ones that are friendlier for voice control use.

You could then have an automation that turns your lights on when this virtual switch is turned on and also modify whatever lighting automation you're using so that this switch being on also prevents that automation's "off"/"inactive" actions from running.

Alternatively, instead of doing this all manually, the Motion Lighting app, built-in, has a lot of options that sound like they would cover what you're looking for with a lot less work on your part. If you haven't given that app a look already, I'd also consider doing that to see if it meets your needs as-is.

Otherwise, hopefully some of the above gives you ideas!

1 Like

I use the virtual switch method, admittedly not with Alexa, but you certainly could. I use either a Pico, or double taps on a switch. But same difference here.

Just name your virtual device something like "hold kitchen lights" or "override kitchen lights" or whatever is appropriate and easy to remember.

i use the physical switch method which i like better as i was having problems with using the same device in motion lighting for the enable/disable switch as i was turning on.. I dont think that is supported or it doesnt work correctly. When i used a different switch like the outdoor yard lights to keep on the door light during halloween that worked ok..
here is what i am doing now.

what i was kinda asking is that it would be nice if the alexa on event was differentiated from other turn on/off events just like the physical event so we could trigger on that directly in rule machine, but i guess it is not. its would be nice not to have to create a bunch of virtual switches just for this use case.

I don't think no matter what system have a device that will do that. These devices aren't that complex to where it can guess what you mean when you push a button. It would have to be a mind reader to do that! Hence the double tap action I use, that is seen as a different device (a button actually) or the Pico. I have to convert the button to a virtual switch, but that is very easy with a simple automation rule.

But how would Hubitat know if you were just simply turning on the light vs wanting to disable a rule? Like above, it cannot guess this. It is literally "Alexa turn on lights" vs "Alexa turn on lights". So you have to give it a different name so the hub can decide what you are asking it to do. That is where the virtual switch comes in.

the alexa integration/app that gets called to turn on off the device would know and could easily put an extra tag on the call to on/off just like i am sure the physical switch on/off is doing vs the digital on/off

alexa doesnt disable the rule.. you would write a rule to trigger on the alexa turn on or off a switch just like my rule above on the physical on/off. you are misinterpreting the use case..

How?

Again, "Alexa turn on lights" vs "Alexa turn on lights"... I sure can't tell the difference there, how would Alexa know to tag that?

You also would have to somehow convince Amazon to add that. And how would that tag work?

You would have to name it something different in Amazon. And if you are doing that, then just do it in Hubitat.

This is exactly what a virtual switch is used for.

Maybe, but I don't think you are seeing the limitations of technology here.

intetrnally the system knows via the alexa integration that a call came from the web via alex or whatever to turn on a switch versus you locally or through a rule locally. just like internally it knows you turned on a device via a maker api call.. you could easily tag that inside the maker api app.. same for alexa.. we just dont have the source for that integration to modify it and pass extra info along to rule machine that it would look at.

Note that I am not trying to be argumentative. I do think it would be nifty to have this. But I don't see how this could currently work the way you want it to.

There needs to be an intermediate step in the process, and a uniquely named device is what has to happen. And the virtual device is how you can make a unique named device without a bunch of processing and logic that doesn't exist today.

for instance i have the source for my implentation of smarttiles.. i can sense easily that my device was turned on via that.. versus some other source.. becuase i turn it on inside the app when i get the

app.. but you are right internally the system would have to know about an extra parameter or something on the call to turn it on.. and be able to track it. but an extra device is NOT needed to do this if it was implemented this way..

ie this call to turn on a device
https://cloud.hubitat.com/api/39109modifiedhereforsecurity3f9-ab3a-4fb7cd/apps/768/devices/691/on?access_token=f45a03modifiedhere forsecurity3d644a
could look like this

https://cloud.hubitat.com/api/39109modifiedhereforsecurity3f9-ab3a-4fb7cd/apps/768/devices/691/on?source=Alexa?&access_token=f45a03modifiedhere forsecurity3d644a

could have this extra parameter

That is why I am suggesting the workaround. Unless you want to wait until they might (or might not) add this proposed functionality. We have waited FOREVER for 2.2.4, so I couldn't even imagine how long adding something like this might take. LOL.

1 Like

they do have the physical switch parameter which is nice and implemented in a similiar way and i dont remember having that feature in smarthtings that i can recall. but i may be wrong.. but ya for now for the couple of devices i really care about being able to turn on from alexa and disable the motion automation i will have to create a virtual device. i wonder if there is a parameter or a version of the cloud url that would be interperted as a physical turn on of a switch. I doubt it as it violates the letter of the law (ie it is not really physical) but it would be a nice workaround for now.

Seems to me the simplest way to do this would be to setup an Alexa routine that turns on and off the light with a virtual switch. In the motion light app, choose options for on and options for off, then set it to that same virtual switch.

https://docs.hubitat.com/index.php?title=Motion_Lighting_Apps#Options_for_lights_on

Same thing I suggested above with screenshots.

i can do this without a virtual switch.. will keep you informed.. basically there is source out there for a quick and dirty alexa skill that can call cloud urls

there is a trigger in rule machine that triggers on a cloud url.
i can set up a couple of my own url's using that skill (setup a routine in alexa that triggers the url) and when

i get the url rule machine will trigger and i can do whatever i want including turning on a light and disabling a rule..

i knew it was possible with current technology. i will show you a working example soon.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.