Author Topic: Plugin: DelayLight  (Read 11113 times)

Online PrincessCleavage

  • Sr. Member
  • ****
  • Posts: 348
  • Karma: +6/-1
Re: Plugin: DelayLight
« Reply #90 on: October 01, 2018, 04:00:43 am »
Active Period
Would it be possible to add an option to active period to select another service e.g in active period I would have a drop down selection and I would select day night plugging and value =1 ( or night). So then I let the plugin adjust timings for winter/ summer sunset variables rather than having to manually modify each cycle

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1051
  • Karma: +170/-1
Re: Plugin: DelayLight
« Reply #91 on: October 01, 2018, 09:14:32 am »
Active Period
Would it be possible to add an option to active period to select another service e.g in active period I would have a drop down selection and I would select day night plugging and value =1 ( or night). So then I let the plugin adjust timings for winter/ summer sunset variables rather than having to manually modify each cycle

Reactor was born, in part, because of the increasing demand for tests for triggers and inhibitors in DelayLight.

That said, you don't need Reactor for this scenario; what's in DelayLight already will probably suffice. As an example, let's say you want your DelayLight timer to be active from sunset to 11pm (23:00). To do that, you would first create an "active period" with a start time well before sunset ever occurs at any time of year, and an end time of 23:00 (e.g. active period is 18:00 to 23:00). Then, you make the Day/Night plugin an inhibitor (you may need to check the "invert" box to get the right test--I don't remember if Day/Night is tripped during the day, or tripped at night). The effect of the active period and inhibitor is cumulative--DelayLight will only attempt auto timing during the active period (18:00 to 23:00), but the inhibitor will keep it from timing even during the active period if it's not yet nighttime (after sunset).
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, Lite. Hassio, Slapdash.

Online PrincessCleavage

  • Sr. Member
  • ****
  • Posts: 348
  • Karma: +6/-1
Re: Plugin: DelayLight
« Reply #92 on: October 01, 2018, 09:17:05 am »
Rgr,
Thanks Rippa

Online PrincessCleavage

  • Sr. Member
  • ****
  • Posts: 348
  • Karma: +6/-1
Re: Plugin: DelayLight
« Reply #93 on: October 01, 2018, 09:24:19 am »
Active Period
Would it be possible to add an option to active period to select another service e.g in active period I would have a drop down selection and I would select day night plugging and value =1 ( or night). So then I let the plugin adjust timings for winter/ summer sunset variables rather than having to manually modify each cycle

Reactor was born, in part, because of the increasing demand for tests for triggers and inhibitors in DelayLight.

That said, you don't need Reactor for this scenario; what's in DelayLight already will probably suffice. As an example, let's say you want your DelayLight timer to be active from sunset to 11pm (23:00). To do that, you would first create an "active period" with a start time well before sunset ever occurs at any time of year, and an end time of 23:00 (e.g. active period is 18:00 to 23:00). Then, you make the Day/Night plugin an inhibitor (you may need to check the "invert" box to get the right test--I don't remember if Day/Night is tripped during the day, or tripped at night). The effect of the active period and inhibitor is cumulative--DelayLight will only attempt auto timing during the active period (18:00 to 23:00), but the inhibitor will keep it from timing even during the active period if it's not yet nighttime (after sunset).
Day/night does not list in the drop down as an option to select as an inhibitor

Offline sebby

  • Sr. Member
  • ****
  • Posts: 298
  • Karma: +15/-3
Re: Plugin: DelayLight
« Reply #94 on: October 01, 2018, 09:42:59 am »
Active Period
Would it be possible to add an option to active period to select another service e.g in active period I would have a drop down selection and I would select day night plugging and value =1 ( or night). So then I let the plugin adjust timings for winter/ summer sunset variables rather than having to manually modify each cycle

Reactor was born, in part, because of the increasing demand for tests for triggers and inhibitors in DelayLight.

That said, you don't need Reactor for this scenario; what's in DelayLight already will probably suffice. As an example, let's say you want your DelayLight timer to be active from sunset to 11pm (23:00). To do that, you would first create an "active period" with a start time well before sunset ever occurs at any time of year, and an end time of 23:00 (e.g. active period is 18:00 to 23:00). Then, you make the Day/Night plugin an inhibitor (you may need to check the "invert" box to get the right test--I don't remember if Day/Night is tripped during the day, or tripped at night). The effect of the active period and inhibitor is cumulative--DelayLight will only attempt auto timing during the active period (18:00 to 23:00), but the inhibitor will keep it from timing even during the active period if it's not yet nighttime (after sunset).

