Plugin: DelayLight

[quote=“jarrodirwin, post:60, topic:198651”]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…?[/quote]

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?

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. :slight_smile:

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.

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).

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?

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.

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.[/quote]

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

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 [tt]ResettableOnDelay[/tt] 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 [tt]ManualOnScene[/tt] 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 [tt]ManualOnScene[/tt] 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).

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.

Great!

[quote=“rigpapa, post:67, topic:198651”]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 [tt]ResettableOnDelay[/tt] 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 [tt]ManualOnScene[/tt] 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 [tt]ManualOnScene[/tt] 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).[/quote]

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).

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?

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 [tt]D_DelayLight_UI7.json[/tt] 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.

That’s worked a treat - many thanks.

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!

DelayLight watches any devices named in its “on” and “off” lists. These will trigger a manual timing cycle when operated manually. No magic. That’s performing as spec’d. If you can give a little more detail about your configuration and how it’s currently creating a problem for you, I can probably make some more detailed suggestions.

EDIT: By the way, by “manually” above, I mean “not operated by DelayLight itself”. So if you run your scene manually or by some other mechanism, and that scene affects a light that DelayLight is watching, DelayLight sees that as a manual operation.

So I’ve got a scenario, and I’m wondering if I can pull it off with delaylight. I want to control a fan so that it is only turned on manually, but then kept on as long as there is no motion in the room. I feel like delaylight can do this, but I can’t come up with the right combination of variables in my head to make it work properly.

Anyone done setting like this or have an idea how to set it up?

[quote=“tculpepp, post:77, topic:198651”]So I’ve got a scenario, and I’m wondering if I can pull it off with delaylight. I want to control a fan so that it is only turned on manually, but then kept on as long as there is no motion in the room. I feel like delaylight can do this, but I can’t come up with the right combination of variables in my head to make it work properly.

Anyone done setting like this or have an idea how to set it up?[/quote]

This would be more straightforward to do in Reactor:

First, I’m assuming you mean the fan is kept on as long as there IS motion in the room? Set up a ReactorSensor with two conditions: (1) Fan switch SwitchPower1/Status = 1, and (2) Motion Sensor SecuritySensor1/Tripped = 0 + duration option (click the down arrow next to the value field, set the duration to whatever length of time should pass after motion before the fan is turned off).

This ReactorSensor will trip whenever the fan is running and the motion sensor has stopped seeing motion for longer than the set duration. That trip is the “turn the fan off” signal, so set up a scene to turn your fan off, and use that scene as the “Tripped” action in the ReactorSensor’s “Activities” tab. The ReactorSensor will untrip/reset itself, because the scene turns the fan off, which then breaks the first condition.

Be aware that motion sensors have their own internal “reset” time, the factory default for which is often quite large, like 2 or 4 minutes. That means that the motion sensor itself will not send its “untripped” (no motion) signal to the Vera until there’s no motion for that duration, and only at that point can your ReactorSensor start its countdown, so the total time before the fan would go off is the sum of the motion sensor’s reset time and the ReactorSensor’s condition duration option. With many motion sensors it is possible to have Vera send a configuration option to change the sensor’s built-in reset delay (e.g. Aeon MultiSensor parameter 3); some are only settable via jumpers in the motion sensor itself, and have few options (e.g. EcoLink PIRs). This delay is meant to optimize battery life by reducing redundant motion reports, so setting smaller values may come at the cost of more frequent battery changes.

Yes, I did mean the fan would be kept on as long as there IS motion.
Sorry about that. Reactor was my next option. It sounds like that will be the way to go. Thanks for the second set of eyes and the knowledge.

One last question. Does a sensor need to be in the armed state to trigger delaylight or can it work when armed or disarmed?