Author Topic: Plugin: DelayLight  (Read 3230 times)

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 462
  • Karma: +65/-0
Re: Plugin: DelayLight
« Reply #45 on: June 26, 2018, 08:49:34 am »
I tried to upload the Lua file on my Vera Plus (production) and Vera 3 (dev/testing) and no issues.

There's no way that file could be too large (the limit is likely several megabytes). The file should be 1582 lines, and just short of 68,000 bytes (67949). Make sure your file size makes sense.
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, 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 #46 on: June 26, 2018, 09:46:46 am »
I have managed to fix the upload, i used WINSCP deleted the file waited 5 min then upload the file via the browser and it looks like it uploaded ok,

will report back..

Paul

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 462
  • Karma: +65/-0
Re: Plugin: DelayLight
« Reply #47 on: June 26, 2018, 10:09:06 am »
OK. If you uploaded using WinSCP, there's probably now a compressed version of the file, and an uncompressed. The former (compressed) is the one installed by the install process or made by the Vera uploader (it also compresses them). The uncompressed file is your WinSCP product. You need to remove the compressed file (L_DelayLight.lua.lzo) so that the uncompressed file is used; otherwise, Vera may/will prefer the compressed to the uncompressed, and again you will see no change. You should be able to see both files listed in Apps > Develop apps > Luup files, and you should be able to delete the LZO version from there as well.
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline cybrmage

  • Hero Member
  • *****
  • Posts: 1098
  • Karma: +110/-40
Re: Plugin: DelayLight
« Reply #48 on: June 26, 2018, 11:53:24 am »
There's no way that file could be too large (the limit is likely several megabytes).

Just for future reference... The upload file size limit is 512K.

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 462
  • Karma: +65/-0
Re: Plugin: DelayLight
« Reply #49 on: June 26, 2018, 04:57:21 pm »
Just for future reference... The upload file size limit is 512K.

Good to know. Hopefully I'll never write a plugin that large!  ;D
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, 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 #50 on: June 30, 2018, 12:05:32 am »
After fixing the upload problem. the timer is now working.

Paul

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 462
  • Karma: +65/-0
Re: Plugin: DelayLight
« Reply #51 on: June 30, 2018, 12:52:42 pm »
Good to hear. I'll release that officially as 1.4 tomorrow (available in Vera Plugin Marketplace on Monday). That release will also have improvements in the status messages to make it more clear what is happening when a hold is in effect.
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 462
  • Karma: +65/-0
Re: Plugin: DelayLight
« Reply #52 on: July 02, 2018, 09:38:15 am »
Good to hear. I'll release that officially as 1.4 tomorrow (available in Vera Plugin Marketplace on Monday). That release will also have improvements in the status messages to make it more clear what is happening when a hold is in effect.

OK. That's released and available in the Vera Plugin Marketplace and AltAppStore.
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline jarrodirwin

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Plugin: DelayLight
« Reply #53 on: July 10, 2018, 08:29:58 pm »
Hey, first off I'd like to say this is a great plugin.

One request (if I may) would be to treat an ON device dimming change the same as a status (on/off) change so it would also trigger the manual countdown.

Example and scenario:
My timer is as follows:
TRIGGER: Living room motion detector between 9:30pm - 7:30am
ON devices:
Kitchen lights - On - 75%
Living room lights On - 75%
OFF devices:
A scene that checks if the TV is on and either sets
Kitchen lights - Off
Living rooms lights - On - 30%
**OR**
Kitchen lights - Off
Living room lights - Off

Scenarios:
1.) If timer is active, I'm watching TV (so kitchen lights off, living room lights are at 30%), turning the kitchen lights on should trigger the manual countdown timer = Success - Kitchen lights turn on (at 75%), manual timer starts. There looks to be a bug here tho as this also causes my living room lights to increase from 30% to the set 75%. You said other ON devices shouldn't be affected when one if manually triggered right? Or is this the desired behavior?

2.) If timer is active, I'm watching TV (so kitchen lights off, living room lights are at 30%), turning the living room lights up to 75% (or anything other then current setting) on should(?) trigger the manual countdown timer = Failed - Change of dimming setting on an ON device doesn't trigger manual timer, nothing happens.

I'm somewhat pushing the limits of what this should do by using a scene to set specific off settings but the request of a dimming change to be treated as a manual trigger could be useful for more standard use cases also.

Thoughts?

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 462
  • Karma: +65/-0
Re: Plugin: DelayLight
« Reply #54 on: July 10, 2018, 08:44:31 pm »
How is your "off" scene implemented. Lua?
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline jarrodirwin

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Plugin: DelayLight
« Reply #55 on: July 11, 2018, 06:44:42 am »
How is your "off" scene implemented. Lua?

Yeah - just straight Lua in a manually triggered scene.

That shouldn't matter to the triggering of the manual timer though as the ON devices are added as actual devices directly on the timer... right?

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 462
  • Karma: +65/-0
Re: Plugin: DelayLight
« Reply #56 on: July 11, 2018, 10:36:40 am »
How is your "off" scene implemented. Lua?

Yeah - just straight Lua in a manually triggered scene.

That shouldn't matter to the triggering of the manual timer though as the ON devices are added as actual devices directly on the timer... right?

That's absolutely right, but had to ask to be sure. DelayLight actually examines the scene actions to try to determine what devices may be affected, and try to do the right thing, but if control is in scene Lua, it cannot do that. But, as you correctly surmise, if the devices in the scene are also listed as "on" devices, it sees them that way, so should not be a problem for you.

