Author Topic: Plugin: DelayLight  (Read 5053 times)

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 631
  • Karma: +92/-1
Re: Plugin: DelayLight
« Reply #60 on: July 12, 2018, 09:51:08 am »
Hey rigpapa,

Had a play with this and it *does* work - Not sure if you'd rather me comment on the Github issue or here but will just do here for now.

In my somewhat complex timer, it looks like if the "off" action dims one of the "on" devices (like in my TV watching scenario where if the TV is on, turn one light off and dim the other), then this sets a manual timer so defaults to the "on" status's. This essentially means the lights never get back to the 'off' state. This could be due to my dimming of the the lights being triggered through lua in a scene and not directly in the timer settings....?

Haha. So, with the addition of looking at the dimming level, DelayLight now sees your "off" scene activity as a manipulation of the light to "on", and initiates manual timing. But that should not be a problem if ManualOnScene is set to 0 in that DelayLightTimer--it should leave the scene alone and not reset it, leaving the one light off and the other dimmed as your scene prescribes. And because you still have a light on that's a watched load for that timer, it should be timing, so that seems OK. Are you sure ManualOnScene is set to 0 for that DelayLightTimer?

Quote
I have another timer for the hallway which is much simpler. On but dimmed to 50% when motion is detected, off after X seconds. When this is manually turned on and the manual timer is counting down, a change in dimming level resets the manual timer like expected with the new feature. When auto timer is triggered, changing the dimming level does nothing still - assume you haven't implement that option yet?

That option isn't provided yet. Once a DelayLightTimer starts in a mode, the mode does not change. That's too complex an issue to address before heading out the door on vacation.  :)

Quote
EDIT: Confirmed the dimming being set via Lua in my 'off' scene is what's causing the timer to hear a dimmer state change. When I changed the hallway timer to simply dim instead of turn off, it worked as expected. To get this working with my 'off' scene, I tried changing the watchMap() code for dimmers to listen for LoadLevelTarget events instead of LoadLevelStatus and although this did let the lights turn off and dim correctly, it also created a new manual countdown timer... even though everything is in the desired 'off' state - so that doesn't seem like a solution.

Now I'm really confused. But nonetheless, yes, your "off" scene setting a dimming level <> 0 would start manual timing. If any load is actually on (as in, drawing power), the timer should be timing. And also, because your light setting is in Lua, there would be no reasonable way for the timer to learn that 30% means "off" to you. The net effect of this, though, should only be that manual timing runs continuously on the timer until the lights are really, truly off (Status/LoadLevelStatus == 0). The timer periodically expiring will re-run your "off" scene, but that won't change anything from its current state. It's a harmless side-effect of your choice of implementation for that scene, unless I'm missing something more sinister in what you are describing.

Quote
As I'm new to Vera, Scenes and Lua, do scenes wait for all actions and code to run before returning true/success? When using scenes does the timer wait for any type response from the scene before continuing? Wondering if I can add some halt/wait in my scene Lua that gives my lights enough time to dim before they get heard from the timer (or something).

Scene execution in Luup is a "hail Mary." You tell it to run the scene, and hope that it does everything the scene prescribes. But, because any device can be offline at any time, there isn't a comprehensive summary status. When scene Lua is involved, you know even less about what's going on. You're just hoping it all works. There are alternate ways of running a scene where I can be notified when the job completes, but those are costly in real-time performance (the time between trigger and execution of the scene increases and becomes less deterministic than it already is), and will still only tell me when the scene execution ends, not if every part of its execution was successful (i.e. every device is now in the prescribed state).
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline ojovilla

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
Re: Plugin: DelayLight
« Reply #61 on: July 24, 2018, 06:39:43 pm »
I am trying to figure out how to use this as a "door left opened" timer. I can trigger a scene to send an alert after sometime using this plug in, but not quite sure how to cancel running the scene if the trigger (door) is no longer tripped .

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 631
  • Karma: +92/-1
