Question Motion - Smart Bulb - Alexa Virtual Switch

Good Morning

This is my first post and figured since I am on on day 3 of Hubitat this would be proper location for this post.

The purpose of the post to get a better understand on the Hubitat rule engine and the setup is what have currently in way of smart devices.

Since I have Alexa investment I am working through to allow automation and voice control to co-exist.

I have a laundry room light that I want to turn on when there is motion or when someone ask Alexa to turn on the light, then when there is no motion for period of time "5 mins" or someone asks Alexa to turn off the light.

I have 3 rules - Turn on light either via Alexa or Motion, One for no motion, and one for Alex to turn off light

I have a Virtual Switch to work with Alexa.

The problem I am having is when there is motion detected I am unable to use Alexa to turn off light, but I just use Alexa to turn on and then I am able to use Alexa to turn off no problem.

When I just use Alexa I get the following

dev:212019-12-21 10:58:42.042 am infoLaundry Room Light was turned off
app:312019-12-21 10:58:41.916 am infoAction: Dim: Laundry Room Light: 0
app:312019-12-21 10:58:41.884 am infoAlex Laundry Room Light OFF Triggered
app:312019-12-21 10:58:41.867 am infoAlex Laundry Room Light OFF: (V) Landry Room Lights switch off
dev:12019-12-21 10:58:41.716 am info(V) Landry Room Lights was turned off
dev:212019-12-21 10:58:35.797 am infoLaundry Room Light was turned on
app:252019-12-21 10:58:35.691 am infoAction: Dim: Laundry Room Light: 100
app:252019-12-21 10:58:35.659 am infoLaundry Room Light On Triggered
app:252019-12-21 10:58:35.646 am infoLaundry Room Light On: (V) Landry Room Lights switch on
dev:12019-12-21 10:58:35.515 am info(V) Landry Room Lights was turned on

I have a rule "[Laundry Room Light On]" to turn on a smart bulb in my laundry room when there is motion detected. Below is from the logging I turned on, an so far so good.

dev:212019-12-21 10:42:04.129 am infoLaundry Room Light was turned on
app:252019-12-21 10:42:04.034 am infoAction: Dim: Laundry Room Light: 100
app:252019-12-21 10:42:04.014 am infoLaundry Room Light On Triggered
app:252019-12-21 10:42:04.003 am infoLaundry Room Light On: Laundry Room motion active
dev:42019-12-21 10:42:03.873 am infoLaundry Room is active

Now when I ask Alexa to turn off the light I get this, after motion is detected.

dev:12019-12-21 10:42:18.833 am info(V) Landry Room Lights was turned off

I tried to combine the Light Off Rule, but was unable to figure out how to setup an if statement and then put second if statement if the else portion of the main if statement.

Any suggestions or feedback would be appreciated.

Thanks

Rick Stratman

I do this in my laundry room with the "Motion Lighting" built in app and the Alexa Skill. I don't see the need for RM for this one.

Why would you use a rule to turn on the light via Alexa? As suggested above, just use the Alexa Skill (or the Echo App as a second choice if you're in a market where the Skill is not available). This will automatically allow voice control of on/off, level, and (if supported) color with no effort on your part besides adding this device as authorized on the Hubitat side. This is how pretty much everyone does it.

You can use Rule Machine to create motion lighting automations, but it's way overkill. Simple Lighting or Motion Lighting can both handle turning on and off a light based on motion, and because they're smaller apps, they'll probably even do it a bit quicker than RM. If you're trying to learn RM, that's different, but keep in mind it's probably overkill for this job. In any case, the docs contain a basic motion lighting example, and I would recommended reading them before diving in.

Thanks for the suggestion - I learned something new - this now makes the configuration simpler.