[OBSOLETE] Lighting Director

@tslagle13. Is it possible to add a time frame window for an action to run?

Maybe this has been asked and if so sorry. But is it possible to copy slots?

Converted my 4 Smart Lights over to the Director last night and so far all is well. Should be able to remove 4 apps! I hate clutter, thanks for this!

Agreed. I’m all about consolidating apps.
(if it makes sense to)

Tim, this looks like exactly what I need, but I’m having issues in a couple of areas in my house getting it to work. Heres’s an example - the lights won’t turn on in the following setup:

Devices
Linear WD500Z-1 Z-Wave 500-watt Wall Mount Dimmer Switch
Ecolink Z-Wave PIR Motion Detector, Pet Immune (PIRZWAVE2-ECO)

Mode: Home

Lighting Director Setup
Slot 6
Scenario Name: Awake - Basement Front
Using these motion sensors: Basement Main Motion Detector
Dim the following: Basement Main Dimmer
Set dimmers to this level: 60%
Turn off this scene after motion stops for (minutes): 6
Only during the following modes: Home, Kids Sleeping

Logs - Basement Main Area Motion
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace setSolutionEvent()
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: info SOLUTION_SUMMARY data: [[icon:indicator-dot-orange, iconColor:#53a7c0, default:true, value:5 motion], [icon:indicator-dot-green, iconColor:#878787, value:3 no motion]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace motionCount: 8, cameraCount: 0
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace activeCount: 5, notActiveCount: 3
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Basement Bedroom Motion states: [[summary:inactive]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Driveway Motion states: [[summary:inactive]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Foyer states: [[summary:inactive]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Master Suite Bedroom states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Family Room states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Basement Stairs Motion states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Basement Main Area Motion states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Master Suite Office states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: info SOLUTION_STATE stateData: [activeCount:1, inactiveCount:0, cameraCount:0, icon:st.motion.motion.active, backgroundColor:#53a7c0]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace setSolutionState()
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace updateSolutionState([Basement Main Motion Detector]) - overrideValue:null
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: info switchHandler(Basement Main Motion Detector, motion:active)

Logs - Lighting Director
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:53 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2184
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:53 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2223
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:52 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2184
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:52 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2184
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:52 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2223
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:52 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2223

Complete logs during test:
bbdf2f2a-57fc-4a13-b206-eff031d07f6f 2:03:04 AM: info SOLUTION_STATE stateData: [activeCount:0, inactiveCount:1, cameraCount:0, icon:st.motion.motion.inactive, backgroundColor:#e8e9eb]
bbdf2f2a-57fc-4a13-b206-eff031d07f6f 2:03:04 AM: trace setSolutionState()
bbdf2f2a-57fc-4a13-b206-eff031d07f6f 2:03:04 AM: trace updateSolutionState([Master Suite Office Multisensor]) - overrideValue:null
bbdf2f2a-57fc-4a13-b206-eff031d07f6f 2:03:04 AM: info switchHandler(Master Suite Office Multisensor, motion:inactive)
a7e6aac3-6a90-4396-be1f-d4f4e398a4c9 2:03:04 AM: debug Parse returned [[value:inactive, name:motion, descriptionText:Master Suite Office Multisensor motion has stopped, isStateChange:false, displayed:false, linkText:Master Suite Office Multisensor]]
a7e6aac3-6a90-4396-be1f-d4f4e398a4c9 2:03:04 AM: debug Parse returned [[value:inactive, name:motion, descriptionText:Master Suite Office Multisensor motion has stopped, isStateChange:true, displayed:true, linkText:Master Suite Office Multisensor]]
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:53 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2184
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:53 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2223
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace setSolutionEvent()
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: info SOLUTION_SUMMARY data: [[icon:indicator-dot-orange, iconColor:#53a7c0, default:true, value:5 motion], [icon:indicator-dot-green, iconColor:#878787, value:3 no motion]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace motionCount: 8, cameraCount: 0
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace activeCount: 5, notActiveCount: 3
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Basement Bedroom Motion states: [[summary:inactive]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Driveway Motion states: [[summary:inactive]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Foyer states: [[summary:inactive]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Master Suite Bedroom states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Family Room states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Basement Stairs Motion states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Basement Main Area Motion states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: debug Master Suite Office states: [[summary:active]]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: info SOLUTION_STATE stateData: [activeCount:1, inactiveCount:0, cameraCount:0, icon:st.motion.motion.active, backgroundColor:#53a7c0]
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace setSolutionState()
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: trace updateSolutionState([Basement Main Motion Detector]) - overrideValue:null
fae14ea5-4dc0-4b2d-940a-aad27010657e 2:02:52 AM: info switchHandler(Basement Main Motion Detector, motion:active)
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:52 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2184
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:52 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2184
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:52 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2223
5abd24b8-f411-4dc6-9f55-ff62b4d3365a 2:02:52 AM: error java.lang.NullPointerException: Cannot invoke method latestValue() on null object @ line 2223
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: trace setSolutionEvent()
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: info SOLUTION_SUMMARY data: [[icon:indicator-dot-orange, iconColor:#53a7c0, default:true, value:4 motion], [icon:indicator-dot-green, iconColor:#878787, value:4 no motion]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: trace motionCount: 8, cameraCount: 0
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: trace activeCount: 4, notActiveCount: 4
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: debug Basement Bedroom Motion states: [[summary:inactive]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: debug Driveway Motion states: [[summary:inactive]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: debug Foyer states: [[summary:inactive]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: debug Master Suite Bedroom states: [[summary:active]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: debug Family Room states: [[summary:active]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: debug Basement Stairs Motion states: [[summary:active]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: debug Basement Main Area Motion states: [[summary:inactive]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: debug Master Suite Office states: [[summary:active]]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: info SOLUTION_STATE stateData: [activeCount:1, inactiveCount:0, cameraCount:0, icon:st.motion.motion.active, backgroundColor:#53a7c0]
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: trace setSolutionState()
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: trace updateSolutionState([Basement Stairs Multisensor]) - overrideValue:null
081c3744-ab16-4501-a473-16e2b5738a66 2:02:46 AM: info switchHandler(Basement Stairs Multisensor, motion:active)

Have I set up something wrong?

Thanks in advance for your help!!!

Updated to Version 1.3

  • No longer requires a lux value for a scene to run.
  • Fix slot 10

Tim,

Found a couple items that need tweaking…Would you want people to branch off your code or just report bugs here? Here is what I found (minor, to be honest):

  1. If you go into an empty scene the word “null” appears at the top…Probably could suppress this or a label like “unnamed scene”

  2. On each scene, the “Help” at the bottom… you have ‘canalso’ without a space separating the words…

Otherwise, great app…was trying to do this as well, but why re-create the wheel…As for possible suggestions:

  1. Allow for a global light/no light switch just off of sunrise/sunset
  2. Instead of this just being motion based, allow different inputs of activity, like a lock being unlocked (entryway light), or a door opening (i.e. an inner garage door opening turns on the main light in the garage). Or even a garage door opening event.

Just thoughts…otherwise, great!

1 Like

It’s up to you. If you merge back I will accept positive changes. But if you don’t any updates I do will not include your changes.

For these minor changes I will just let you include them in your next bug release…

For my wish list I may take a crack as some them and send them to you if I can figure them out.

1 Like

Tim - the new code solved the slot 10 and lux problems for me. THANKS!!!

1 Like

Tim,

I changed my mind and created a pull request with the syntax changes I mentioned above. Let me know if I did it correctly, you can see it, and if you place these into your master code.

.:Edit:. I also fixed the null title item…let me know if that shows up in the pull request.

.:Edit 2:. I changed the icon for something I hope you like and submitted that change as well at the bottom of the pull request. Enjoy.

@tslagle13

Are the’re any plans to add the function to turn on or off lights using a schedule?

This would help in bringing in light control into one app vs. spread across several different ones and make it easier to navigate within ST when making changes.

1 Like

All,

I took the challenge and updated the app to what I call version 1.4. Here are the revisions:

  • Fixed various syntax issues
  • Optimized the code (Found redundent pieces that could be defined once instead of 15 times)
  • Removed the “Uninstall” from the 15 scenarios (I kept thinking it deleted the scenario, but it actually uninstalled the app)
  • New icon
  • The biggest change is to add door contact sensors in addition to motion sensors to turn on lights. So, each scenario can be activated by either trigger

I have a bit more testing to complete and may add a couple more items. Would anyone be interested in adding a ‘lock’ trigger? In other words, when you unlock a door it turns on a light (I use this in one of my houses to ensure the entryway light is on before the door is opened so I can ensure I see the cat)

Also, is anyone using more than 4 of the 15 scenarios? To address Andrew’s question above, and something I found in this code, is that if you schedule over 4 items that have timers the 5th will not schedule until one of the standing schedules goes away. This is listed here in the documentation: http://docs.smartthings.com/en/latest/smartapp-developers-guide/scheduling.html. This only affects anything scheduled (timers)…just monitoring sensors allows for more than 4 items. However, I did some testing, and because of the size of this app, there is a perceived delay in turning on a light now that I didn’t have with a single scenario app.

So, getting back to Andew’s question, adding a scheduling function wouldn’t allow for more than 4 scenarios from one app, and could make the activation of lights even slower.

Should I concentrate on adding just more functions to this app, or trying to optimize for speed and remove all but 4 slots?

I will post the update here and back to Tim in case he wants to add this to his main code train.

2 Likes

Push it to my git :smile:

You rock dude!!! Thanks!:slight_smile:

Also the scheduling issue is why I will not be submitting this to smartthings for official support. So this app will forever remain a “unofficial” app haha

Did you submit this app? Please do.

1 Like

I definitely can!:slight_smile:

I do have some kinks to work out first though :smile:

Few small things.

1 Like

Tim,

I have pushed this back out to your Git after one more revision this morning. In addition to what I posted last night, I added a visual indicator to the main screen…If the title is NOT empty, it is now green; empty it remains the grey indicator to the right of the scenario.

Let me know if you see it, have any issues with it, or publish it (you will probably want to move the icon files to your GitHub instead of referencing mine).

I did see an opportunity here for making this time based as well. Not like Andrew was suggesting via a schedule, but instead of it being based on a lux setting base it on what time it is and parameters set up in the app (i.e. between 10am and 12 pm).

Enjoy!

4 Likes

I would love to test this out as I have a situation where I can use this in my Kitchen after a certain time. So for example, I want the Kitchen lights to stay on for one hour until 7:30pm. After 7:30pm it should come on when motion is detect and lux is at x but turn off after 3 minutes. I hope I am understanding this correctly. Please let me know if I am wrong. Thanks

Let me see what it would take to implement this as the next feature (unless Tim gets to it first).

Thanks. I guess I misunderstood. I look forward to it bing implemented.