Re: Plugin: DelayLight
« Reply #62 on: July 24, 2018, 08:45:51 pm »
I am trying to figure out how to use this as a "door left opened" timer. I can trigger a scene to send an alert after sometime using this plug in, but not quite sure how to cancel running the scene if the trigger (door) is no longer tripped .

What is your current configuration?
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline ojovilla

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
Re: Plugin: DelayLight
« Reply #63 on: July 25, 2018, 12:51:29 pm »
I just have it set so when the sensor trips , it?s starts a timer to trigger a scene . What I need is if the sensor untrips , it cancels the timer .

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 631
  • Karma: +92/-1
Re: Plugin: DelayLight
« Reply #64 on: July 25, 2018, 01:06:28 pm »
I just have it set so when the sensor trips , it?s starts a timer to trigger a scene . What I need is if the sensor untrips , it cancels the timer .

OK, but there are three different timing settings you can configure, and options, and they all can affect the behavior of the timer from just a bit to a lot. I really do need details to support you properly.

EDIT: You should use Reactor for this. It's much simpler.
« Last Edit: July 25, 2018, 06:15:57 pm by rigpapa »
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline ojovilla

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
Re: Plugin: DelayLight
« Reply #65 on: July 25, 2018, 08:33:39 pm »
I just have it set so when the sensor trips , it?s starts a timer to trigger a scene . What I need is if the sensor untrips , it cancels the timer .

OK, but there are three different timing settings you can configure, and options, and they all can affect the behavior of the timer from just a bit to a lot. I really do need details to support you properly.

EDIT: You should use Reactor for this. It's much simpler.

I see, thanks a lot, will look into it.

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 631
  • Karma: +92/-1
Re: Plugin: DelayLight
« Reply #66 on: July 31, 2018, 09:31:18 am »
Version 1.5 has been released. This version introduces two new features:

* The "on" delay logic now will now optionally abort its timing cycle and not turn lights on if all triggers sensors reset before the expiration of the "on" delay. This has also been made the default behavior, but can be controlled by setting the ResettableOnDelay state variable to 0--when 0, any triggering of the timer unconditionally turns lights on after the "on" delay, even if the sensors have reset. @ojovilla, this change now makes it possible to handle your request with simple configuration in just one timer rather than requiring a more complex configuration (and/or Reactor, as recommended alternative).

* A new ManualOnScene state variable controls "on" behavior for manual on events (only). DelayLight's default behavior is that if any light is turned on manually, manual timing is started and all "on" list devices are turned on to their prescribed levels. If ManualOnScene is set to 0, DelayLight will not change any other "on" list device when one is turned on manually, it just starts manual timing. There is no change to the behavior of automatic triggering--this always sets all "on" list devices to their configured states.

This version is currently available in both the Vera Plugin Marketplace and AltAppStore (for AltUI and/or openLuup).
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline tinnytonk

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
return luup.is_night()
« Reply #67 on: August 01, 2018, 08:10:05 am »
Is there a chance that you can add the is night option to the active time?

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 631
  • Karma: +92/-1
Re: return luup.is_night()
« Reply #68 on: August 01, 2018, 11:08:21 am »
Is there a chance that you can add the is night option to the active time?

One of the reasons I created Reactor was that it was becoming clear that DelayLight was going to need ongoing and ever-expanding trigger capabilities--you can look back in this thread and see some of the things people have asked to do. It was also obvious to me that anything I do in DelayLight for triggering would probably be handy Vera-wide, to work cooperatively with more devices and plugins, and fill a hole Vera left in their own trigger capabilities. So my bias now is to leave additional triggering to Reactor rather than packing everything into DelayLight. I can probably be convinced otherwise, but this is my thinking at the moment.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline ojovilla

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
Re: Plugin: DelayLight
« Reply #69 on: August 02, 2018, 03:45:45 pm »
Great!

Version 1.5 has been released. This version introduces two new features:

