We have moved at community.getvera.com

Author Topic: Plugin: DelayLight  (Read 12498 times)

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Plugin: DelayLight
« Reply #105 on: January 18, 2019, 02:09:18 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?

OK. I've poking at this a bit.

If Vera was following UPnP, I would be able to set LoadLevelTarget in the Dimming1 service and have the light restore to that value if switched on with SwitchPower1. But that doesn't work. As we know, doing the SetLoadLevelTarget action on Vera turns the light on, so that's a no-go already. I tried LoadLevelStatus also, knowing it wouldn't work but just trying, and sure enough, doesn't work.

Vera has mysteriously added a LoadLevelLast variable to the Dimming1 service, which they just kludged in apparently without (a) actually adding it to the Dimming1 service definition, or better yet, not mucking with a standard UPnP service definition and putting it in a service of their own, or (b) actually just using LoadLevelTarget for the exact same purpose, which would make more sense and be more consistent with UPnP. But I can set LoadLevelLast to a value, and if I follow that with a SetTarget action (SwitchPower1 service; not the SetLoadLevelTarget action in the Dimming1 service) to turn the light on, it goes to dimming level last set LoadLevelLast.

I've also only tested this with two dimmer brands, since I currently only have two brands in my house, and while it works for both, behavior differences between brands have been noted in the past.

I'm pondering the wisdom of using an undocumented feature of Luup as a feature of DelayLight, and not warming up to the idea yet. I've pushed the envelope a bit with things in Reactor, but everything I've done there can be referenced to the wiki (using things that are mentioned by name but otherwise not described, for example). LoadLevelLast isn't even mentioned in the wiki anywhere that I could find--even if just mentioned, at least it would give me some comfort that it's an implementation decision by Vera that's likely to stick. This is also a variable that Luup manipulates internally, and the conditions under which, and timing of when that happens, is also uncertain and subject to change. And especially now that they are "rewriting" (or have rewritten) the Luup/Lua part, it seems likely that anything not documented may not be reproduced in upcoming firmware--it's very difficult to reproduce years worth of accumulated behavior into a rewritten subsystem in just a couple of months, so that fact alone gives me concern that a lot of documented things will change (and take months to resolve), let alone anything undocumented, which we may likely never see reproduced again.

So for the moment, I'm going to decline to add this as a feature of DelayLight, but I'll keep it open for future consideration. What I can recommend to you for now is that you go ahead and use this "feature", knowing it may stop working in future firmware, but at least it addresses the problem for you now. You can just set up a scene trigger on that light so that any time it's turned off, it runs scene Lua to set LoadLevelLast (service urn:upnp-org:serviceId:Dimming1) to the default you want.

Code: [Select]
luup.variable_set( "urn:upnp-org:serviceId:Dimming1", "LoadLevelLast", 100, dimmer_device_num )
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: 306
  • Karma: +15/-3
Re: Plugin: DelayLight
« Reply #106 on: January 18, 2019, 02:16:56 pm »
thanks, like everything with Vera nothing is just easy.  i had been mucking with a scene and LoadLevelStatus, but could not get it to work.  I will try with LoadLevelLast and see what happens.  Anyhoo, thanks for the consideration.

Offline sebby

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +15/-3
Re: Plugin: DelayLight
« Reply #107 on: January 18, 2019, 06:38:27 pm »
K, i added a variable_watch for LoadLevelStatus and set the LoadLeveLast to 100 when Status goes to 0, works like a charm for now, but we'll see when they pull the plug on that variable.  Thanks for looking into it.

Offline bruring

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +2/-0
  • Why not automate everything?
Re: Plugin: DelayLight
« Reply #108 on: February 15, 2019, 12:27:43 pm »
Just started using this great plugin, and I'm finding the same, Day/Night plugin is not visible in the drop-down selection for the inhibitors.
Is there a workaround for this yet?
I'm on version 1.8.

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
Trying to make my house smarter than myself since 2012.
Vera Lite & Vera Edge UI7, 15x Fibaro, 10x Aeotec, 6x Zwave.Me, 3x GreenWave, 3x TKBHome, 1x Y-CAM, 1x Netatmo, Logitech Harmony, Google Home. ESXi with pfSense, openLuup, AltUI, Grafana and Vera Concierge amongst others.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Plugin: DelayLight
« Reply #109 on: February 15, 2019, 04:02:00 pm »
Just started using this great plugin, and I'm finding the same, Day/Night plugin is not visible in the drop-down selection for the inhibitors.
Is there a workaround for this yet?
I'm on version 1.8.

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