Rigpapa,
I  think that on the DelayLight Plugin, since a lot of these actions rely on sunset and sunrise (because that is when most lighting events will need to happen), it would be most helpful to add those triggers to the active period, much like you've done in the Reactor plugin with the Sunrise/Sunset condition.   This would avoid the need to load yet another plugin to our already overloaded Vera systems.  Just an opinion.  Keep up the great work!

Offline sebby

  • Sr. Member
  • ****
  • Posts: 298
  • Karma: +15/-3
Re: Plugin: DelayLight
« Reply #95 on: October 23, 2018, 09:15:14 am »
Rigpappa,
is there a way to synchronize 3 lights on 3 circuits with this plugin?  I've been racking my brain trying to figure this one out, but haven't been able to.  Here is my scenario:
I have lights at the top deck, middle deck, and floor level and they are all on independent circuits.  what i want is for all 3 circuits to come on when any one of them turns on (pretty easy with DelayLight), but what i am having an issue with is turning them off when any one of them is turned off.  When one light comes on, the others turn on as planed, but since now they all have power, turning one off does not turn the others off. 

No biggie if this is not the tool for that, i can code it in Lua if necessary, but just wanted to check

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1051
  • Karma: +170/-1
Re: Plugin: DelayLight
« Reply #96 on: October 23, 2018, 06:48:44 pm »
Rigpappa,
is there a way to synchronize 3 lights on 3 circuits with this plugin?  I've been racking my brain trying to figure this one out, but haven't been able to.  Here is my scenario:
I have lights at the top deck, middle deck, and floor level and they are all on independent circuits.  what i want is for all 3 circuits to come on when any one of them turns on (pretty easy with DelayLight), but what i am having an issue with is turning them off when any one of them is turned off.  When one light comes on, the others turn on as planed, but since now they all have power, turning one off does not turn the others off. 

No biggie if this is not the tool for that, i can code it in Lua if necessary, but just wanted to check

No, DelayLight is pretty hands off with manual off of controlled loads. It only reacts when all of the controlled loads are off, just resetting the timer to idle. Custom Lua or Reactor would be the way to go for your requirement.
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, Lite. Hassio, Slapdash.

Offline sebby

  • Sr. Member
  • ****
  • Posts: 298
  • Karma: +15/-3
Re: Plugin: DelayLight
« Reply #97 on: October 23, 2018, 06:57:15 pm »
Rigpappa,
is there a way to synchronize 3 lights on 3 circuits with this plugin?  I've been racking my brain trying to figure this one out, but haven't been able to.  Here is my scenario:
I have lights at the top deck, middle deck, and floor level and they are all on independent circuits.  what i want is for all 3 circuits to come on when any one of them turns on (pretty easy with DelayLight), but what i am having an issue with is turning them off when any one of them is turned off.  When one light comes on, the others turn on as planed, but since now they all have power, turning one off does not turn the others off. 

No biggie if this is not the tool for that, i can code it in Lua if necessary, but just wanted to check

No, DelayLight is pretty hands off with manual off of controlled loads. It only reacts when all of the controlled loads are off, just resetting the timer to idle. Custom Lua or Reactor would be the way to go for your requirement.

As always, thank you for the reply.  Really appreciate the work!

Offline tiaanv

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +2/-0
Dynamic Dim levels.
« Reply #98 on: November 04, 2018, 01:42:40 am »
Hi Patrick


Firstly I love you plugin. You did a great job designing it, and the interface is really the part I find most elegant.  I currently use a modified version of the Smartswitch plugin as my daily driver for managing automated lights.  Lost of the code in there was modified by myself.  I do quite a bit of setup these days for other people and find your plugin just to be much better to configure and maintain. It does almost everything I need to change over to DelayLight being my own daily driver.... almost.


The one feature I use quite extensively through the use of scenes, is the ability to set the smartswitches' dim levels.  The use case for this is quite simple.  during late nights, certain lights still react to triggers form sensors, but to be kind to late night eyes, they are dimmed quite low... 
I can think of a two of ways to achieve this with DelayLight, but none of them seem elegant:
  • Use duplicate duplicate timers. and only enable the right ones.  Messy clutter.
  • Set dim levels outside of Timers.  Most of my lights go full power when binary on is received, instead of last level. they are not actually z-wave... limitation of interface.
The fix on face value would be quite simple (expose an action on the timer that facilitates this), until you think about the one feature that really distinguishes DelayLight from SmartSwitch.  The ability to include multiple devices for ON/OFF control. The only idea I could think of is to have a "global" ON dim level, and OFF dim level as part of the plugin, and leave the individual nodes dim levels empty.  Then have an action that can set these variables. Not sure if this is elegant or practical.


