Author Topic: Plugin: DelayLight  (Read 5795 times)

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 671
  • Karma: +101/-1
Re: Plugin: DelayLight
« Reply #15 on: May 14, 2018, 12:49:52 pm »
Your comment is both flattering and helpful!  :) I'm a bit shy about upgrading my firmware these days, so knowing you're successful on 3798 is a big help in several ways. Also, I'm always open to ideas, so I'd love to hear your thoughts about features and functions.
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 HSD99

  • Sr. Member
  • ****
  • Posts: 282
  • Karma: +11/-0
Re: Plugin: DelayLight
« Reply #16 on: May 14, 2018, 04:33:40 pm »
I'm grateful that you are developing some extremely useful plug-ins. Since I have a test VP, I'll be glad to test for you (assuming it doesn't require hardware I don't have.) I typically upgrade the test system as soon as new software is announced to try and help the community with a thumbs-up or thumbs-down.

And, yes, as you noted, my production machine is on 1.7.3232 from last October due to the same nervousness.  ;)


Offline HSD99

  • Sr. Member
  • ****
  • Posts: 282
  • Karma: +11/-0
Re: Plugin: DelayLight
« Reply #17 on: May 14, 2018, 07:30:59 pm »
Upgraded to 1.7.3831 just now and all is well. :D

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3258
  • Karma: +191/-9
