Author Topic: Running scene only if the device is not already on.  (Read 106 times)

Offline wesleyj

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
Running scene only if the device is not already on.
« on: November 10, 2017, 09:11:08 am »
I am attempting to setup a night light scenario.  That itself is simple yet if the light is already on (you're staying up late) then the night light scene runs, it then turn off the light.

Example:  Nightlight runs based on motion and runs the light for 10 minutes then turns the light off.  If you already had the light on the all you have done is turn off the light when you did not mean to.  The proper logic is "run scene nightlight if the light is not already turned on".  I assume Luup code is required but I have not seen an example of this specifically.

any help appreciated. :-)
« Last Edit: November 10, 2017, 09:12:45 am by wesleyj »

Offline jswim788

  • Hero Member
  • *****
  • Posts: 536
  • Karma: +29/-2
Re: Running scene only if the device is not already on.
« Reply #1 on: November 10, 2017, 11:37:02 am »
this is the thread you want: http://forum.micasaverde.com/index.php/topic,18679.0.html

Specifically, this one calls out running or not running a scene depending on the state of a switch:

http://forum.micasaverde.com/index.php/topic,18679.msg141959.html#msg141959

Offline Don Phillips

  • Hero Member
  • *****
  • Posts: 889
  • Karma: +18/-16
    • Worthington Engineering, Inc.
Re: Running scene only if the device is not already on.
« Reply #2 on: November 10, 2017, 07:43:52 pm »
I would suggest using PLEG, which allows complex logic including AND. Easier (to me) than learning LUA.
Vera 3, UI7 1.7.947, CT101 t-stat, Everspring motion detector, GE/Jasco switch, Leviton outlet, AeonLabs door sensor, Insteon garage control, Blue Iris, Sricam SP011, iPhone locator, APCUPSD, VeraMate, VeraAlerts, PLEG, House Modes, Countdown Timer, DVR, Virtual & Multi Switch, Weather, Sys. Mon.