* The "on" delay logic now will now optionally abort its timing cycle and not turn lights on if all triggers sensors reset before the expiration of the "on" delay. This has also been made the default behavior, but can be controlled by setting the ResettableOnDelay state variable to 0--when 0, any triggering of the timer unconditionally turns lights on after the "on" delay, even if the sensors have reset. @ojovilla, this change now makes it possible to handle your request with simple configuration in just one timer rather than requiring a more complex configuration (and/or Reactor, as recommended alternative).

* A new ManualOnScene state variable controls "on" behavior for manual on events (only). DelayLight's default behavior is that if any light is turned on manually, manual timing is started and all "on" list devices are turned on to their prescribed levels. If ManualOnScene is set to 0, DelayLight will not change any other "on" list device when one is turned on manually, it just starts manual timing. There is no change to the behavior of automatic triggering--this always sets all "on" list devices to their configured states.

This version is currently available in both the Vera Plugin Marketplace and AltAppStore (for AltUI and/or openLuup).

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 631
  • Karma: +92/-1
Re: Plugin: DelayLight
« Reply #70 on: August 05, 2018, 01:05:12 pm »
Version 1.6 is now available in the AltAppStore, and should be available in the Vera Plugin Marketplace tomorrow. This is primarily a bug fix release that addresses an issue in the setup of inhibitors. It also allows an inhibitor to be any device that implements the SwitchPower1 service (a number of other plugins use this service rather than the sensor service for implementation).
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline aupperton

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-1
Re: Plugin: DelayLight
« Reply #71 on: August 19, 2018, 06:32:41 am »
Hi, I'm trying to install the DelayLight plugin but I'm running into some issues. I'm on Vera Edge UI7 running FW 1.7.4000.

I've installed the App which has created a "DelayLight Controller" master device but I don't seem to have the ability to create any child devices and can't see the Add Timer option. This master device does have a setting page where I can configure timings and triggers etc but it doesn't seem to work. The setup seems at odds with your documentation.

In the Vera Logs I'm seeing these errors

01      08/19/18 11:26:56.446   JobHandler_LuaUPnP::HandleActionRequest can't find urn:toggledbits-com:serviceId:DelayLightTimer <0x72fe2520>
02      08/19/18 11:26:56.446   JobHandler_LuaUPnP::RunAction device 441 action urn:toggledbits-com:serviceId:DelayLightTimer/Trigger failed with 401/Invalid Service <0x72fe2520>

Am I missing a step somewhere?

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 631
  • Karma: +92/-1
Re: Plugin: DelayLight
« Reply #72 on: August 19, 2018, 09:49:06 am »
Am I missing a step somewhere?

You're doing nothing wrong, there's a bug in 1.6 that's affecting new installs. I've already posted the fix to the Vera store, but they only approve once a week right now, on Sunday-Monday overnight, so tonight. If you don't want to wait for tonight's fix/update, right-click on this link and save the link target as D_DelayLight_UI7.json somewhere on your local drive. Make sure you get the name right, caps and all, exactly as shown. Then go into your Vera to Apps > Develop apps > Luup files and upload that file using the upload tool there. Then hard-reload your browser (CTRL-F5 for Chrome/Windows, SHIFT-F5 for Firefox/Windows, etc.). That should do it. Your DelayLight master device should then display properly as shown in the documentation.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline aupperton

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-1
Re: Plugin: DelayLight
« Reply #73 on: August 19, 2018, 01:20:31 pm »
That's worked a treat - many thanks.

Offline tculpepp

  • Newbie
  • *
  • Posts: 13
  • Karma: +2/-0
Re: Plugin: DelayLight
« Reply #74 on: September 01, 2018, 10:36:16 am »
I have a Vera scene with no ties to any delaylight instances, but yet it is somehow triggering 2 separate delaylight instances.  The only thing in common is some overlapping lights (e.g. the light exists in both the Vera scene and the delaylight instance) . Is there some magic trigger I am missing going on here?

Update: I just read the fine print that triggering from a scene through lua = automatic trigger, and that trigger any device in the on list will initiate a manual timer unless zeroed out.

Great app, thanks!
« Last Edit: September 01, 2018, 10:49:18 am by tculpepp »