Quote
[[living room lights previously on manual at 30%...]] turning the living room lights up to 75% (or anything other then current setting) on should(?) trigger the manual countdown timer = Failed

Agreed. This is a case not yet handled, but I've opened that as issue #9 in the Github repo. I'm going to try to address this before I go on vacation this weekend, but a full release is too risky, so I will just push it to the stable branch, and you can install the update from there. Stay tuned.

That said, though... once a timing mode starts, it is not overriden. So, if automatic timing (from motion sensing in your case) turns on the lights, turning other lights on or off (or changing their dimming level once I fix that) would not change the mode from AUTO to MANUAL as currently implemented. This is done for two reasons: first, if a user starts the timer in MANUAL mode by operating a light directly, a later trip of an automatic trigger device will not switch the timing mode from MANUAL to AUTO, which would reduce the time interval (typically) and leave the user in the dark earlier than they expected/in a switch war with the motion sensor; and second, if starting with an automatic trigger (so in AUTO mode), loads are already on and thus the only possible state change (currently/in 1.4) is to off, and that probably should not imply a switch to MANUAL. But, if we start paying attention to dimming changes, there's a good case to be made for a dimming change to force a change from AUTO to MANUAL. I want to consider the impact of this more, but I'm inclined to implement it as an option.

Quote
turning the kitchen lights on should trigger the manual countdown timer = Success - Kitchen lights turn on (at 75%), manual timer starts. There looks to be a bug here tho as this also causes my living room lights to increase from 30% to the set 75%. You said other ON devices shouldn't be affected when one if manually triggered right? Or is this the desired behavior?

No, this is the expected behavior--when any "on" device is turned on, all the "on" list devices are set to their prescribed state. But, I can add an option for this; it seems like a desirable alternative to the current default behavior.

Stay tuned. I'll get something up on stable for you later today if all goes according to plan.
« Last Edit: July 11, 2018, 12:20:04 pm by rigpapa »
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline rigpapa

  • Sr. Member
  • ****
  • Posts: 462
  • Karma: +65/-0
Re: Plugin: DelayLight
« Reply #57 on: July 11, 2018, 01:33:45 pm »
Stay tuned. I'll get something up on stable for you later today if all goes according to plan.

@jarrodirwin The stable branch on Github now contains the following changes for your case:
  • Changing the dimming level of a light that is already on is detected as a manual change (issue #9);
  • The ManualOnScene state variable (flag/boolean, default 1) has been added to control whether a manual trigger by a single device sets all "on" list devices to their configured states (the current behavior and default), or if the "on" devices should be left alone (set ManualOnScene=0). There is no UI for this option yet, so you have to change it by hand in Advanced > Variables (issue #11).

To update, just download the L_DelayLight.lua file from the Github stable branch, and upload it using Apps > Develop apps > Luup files. If you are using ALTUI and the AltAppStore, you can update via reinstall by choosing the "Github.stable" version and clicking the "Alt" install button.
Author of Rachio, Deus Ex Machina II, Intesis WMP Gateway, SiteSensor, DelayLight, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline jarrodirwin

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Plugin: DelayLight
« Reply #58 on: July 11, 2018, 05:23:36 pm »
Stay tuned. I'll get something up on stable for you later today if all goes according to plan.

@jarrodirwin The stable branch on Github now contains the following changes for your case:
  • Changing the dimming level of a light that is already on is detected as a manual change (issue #9);
  • The ManualOnScene state variable (flag/boolean, default 1) has been added to control whether a manual trigger by a single device sets all "on" list devices to their configured states (the current behavior and default), or if the "on" devices should be left alone (set ManualOnScene=0). There is no UI for this option yet, so you have to change it by hand in Advanced > Variables (issue #11).

To update, just download the L_DelayLight.lua file from the Github stable branch, and upload it using Apps > Develop apps > Luup files. If you are using ALTUI and the AltAppStore, you can update via reinstall by choosing the "Github.stable" version and clicking the "Alt" install button.

Woah thanks rigpapa! That was a really quick turnaround.

100% agree with your opinions in your last 2 posts.

I'll install these changes and give it a whirl tonight and let you know how I get on in a real world test. Everything on paper makes perfect sense though.

Offline jarrodirwin

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Plugin: DelayLight
« Reply #59 on: July 12, 2018, 07:00:35 am »
Stay tuned. I'll get something up on stable for you later today if all goes according to plan.

@jarrodirwin The stable branch on Github now contains the following changes for your case:
  • Changing the dimming level of a light that is already on is detected as a manual change (issue #9);
  • The ManualOnScene state variable (flag/boolean, default 1) has been added to control whether a manual trigger by a single device sets all "on" list devices to their configured states (the current behavior and default), or if the "on" devices should be left alone (set ManualOnScene=0). There is no UI for this option yet, so you have to change it by hand in Advanced > Variables (issue #11).

To update, just download the L_DelayLight.lua file from the Github stable branch, and upload it using Apps > Develop apps > Luup files. If you are using ALTUI and the AltAppStore, you can update via reinstall by choosing the "Github.stable" version and clicking the "Alt" install button.

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

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? Although I'm running v1.4 and only copied the new .lua file so haven't got any of the newer UI enhancements to enable/disable this if created.

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.

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).
« Last Edit: July 12, 2018, 07:04:57 am by jarrodirwin »