Re: Plugin: DelayLight
« Reply #18 on: May 14, 2018, 11:27:54 pm »
Good work on the plugin, rigpapa.  This plugin will be of interest to anyone who has been using my old Countdown Timer plugin (which AFAIK still works on recent firmwares but which I'm not making any updates for). My plugin was designed to be the barest of barebones in adding timers to the Vera scene-and-device model, a sentiment that seems to coincide with your approach. Do feel free to cannibalize any features or code from the Countdown Timer that help you.

Offline HSD99

  • Sr. Member
  • ****
  • Posts: 282
  • Karma: +11/-0
Re: Plugin: DelayLight
« Reply #19 on: May 15, 2018, 08:24:03 am »
Good work on the plugin, rigpapa.  This plugin will be of interest to anyone who has been using my old Countdown Timer plugin (which AFAIK still works on recent firmwares but which I'm not making any updates for). My plugin was designed to be the barest of barebones in adding timers to the Vera scene-and-device model, a sentiment that seems to coincide with your approach. Do feel free to cannibalize any features or code from the Countdown Timer that help you.
And thanks to you for Countdown Timer. It works on 1.7.3232---I use it to build digital filters for energy usage. Simple and works well.

Offline cc4005

  • Full Member
  • ***
  • Posts: 103
  • Karma: +6/-0
Re: Plugin: DelayLight
« Reply #20 on: May 16, 2018, 02:29:15 pm »
Is there a way to only activate the lights/load if it's night time.
Working on it

I thought I read a comment somewhere that you might implement a scheduling feature so a timer could be made active only during a fixed time period (perhaps in addition to a day/night switch?). Can't seem to find that discussion now, but I have several use cases where scheduling would be a very useful addition.

I've just started using DelayLight and already have 13 timers configured. Thank you for a great utility!

Offline cc4005

  • Full Member
  • ***
  • Posts: 103
  • Karma: +6/-0
Re: Plugin: DelayLight
« Reply #21 on: May 16, 2018, 02:36:21 pm »
One additional question. Your GitHub description explains that an Automatic Off Delay of zero means no automatic timing. Is this also true for Manual Off Delay? This would be useful for me in a couple cases.

Offline cc4005

  • Full Member
  • ***
  • Posts: 103
  • Karma: +6/-0
Re: Plugin: DelayLight
« Reply #22 on: May 16, 2018, 02:49:06 pm »
Just tried to make a donation ("tip") on makersupport.com but it won't seem to take funding right now. Happy to contribute if you have another means.

Offline HSD99

  • Sr. Member
  • ****
  • Posts: 282
  • Karma: +11/-0
Re: Plugin: DelayLight
« Reply #23 on: May 16, 2018, 03:24:00 pm »
Just tried to make a donation ("tip") on makersupport.com but it won't seem to take funding right now. Happy to contribute if you have another means.
Same here. I'd also be happy to contribute if you have another way.

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 671
  • Karma: +101/-1
Re: Plugin: DelayLight
« Reply #24 on: May 16, 2018, 05:16:03 pm »
One additional question. Your GitHub description explains that an Automatic Off Delay of zero means no automatic timing. Is this also true for Manual Off Delay? This would be useful for me in a couple cases.

Not currently, but I'll add it. I'm planning on pushing a maintenance release up this weekend.

Quote
Just tried to make a donation ("tip") on makersupport.com but it won't seem to take funding right now. Happy to contribute if you have another means.

Yeah, not sure what's up there. I've contacted makersupport.com. Let's see if they come back with something quickly.
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 pukka

  • Sr. Newbie
  • *
  • Posts: 26
  • Karma: +1/-0
Re: Plugin: DelayLight
« Reply #25 on: May 18, 2018, 01:18:54 pm »
Hi,

I am enjoying you plugin :) I have 2 basic jobs and i cannot work out the best way to solve, just wondering if you can help or point me in the right direction.

1.
door opened - turn on light
door closed - turn off light after 2 min unless door is reopened.


2.
I have 2 doors that trigger a flood light in the garden, so if night and ether door is opened turn on the flood light, turn off the flood light when both doors are closed and 2 min has passed, if ether door is reopened leave the light on.


I know they are very basic things, I have been sat here for a few days scratching my head.

Paul

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 671
  • Karma: +101/-1
Re: Plugin: DelayLight
« Reply #26 on: May 18, 2018, 02:21:59 pm »
1.
door opened - turn on light
door closed - turn off light after 2 min unless door is reopened.

Set the door sensor as the trigger device, and the light on both the on- and off-lists. Set an Auto-off delay time of 120 (seconds). Set Hold-Over to "Wait until all triggered sensors have reset".

Quote
2.
I have 2 doors that trigger a flood light in the garden, so if night and ether door is opened turn on the flood light, turn off the flood light when both doors are closed and 2 min has passed, if ether door is reopened leave the light on.

Since DelayLight currently only supports a single trigger device and you have two doors you want to use as triggers, you will need to set up a scene to trigger DelayLight.
1. Click "Add a scene" in the scene list of the Vera dashboard;
2. In "Step 1. Select a Trigger", choose "Device" and set up your first door to trigger on open;
3. When that's done, click "Add another trigger" and set up your second door the same way;
4. Then click "Next Step" to choose the controlled devices, and choose (only) the DelayLight timer;
5. For the scene device settings, make sure the "Auto" button is highlighted green and the "Reset" button is NOT (you may need to click the buttons more than once);
6. Click "Next Step" and then click the "No Luup Code defined" line/arrow
7. Enter the following scene Lua exactly as shown and save the code:
Code: [Select]
return luup.is_night()
8. Click on "Advanced editor" and make sure there is only a single line showing urn:toggledbits-com:serviceId:DelayLight1 Trigger. If there is a line for SetEnabled, or any other condition, use the "Delete" button to remove them. Then hit "Done".
9. Give your scene a name and room, and click the "Finish" button.

The Vera will reload when you finish the scene, so take a break for a minute or two.

Then, configure that DelayLight timer itself: Auto-off delay 120 seconds, no trigger (the scene will do the triggering externally), put your light in both the on- and off-lists, and switch Hold-Over to "Wait until all triggers have reset".

The only thing that won't work exactly as you describe is the off timing--the hold-over doesn't stop timing, it just stops the off cycle, so if the door (in either case) is open for five minutes (which is more than the two minute timing cycle), for example, the light will go off immediately when the door is closed. I will add an additional option to the Hold-Over function to extend the timing.
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 pukka

  • Sr. Newbie
  • *
  • Posts: 26
  • Karma: +1/-0
Re: Plugin: DelayLight
« Reply #27 on: May 18, 2018, 04:41:46 pm »
Hi Patrick

Thank you so much for a detailed how to.  :D

I have one more strange request.

Sunset only
door1 opened light 1 and 2 come on
door 2 opened light 1 and 2 come on light 3 on (between sunset and 9pm)

once both doors are closed lights 123 off after 120 seconds

I did sort of make this work with PLEG but never understood how it work, just kept trying until it worked. (broke when the clocks changed in the UK)

Do i just need to create your scene and then an extra scene for light 3 and then on the DelayLight just add light 3 to the off

Paul


_________________________________________________________________________________________________________________________________________________
Just incase anyone else see's this, I just created another scene, trigger door2, turn on light 3, with Luup

local pStart = 0         -- Start of time period, minutes offset from sunset
local pEnd = "21:00"     -- End of time period
local allow = true       -- true runs scene during period, false blocks it
local mStart = math.floor( (luup.sunset() % 86400) / 60 ) + pStart
local hE, mE = string.match(pEnd,"(%d+)%:(%d+)")
local mEnd = (hE * 60) + mE
local tNow = os.date("*t")
local mNow = (tNow.hour * 60) + tNow.min
if mEnd >= mStart then
     return (((mNow >= mStart) and (mNow <= mEnd)) == allow)
else
     return (((mNow >= mStart) or (mNow <= mEnd)) == allow)
end
« Last Edit: May 28, 2018, 07:09:07 am by pukka »

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 671
  • Karma: +101/-1
Re: Plugin: DelayLight
« Reply #28 on: May 19, 2018, 09:56:52 am »
Sunset only
door1 opened light 1 and 2 come on
door 2 opened light 1 and 2 come on light 3 on (between sunset and 9pm)

This is probably into PLEG's territory.
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 pukka

  • Sr. Newbie
  • *
  • Posts: 26
  • Karma: +1/-0
Re: Plugin: DelayLight
« Reply #29 on: May 19, 2018, 10:19:55 am »
I have had it running in pleg, but dont really understand pleg.....

Will have a think and a test.