Smart Light Timer dimmer modification? Is this possible?

I see the Smart Light Timer in the Convenience section of the app. This looks like ALMOST exactly what I would like.

The modification I would love to see (if possible) is if the light is already on, increase dimmer to 100% for x minutes, then return to previous dimmer level.

Here is the scenario, which others might have as well. We have a coat closet that does not have a light inside of it (as I’m guessing most people do). However, there is a recessed light right outside of the closet. I’m putting a door sensor on the closet and will have that light turn on when we open the door. However, that light is also in an area where it is on often, but at a lower level (like 60%). When I open that door, however, I would love to see it go to full brightness and then return to the previous level.

Thoughts?

2 Likes

This is fairly simple. Assuming that you want the light to go to 100% whenever the door opens, and then to return to it’s previous level. You said do that if it was already on, but didn’t mention what you want to happen if it’s not already on. So let’s ignore that detail for a moment.

You would have a small app that subscribes to the contact opening. The first thing it does is to save the current state of the light in it’s state variable. Then it sets the dimmer level of the light to 100%. The app also subscribes to the contact closing. When that happens, it sets the light to its previous setting (which might have been off, or at whatever dimmer level it was).

If you need more refinement based on the beginning state of the lights, that would be easy to incorporate. For example, if you only wanted it to go to 90% if the light was off, you just add that logic to the contact open method.

Sound right? If so, I can send you the code that does this, or help you write it yourself.

1 Like

Basically, I would like take the existing Smart Light Timer that is in the app, “if it is on, dim to 100% for X minutes and then return to previous setting.” If it is off, turn it on to 100% and then turn it off after X minutes. The existing smart app also has if the switch is toggled while the timer is running it cancels the timer. Again, that app is almost exactly what I would like, except for the pre-existing dimmer setting if on.

I’m not a coder…well, I have coded before, but not in this language. So, I’m at a bit of a loss on this one.

I just lifted a whole bunch of code from @wackware, specifically from his Scene Machine app. I made only small changes to come up with the app below.

What this does is ask you at install for a contact sensor and some dimmers (could be just one). What happens is that when the door opens the dimmers will all go to 100%, irrespective of what state they were in (on, off, dim, bright). When the door closes, the lights will go back to the way they were.

I don’t know if this fills your need, but it should be close! If not, let me know what tweaks you want – should be easy to go from here…

EDIT

The code is basically @wackware’s Scene Machine with a contact sensor trigger, and 100% brightness grafted in. This should work well for a closet light use case.

2 Likes

@bravenel - THANKS! As soon as I get back home from vacation I’ll test it out. Very exciting and I think it’ll have a high family approval factor!

1 Like

This is exactly what i need. Want to use it for the closet in the hallway, add a sensor to the door. When opened set the lights at 100% when closed back to the original.

Thanks for sharing this. Will try it when the sensors and dimmers arrive.

Great…so I’m not the only crazy one here that had a need for this!

1 Like

@bravenel - this works great! However, about 10% of the time, it resets back to the “previous, previous” level. I’m going to do some more testing tomorrow to see if it is a timing issue, but I have seen it do it three times so far in testing and use. But, like I said, i need to test more so there is actionable data! I’ll let you know.

In other news, my daughter LOVES that the might comes on when the closet door opens so she can see inside. She was playing with it a bunch. My wife has not noticed yet. So, I figured I would keep it quiet and see how long it takes her to notice. :smile:

Try the slightly edited version now in Github… I think it might be missing some light settings, especially if things happen fairly quickly.

1 Like

If the version numbers are correct, that is the one I’m using - 1.1 with the last edit of 2/13. I have not been able to figure out the issue. Also, the issues with the ST cloud over the past week or two have not helped trying to troubleshoot this. I’ll continue to keep an eye on things. Thanks again for the code.

Does this still work. Mine stop working. I can’t open it anymore to edit it just say I’m not authorized. And seems it’s seems not working. I have lights outside in front entrance that activates by sunrise and sunset dimmed at 10%. And this light will go 100% bright when front door open but its not working anymore. I don’t know why.

You should Uninstall the app from SmartThings, and start over with it. That should clear up whatever problem you are having. I have not used this app recently, but it should still work.

i can’t uninstall it because it will say “you’re unauthorized for the requested operation” when I try to open it.

Then delete it using the IDE.

I cant delete the app in IDE because it will say it is installed by one or more user s.

Another when I try to click save code of the app in the IDE it gives error “java.lang.NullPointerException: Cannot get property ‘Which?’ on null object @ line 43” sorry I don’t understand this thing.

Did you actually try?

It sounds like your system is messed up. You should contact ST support. None of this is a normal error condition.

I have similar issues with the app. I can’t delete it either. I’m opening a case with support - I already have several open, which is a little disheartening at the moment.

yes, when i try to delete this display at the top “This SmartApp can’t be deleted at this time because it is installed by one or more users”