The Day/Night plugin implements its own device type, which is neither a binary switch nor a sensor (and therefore will not be listed as an inhibitor). So, you'll need to have a virtual sensor or virtual switch track the state of that plugin. You can then use the virtual device as an inhibitor.
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 bruring

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +2/-0
  • Why not automate everything?
Re: Plugin: DelayLight
« Reply #110 on: February 18, 2019, 11:14:35 am »
Just started using this great plugin, and I'm finding the same, Day/Night plugin is not visible in the drop-down selection for the inhibitors.
Is there a workaround for this yet?
I'm on version 1.8.

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

The Day/Night plugin implements its own device type, which is neither a binary switch nor a sensor (and therefore will not be listed as an inhibitor). So, you'll need to have a virtual sensor or virtual switch track the state of that plugin. You can then use the virtual device as an inhibitor.

I installed the binary switch plugin and that did it! Thank you.
Trying to make my house smarter than myself since 2012.
Vera Lite & Vera Edge UI7, 15x Fibaro, 10x Aeotec, 6x Zwave.Me, 3x GreenWave, 3x TKBHome, 1x Y-CAM, 1x Netatmo, Logitech Harmony, Google Home. ESXi with pfSense, openLuup, AltUI, Grafana and Vera Concierge amongst others.

Offline mzpost

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +2/-1
Re: Plugin: DelayLight
« Reply #111 on: March 22, 2019, 06:25:37 pm »
Just come across this, agree this will be great instead of using pleg as its a high use case.  Looking forward to getting stuck into using this.

It looks like you can only set an active period between times, it would be great to be able to set the time based on X mins after sunset (or sunrise).  I'm looking to use this to only trigger lights when its dark and that changes each day (it might be I've missed something in the settings that would enable that).

Great work.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Plugin: DelayLight
« Reply #112 on: March 22, 2019, 07:02:34 pm »
Just come across this, agree this will be great instead of using pleg as its a high use case.  Looking forward to getting stuck into using this.

It looks like you can only set an active period between times, it would be great to be able to set the time based on X mins after sunset (or sunrise).  I'm looking to use this to only trigger lights when its dark and that changes each day (it might be I've missed something in the settings that would enable that).

Great work.

Requests like this are exactly how Reactor came to be.
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 mzpost

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +2/-1
Re: Plugin: DelayLight
« Reply #113 on: March 23, 2019, 09:48:14 am »
Haha Ok thanks, so now I'm downloading reactor.

The delaylight plug in is excellent by the way, really good work.  I'll be supporting your devevelopment.

Offline opel-oleg

  • Sr. Newbie
  • *
  • Posts: 26
  • Karma: +2/-2
Re: Plugin: DelayLight
« Reply #114 on: March 23, 2019, 11:43:22 am »
I noticed that during the operation of the plug-in there are moments when not a single light bulb is on for a long time.
It would not be bad to be able to choose one constantly burning lamp.
Or did I overlook something? 8)

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Plugin: DelayLight
« Reply #115 on: March 23, 2019, 02:20:44 pm »
I noticed that during the operation of the plug-in there are moments when not a single light bulb is on for a long time.
It would not be bad to be able to choose one constantly burning lamp.
Or did I overlook something? 8)

Are you referring to DelayLight or DeusExMachinaII here? Sounds a bit like maybe the latter...? Or am I just short on clue today...?
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 opel-oleg

  • Sr. Newbie
  • *
  • Posts: 26
  • Karma: +2/-2
Re: Plugin: DelayLight
« Reply #116 on: March 23, 2019, 03:11:10 pm »
Are you referring to DelayLight or DeusExMachinaII here?

Oops))) I saw the word familiar.
The light flashed in the window.))) Of course DeusExMachinaII
Sorry for not sending you there.


Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Plugin: DelayLight
« Reply #117 on: March 23, 2019, 03:56:02 pm »
Are you referring to DelayLight or DeusExMachinaII here?

Oops))) I saw the word familiar.
The light flashed in the window.))) Of course DeusExMachinaII
Sorry for not sending you there.

No problem. I'll reply briefly here, and if there's anything more, let's take it over here.

I've also noticed this, but haven't acted on it yet. I've added Github issue #32 for this. I was working on Deus earlier this week. I don't think I'm ready to release yet, but I'll make sure this is addressed before I do.
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.