So in conclusion.  If you have any ideas how to do this either with an elegant workaround, or code, let me know.  I am happy to tackle the code and design, and contribute to your Git Repo, but would not want to write anything that you don't' consider useful of appropriate.  I also don't like making my own branches, as that generally leaves me without future enhancements ;)


Regards
Tiaan
Vera Edge 1.7.961 - Follow me. I know exactly where I'm not going.
**CBUS Vera Interface plugin (creator),SmartSwitch (unofficial dev with permission)**

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1051
  • Karma: +170/-1
Re: Dynamic Dim levels.
« Reply #99 on: November 04, 2018, 08:36:09 am »
Hi Patrick


Firstly I love you plugin. You did a great job designing it, and the interface is really the part I find most elegant.  I currently use a modified version of the Smartswitch plugin as my daily driver for managing automated lights.  Lost of the code in there was modified by myself.  I do quite a bit of setup these days for other people and find your plugin just to be much better to configure and maintain. It does almost everything I need to change over to DelayLight being my own daily driver.... almost.


The one feature I use quite extensively through the use of scenes, is the ability to set the smartswitches' dim levels.  The use case for this is quite simple.  during late nights, certain lights still react to triggers form sensors, but to be kind to late night eyes, they are dimmed quite low... 
I can think of a two of ways to achieve this with DelayLight, but none of them seem elegant:
  • Use duplicate duplicate timers. and only enable the right ones.  Messy clutter.
  • Set dim levels outside of Timers.  Most of my lights go full power when binary on is received, instead of last level. they are not actually z-wave... limitation of interface.
The fix on face value would be quite simple (expose an action on the timer that facilitates this), until you think about the one feature that really distinguishes DelayLight from SmartSwitch.  The ability to include multiple devices for ON/OFF control. The only idea I could think of is to have a "global" ON dim level, and OFF dim level as part of the plugin, and leave the individual nodes dim levels empty.  Then have an action that can set these variables. Not sure if this is elegant or practical.


So in conclusion.  If you have any ideas how to do this either with an elegant workaround, or code, let me know.  I am happy to tackle the code and design, and contribute to your Git Repo, but would not want to write anything that you don't' consider useful of appropriate.  I also don't like making my own branches, as that generally leaves me without future enhancements ;)


Regards
Tiaan

If I understand correctly, your goal is to have different light levels for controlled loads at different times of day; a typical use case is full brightness during the day, reduced brightness at night. I do this myself in several bathrooms in my house--e.g. motion sensors turn on "main" lighting when motion is first detected, full bright during the day on two lights, and 30% on a single light at night. When no motion is detected for a period, all lights are extinguished.

I use an "on" scene with scene actions to set up the "daytime" scene: vanity lights and recessed fixtures set to 100% on. Then I add scene Lua code like this for the night exception:

Code: [Select]
if luup.is_night() then
    luup.call_action( "urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", { newLoadlevelTarget=30 }, 66 ) -- undercabinet LED strips
    return false
end
return true

So, if the night test in the Lua code fails, the scene Lua returns true, so Luup runs the scene actions normally. If the night test succeeds, the scene Lua directly sets just the toe-kick LEDs to 30%, and then returns false. The scene actions are not run by Luup when scene Lua returns false (so the vanity and ceiling lights are not turned on).

The second part of this is setting up the DelayLightTimer instance so that the "off list" contains all of the lights in the bathroom (shower, vanity, recessed, and WC--you don't need an "off" scene, just list the devices explicitly in DelayLight's config). This ensures that when the DelayLight timer expires, all lights in the room are turned off (including any additional lights turned on manually). In addition, the automatic and manual timing intervals should be set to the same value (I use 3600 = 1 hour).
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, Lite. Hassio, Slapdash.

Offline tiaanv

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +2/-0
Re: Dynamic Dim levels.
« Reply #100 on: November 05, 2018, 12:28:54 pm »
If I understand correctly, your goal is to have different light levels for controlled loads at different times of day; a typical use case is full brightness during the day, reduced brightness at night. I do this myself in several bathrooms in my house--e.g. motion sensors turn on "main" lighting when motion is first detected, full bright during the day on two lights, and 30% on a single light at night. When no motion is detected for a period, all lights are extinguished.

I use an "on" scene with scene actions to set up the "daytime" scene: vanity lights and recessed fixtures set to 100% on. Then I add scene Lua code like this for the night exception:

