Really?, all the drivers we write will turn the device on via set level if it was off.
There are a few that have preference options to change this, but the default is to turn on a dimmer if it was off when a set level command is received.
What specific device and driver do not work this way?
Ok, now I'm lost... Can you send the complete debug (by activating the debug option in the app)? I need to figure this out and for now I've been incapable to reproduce the same bug.
I'm using the generic driver. Maybe the issue was coming from something else in my code and, as you can see, I'm still working on it! I can't figure out what goes wrong for @black01gt since I can't get the same error message...
I figured this out, this is a mistake in my code and it is due to my iteration: device is turned off() but keeps the dimming value as current value so when the app checks for the dim value (to prevent redundant cmds) it "thinks" it's already properly set... so a simple dimmers.on() does the trick or dimmers.setLevel(0) instead of off()...
i = 0
def s = dimmers.size()
for(s!=0;i<s;i++)
{
def a = dimmers[i]
def aVal = dimmers[i].currentValue("level")
def message = "$a is currently at ${aVal}% and needs to be set to ${val}%"
logging(message)
if(aVal==val){message = "$a level is ok"}
logging(message)
if(aVal != val)
{
dimmers[i].setLevel(val)
logging("${dimmers[i]} set to $val ---")
}
}
Thank you, you! Especially for taking the time to help out with this.
You might want to update again since there's a little bug, as described in my last answer to @mike.maxwell, otherwise under certain circumstances your lights won't turn on. I just updated the repository.
Looking good. Thanks for all your hard work. Something I thought might be a good feature. Being able to set a minimum lux level also. That way the lights can hit 100% sooner.
I did notice what seems to be a bug. I checked al my other apps but if no motion sensor is selected it will not update the lights. The below shows up in the logs.
app:21132020-01-20 07:26:14.486 am info0 active motion events in the last null minutes stillActive() returns false
app:21132020-01-20 07:26:00.040 am info0 active motion events in the last null minutes stillActive() returns false
app:21132020-01-20 07:25:47.958 am info0 active motion events in the last null minutes stillActive() returns false
Just saw that the debug might still tell you that the function returns false while in fact it returns true because I forgot to modify the variable accordingly in the debug. It should still work though. I've fixed it, of course, but that's another commit since your last message. You may want to update only if you care about proper debug info...