Light level based on luminescence

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.

Thanks again for your help with this.

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 have updated the app again. I think I know what might have happened: some options were not marked as required while they should have been.

Please, if you are willing to help again, to make sure there are no old values remaining in your database, please follow the following steps:

  1. Uninstall the app
  2. Remove the old app code, completely delete it.
  3. Re-create the app code by pasting (see link below) the new code into a fresh new app
  4. Reinstall the app

CLICK HERE TO ACCESS THE LATEST VERSION.

Best,

Updated. Will let you know how it goes.

Updated and everything seems to be working just fine. Thanks

1 Like

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.

1 Like

There's again a bug in my previous update... that might make your app not update illuminance (a stupid typo). It's fixed now in the last commit.

I'll definitely work on this minimum, it's a great idea.

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

Yes, it's a mistake I made when I modified the app, I forgot to reinstate the default "true" value for when user did not select a motion sensor.

Please, update your code from the repository, it should all be ok after that: CLICK HERE

Hum samething. Still only works when motion sensors and checked.

Damn! I know why. Fixing this just now. Sorry about that.

Ok, it's fixed. Stupid mistake in the motion sensors boolean.

No problem. Appreciate all your work on this. Updating now.

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

Updated and lights stayed on. I’ll let you know how it goes tomorrow as it is dark now.

Everything is working great.

1 Like

Just installed, HE with latest firmware, and getting these errors. Is it serious?