Code: [Select]
if luup.is_night() then
    luup.call_action( "urn:upnp-org:serviceId:Dimming1", "SetLoadLevelTarget", { newLoadlevelTarget=30 }, 66 ) -- undercabinet LED strips
    return false
end
return true

So, if the night test in the Lua code fails, the scene Lua returns true, so Luup runs the scene actions normally. If the night test succeeds, the scene Lua directly sets just the toe-kick LEDs to 30%, and then returns false. The scene actions are not run by Luup when scene Lua returns false (so the vanity and ceiling lights are not turned on).

The second part of this is setting up the DelayLightTimer instance so that the "off list" contains all of the lights in the bathroom (shower, vanity, recessed, and WC--you don't need an "off" scene, just list the devices explicitly in DelayLight's config). This ensures that when the DelayLight timer expires, all lights in the room are turned off (including any additional lights turned on manually). In addition, the automatic and manual timing intervals should be set to the same value (I use 3600 = 1 hour).


Thx Patrick


That could work, but it's going to require me to set up approximately 14 additional scenes.... and then maintain the "exceptions" in each of those... Not something I think will be an improvement on the current mechanics.  I appreciate the advice though!   I might tinker with your plugin code for my own use if you don't mind.


T
Vera Edge 1.7.961 - Follow me. I know exactly where I'm not going.
**CBUS Vera Interface plugin (creator),SmartSwitch (unofficial dev with permission)**

Offline Jamr

  • Hero Member
  • *****
  • Posts: 840
  • Karma: +29/-8
Re: Plugin: DelayLight
« Reply #101 on: December 12, 2018, 01:29:22 pm »
I use a small bit of code in my triggers for night only triggering.
 return luup.is_night() == true

It seems to work right as the sun is going down any time of the year with a vast time change on sunset.
Maybe the addition of this or similar codes for triggers would be a viable and efficient way to trigger when you want?

BTW, thanks for this add on as I do love it. I made a small donation today. Have a beer on me!

Offline sebby

  • Sr. Member
  • ****
  • Posts: 298
  • Karma: +15/-3
Re: Plugin: DelayLight
« Reply #102 on: January 17, 2019, 11:41:58 pm »
I'd love to be able to reset the load level for lights that are turned on/off by DelayLight.  for example, i have a bunch of lights that get turned on by motion sensors (depending on house mode and other conditions using your Reactor Plugin).  one of the conditions is that if it is after midnight, i typically dim them down a bunch so as not to blind the wife.  the problem is that when they get turned off by DelayLight, they dimmers remember their last setting. 

Could you add a LoadLevelStatus field for when lights are turned off?  maybe even just a checkbox that allows people to enter the load level in the existing box and if it is unchecked (by default), you do a SetLoadLevelTarget turning them on OR if unchecked, then you do a LoadLevelStatus that way they are reset for the next time?

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1051
  • Karma: +170/-1
Re: Plugin: DelayLight
« Reply #103 on: January 18, 2019, 08:36:56 am »
I'd love to be able to reset the load level for lights that are turned on/off by DelayLight.  for example, i have a bunch of lights that get turned on by motion sensors (depending on house mode and other conditions using your Reactor Plugin).  one of the conditions is that if it is after midnight, i typically dim them down a bunch so as not to blind the wife.  the problem is that when they get turned off by DelayLight, they dimmers remember their last setting. 

Could you add a LoadLevelStatus field for when lights are turned off?  maybe even just a checkbox that allows people to enter the load level in the existing box and if it is unchecked (by default), you do a SetLoadLevelTarget turning them on OR if unchecked, then you do a LoadLevelStatus that way they are reset for the next time?

DelayLight has a dim level field for the "off" list. Can you check the version number on the Settings tab (in the footer). You should be running 1.8. If so, am I missing some detail of the way you want it to work?
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, Lite. Hassio, Slapdash.

Offline sebby

  • Sr. Member
  • ****
  • Posts: 298
  • Karma: +15/-3
Re: Plugin: DelayLight
« Reply #104 on: January 18, 2019, 09:55:33 am »
DelayLight has a dim level field for the "off" list. Can you check the version number on the Settings tab (in the footer). You should be running 1.8. If so, am I missing some detail of the way you want it to work?

Yes, running 1.8.  The issue i have is that the dim level on the "off" list does a SetLoadLevelTarget call which turns ON the lights to that load level.  what i am trying to accomplish is to turn OFF the lights and return them to a brighter default load level (LoadLevelStatus) so the next time someone hits the switch they are not at the dim level that was used by delay light.