Vacation Mode / Randomize Lights?

Mariano,
Your Random Lights on-off Smartapp works well. Thank you.
Kelly

1 Like

Kelly,
You are wellcome,
I am very glad that it is useful to you :+1:

Hi Mariano (and all)! Yes, thank you for this app. I’m new to automation, and clueless on how losing groovy will impact me. Will apps like this just be gone? Only to be replaced by some non-Samsung independent developer? If so, so many custom apps will never be replaced because they are niche (like this one, MyQ garage opener, alarm.com, Flume flow meter and others I have). Is that all true? Sorry for the newbie comment/questions.

@fade6,
You are wellcome.

I think that yes, these apps would disappear, but surely there are other users who will be able to answer you with more precision than I can.
Somes apps are availables In smartthings labs apps. Only for android and some countries

@Mariano_Colmenarejo
I’m sorry to say I spoke too soon. After a successful test of the app, I shut it down, and the next day my lights started going on/off unexpectedly. I setup the “rules” section (Time on, Time off), and suspected that maybe I did something wrong by reinstalling the app a couple times to try different lights. Likely I made a mistake, so I uninstalled the DTH and App figuring that someday later I would reinstall and use in automations instead to make sure I don’t screw it up. But then, a very strange thing happened! With the DTH and App DELETED, even removed from my IDE, my lights turned on/off today!! I would turn one off, and then 30 min later or so it would turn on again. How is this possible? Does the app send code or something to the device somehow and the device remembers this? The only fix was to exclude my lights from the hub, and then add them back in. All seems stable now. Anyways, I wanted to mention this because it seemed so strange. But to be clear, I suspect I made a mistake somehow, and will give it a try again (with only one light to be safe) using automations.

@fade6,
Yes, it seems very strange what happened to you. the app does not send anything to the devices, which is saved in it
The app may be not deleted in IDE. You enter Locations, my smartapps and there you see the ones you have installed, click edit and you can delete them.


If you are going to use it with automations or smart ligting app, you only have to select the lights, program the minimum and maximum time and what actions you want for when it ends, everything off, for example. A name for the app and the controller.

You can create the apps you want, with different names, same or different lights and times and thus create different random combinations.
To test, you can create 3 or 4 simulated switches in IDE and when you finish the tests you delete them.

Great idea on virtual switch tests! Thanks again.

Hi Mariano,
The Random Lights on-off is now having troubles. It leaves long periods with dark rooms. The lights are off for very long periods. Two copies of the SmarpApp have been set up, one with two lights and the other with only one light. The operating period is about three hours. The random interval is 10 or 20 or minutes. Should the random interval be longer?

Which is the correct version of Gentle Wakeup Controller to use with your Random Lights on-off? Right now The standard one was loaded using From Example . I see that in around February you provided a couple a couple improved versions.

It will not let the Gentle Wakeuo Controller Device Controller because it is in IN USE. Does the SmartApp have to be removed from ST first?

I am new at using Zwave and ST.

Hi Kelly,
I modified the DTH of the controller because some users had no connection problem when creating it and I changed the VID definition to “generic switch” so that when creating it there would be no problems. If you already have it working online, you don’t need to change it.

If you have configured a minimum time of 10 minutes and a maximum of 20 minutes, it is normal that it can be on or off for long times. I have configured between 1 and 12 minutes for three lights.
I explain how the application works and so you can make a better configuration:

  1. The first thing the app does when it is activated is to calculate with the random () class, in seconds, a random time between the minimum and maximum values ​​selected. In your case, it will choose a number between 600 and 1200 seconds.

  2. When that time is reached, execute another class random () to randomly choose one of the selected lights. In this way, each day will start at a different time that the automation is executed.

  3. Checks the current status of the randomly chosen light and if the light is “off”, it turns “on” and if it is “on”, it turns “off”. As in your case choose between 1 and 2 lights and could repeat the light could be 40 minutes or more “off” or “on”.

  4. This continues successively until the virtual controller is turned off with automation or programming.

That is why in the pdf guide, I said that if several lights were chosen, the times should be shorter, but it all depends on the effect you want to achieve.
If you create more than one app, you can choose the same lights, if you want, with other times.

I hope I have clarified a little more about how the app works.

Marino,
Thank you that helps.

Kelly Cushing
(503) 888-8411

2 Likes

I will try it !..You rock my friend, thanks,…this is great !.

1 Like

Mariano, I have a specific use case and this SmartApp does exactly what I need except for one tweak I need.
How can I build a delay before the next On event? So if the device is on and finishes the random time and turn off, I want to have a delay of at least 1 hour before the device turns on again. I does not have to be a specific duration, just at least one hour.
I have been looking at your code for a bit today and it appears you use newTime as the random calculation for both on-time and off-time.

I have only 1 switch I want to control so random device selection would not impact me.

Would it be possible to add a delay before dimmer.on in the following?

if (dimmer.currentValue(“switch”) == “off”) {
dimmer.on()
} else {
dimmer.off()

Thank you for the app and your attention!

I do not know if I have understood it correctly, but if you choose the minimum time 60 minutes and the maximum time 61 minutes, you would enter and pay each interval between 60 and 61 minutes.
I don’t know if this would be worth it.

Sorry that I wasn’t clear. I want to have the time the switch is on be low. Something between 5 and 10 minutes. And then I want the off time to be (something between 5 and 10 minutes + 60 minutes).
So I just want to add 60 minutes to the timeCalculate when the next on delay is calculated.

I was looking at your code but could not figure it out because you calculate the random time first and then when the delay is over you pass it to the dimmer device in an if statement (if on turn off / if off turn on). I tried adding an additional runIn in the if statement but it is ignored for some reason.
runIn(60*60 , dimmer.on())

Thank you!

@Mariano_Colmenarejo I think that @fstr is looking for something like Fan Circulation Schedule you implemented in Zigbee Thermostat or combination of both Random and Scheduled
Random Min Time
Random Max Time
Random Off Time

1 Like

That does not work, it will even give a fatal error when executed, it already makes a call to a method that does not exist, dimmer.on ().

I have made a version in github with the modification, it is called Random Lights Modified, I will put the name you want when creating the controller.

Note that groovy-based apps will disappear when groovy disappears.

Try it and after some days I will delete de file

So simple! Thank you very much! I will give it a try.

Actually, it is running into the same problem I had when trying to update the code myself;
When it calculates the first delay (before the first run), the dimmer is not defined yet so it cannot know the state of a dimmer that is not defined.

error java.lang.NullPointerException: Cannot invoke method currentValue() on null object @line 344 (timeCalculate

What about No worries while away in SmartThings Labs?

I already have it, but I want to improve it.
I’ll let you know when it’s done