How to get script to work? ("LightsOffAfter10Minutes" original script from install)

  • 151 Views
  • Last Post 17 October 2015
lewan posted this 16 October 2015

[quote=lewan]Hello!

I try to make a switch to turn off after 60 minutes. Use the following original script. "LightsOffAfter10Minutes" but renamed it and edited the file. if (d.stateTracker.timeSinceLastChange.TotalMinutes > 60) {

The switch starts, but does not want to shut down after 60 minutes.

Se this image. http://www.fjollrosa.se/temp/uploads/printscreen.JPG

Thanks!!

//Tobias[/quote]

I have got this to work by creating a virtual device (VD). I created the VD and set it automatically turn off at 60 minutes. The rule I use is when the light is turned on, I also turn on the VD that starts the countdown. After an hour, the VD will turn off. I create a 2nd rule that when the VD turns off, to turn off the physical light.

OR

You can create a rule to turn the light on, add a timer to your rule (in milliseconds)3,600,000 milliseconds equals one hour, then add to the rule light off.

Order By: Standard | Newest | Votes
weidnerj posted this 17 October 2015

[quote=lewan]Hello!

I try to make a switch to turn off after 60 minutes. Use the following original script. "LightsOffAfter10Minutes" but renamed it and edited the file. if (d.stateTracker.timeSinceLastChange.TotalMinutes > 60) {

The switch starts, but does not want to shut down after 60 minutes.

Se this image. http://www.fjollrosa.se/temp/uploads/printscreen.JPG

Thanks!!

//Tobias[/quote]

I have got this to work by creating a virtual device (VD). I created the VD and set it automatically turn off at 60 minutes. The rule I use is when the light is turned on, I also turn on the VD that starts the countdown. After an hour, the VD will turn off. I create a 2nd rule that when the VD turns off, to turn off the physical light.

OR

You can create a rule to turn the light on, add a timer to your rule (in milliseconds)3,600,000 milliseconds equals one hour, then add to the rule light off.

lewan posted this 17 October 2015


I have got this to work by creating a virtual device (VD). I created the VD and set it automatically turn off at 60 minutes. The rule I use is when the light is turned on, I also turn on the VD that starts the countdown. After an hour, the VD will turn off. I create a 2nd rule that when the VD turns off, to turn off the physical light.

OR

You can create a rule to turn the light on, add a timer to your rule (in milliseconds)3,600,000 milliseconds equals one hour, then add to the rule light off.




Thanks, i try the last one!

Close