What are the best practices for creating lighting controls with respect to "turn on", turn off", set dimmer level, etc. when using both Rules, Motion Control, Alexa, and, sometimes, () physical switches?
The problem appears when Alexa is asked to "turn on" a light but nothing happens and it turns out that the dimmer was left at 0 by a previous rule or someone fiddling with the physical switch.
Or, when does the motion control app resume control after someone "turns on" a light?
Are you always specifying a dimmer level with every "off" and "on"?
Are you setting a time limit on every "off" and "on" or using automatic turn off?
Not 'always', but generally, yes. Rules and actions should be unambiguous. If you want to turn the light on at full brightness, then the action should include 'set full brightness' and not just 'turn on'
This shouldn't happen. What devices are they, and what driver are you using for them? I'm not aware of any stock (or well written community) driver that ever reports level 0, and in general, "level" (brightness) and "switch" (on/off) are tracked entirely separately, with "level" remembering the last level when the device was on and "switch" reflecting the on/off state. This is sometimes a point of confusion, as some expect to see "level: 0" when the device is off, which you shouldn't. But to that point, an "On" command will generally restore the device to its last level. Z-Wave, in particular, requires per spec that the device restore the last non-zero level with an "On" (a specific Z-Wave command, not the Hubitat driver command necessarily, but these are almost always the same as you might expect). Zigbee may differ, but all I know of work similarly. Wi-Fi and community devices may differ even more.
So...just asking the above because there may be a solution.
Also, I don't suppose you have any "prestaging" preferences turned on in the driver? (This shouldn't affect "On," only "Set Level," but for voice commands it's sometimes hard to tell what Hubitat driver commands it's really running.)
I'm not sure what you mean with timers for on/off, but in general, all of my lighting is controlled by motion. So, I rarely turn it on by voice at all in the first place (sometimes change color temperature or whatnot if I want something different than it did automatically) and generally don't have to turn it off manually, either. Something like that is probably better than a strict timer, since a timer won't know if you're still in the room--but you could indeed create a rule or use another app to do this if that is your goal. For some devices (e.g., fans), I do create special virtual "timed" switches that I use together with a custom app I wrote (a rule would work, too) to turn the device on for a set amount of time before turning it off.
I call out the level explicitly in my rules, especially because I either do want it at full brightness or I don't, regardless of what it was before.
Most of the time the rules just hum along happily, but I also have built in my rules so that if the light was turned on by the physical switch (like the cavemen used to do), it won't change the level or turn off automatically until the light is physically turned off. That way, I can manually turn on a light, set it to whatever level, and it will stay there until I manually turn it off.
My use cases: Set porch light at 100% at the switch for shoveling snow instead of just 10% for 10 minutes when the door opens. Turn on basement lights manually so they don't turn off while we're down there longer than the motion timeout rule.
For example, I have motion sensors in an aggregation mZone and an Inovelli Red dimmer controlling the bathroom lights - purportedly dimmable LED bulbs - controlled by the Hubitat Motion Control lighting app. Using the Inovelli drivers. Nothing fancy. Everything works perfectly!
And then, someone enters the bathroom and the lights do not turn on in ten milliseconds and she impatiently says "Alexa, turn on the bathroom light." and Alexa turns on the light.
What is the situation now according to the rules? Will the bathroom light hypothetically stay on indefinitely? What is the Motion Control app thinking? Is it sulking in the corner and refusing to do anything? Will it restart as if nothing happened when there is no motion?
More to the point, do I need to add specific instructions to restart it if there is no motion? I suspect everything would be fine if we didn't use Alexa or the physical switches but I'm happy to add more provisions to the Rules if that would bulletproof the system.
If Alexa turned on the light, in my case it would stay on indefinitely.
When the rule turns on a light, I have it set a boolean variable (let's call it 'automatic') to true. The rule also evaluates if the light is on already. That way, if the light gets turned on by any other means, including Google or Alexa, the 'automatic' boolean will be false. If there's motion and the light is off and 'automatic' is false, it turns the light on. So...
If there's motion and the light is off and 'automatic' is false, it turns the light on.
If there's motion and the light is on and 'automatic' is false, it does nothing.
If the timer expires and there's no motion and the light is on and 'automatic' is true, then it turns the light off.
If the timer expires and there's no motion and the light is on and 'automatic' is false, then it does nothing.
If the light turns off by any means, it sets the variable to false to reset everything.
It sounds kinda complicated, but it's really not. It's just setting and checking the variable as another condition of turning the light on or off.
I'm not sure how or if you can do that using Motion Control. I use webCoRE for everything, but the logic should be the same for other methods.
I don't have Alexa. But I do have a room where the motion sensor was a bit slow( hey, it's cheap). I put a contact sensor on the door itself and added it into the Motion Lighting App for that room. The contact sensor only turns on the lights when it opens, nothing happens when it closes. Once the contact sensor fires, the app keeps the lights on until no motion. It's a very useful feature of the app. Because, at least in my experience, pretty much every zigbee contact sensor fires virtually instantly, while motion sensors can vary a lot, Even the same sensor at different times can vary. For some situations (like outside maybe, or a bigger room) a delay isn't as critical. But in a small room like a bathroom, or in my case, a basement utility room, it needs to fire instantly or its going to annoy everyone. The contact sensor has solved that for me.
At the risk of being coy, the best practice is to instruct the device to do what you want it to do. If there is a risk of uncertainty, then be more explicit.
Most of my motion automations include 3 states:
Motion detected; turn on light and set to level A
Motion not detected for X minutes; dim light to level B
Motion not detected for (X+Y) minutes; turn off light.
I made that mistake of not being explicit one time, when I installed the first smart dimmer in our house. My wife clicked the switch for the light over the kitchen island and it glowed like a nearly-extinguished ember. When she disapprovingly asked what is wrong with the light, I made it worse by explaining that a double tap would reveal the full brightness.
In my world, physically touching a switch or instructing Alexa is now akin to panic mode (straight to 100%). Originally, I tried automations that preset to 100% after turning OFF the lights. There was some odd behavior, but I was still on SmartThings back then. Perhaps I will revisit this idea when we move.
I'm learning to be more explicit and comprehensive.
I'm also thinking about adding an Echo speaks counseling session triggered by using a physical switch.
"Please do not touch the light switches on the wall. Report all perceived deficiencies in home automation to Hal for evaluation and possible, appropriate, remediation. Thank you."
I like the idea, but people are funny about putting their intentions into (logical) words. Also, with HAL being the computer from Space Odyssey, it would make me worry about what "remediation" might entail.
Maybe a physical activation dumps some information into a mini-log and you get a notification detailing the event. You can look for patterns or have covert discovery conversation ("So, tell me about your day ... specifically between 6:30 and 6:45").