Assistance with Wake Up Light

Hi,

I am trying to create the following scenes:

  1. Create scene 1 that can be run the night before to ramp up bedroom lights at 7am
  2. Create scene 2 that can be run the night before to ramp up the bedroom lights at 8am

I only want these to be run during weekdays, and if I select scene 1 I don’t want scene 2 to run (obviously) and vice versa. I alternate the time I get up depending on whether I need to be in the office or not and ideally I would set each days scene the night before.

Struggling to configure this. I have played with the timer in Wake Up Light (I can’t get this to work) and also schedules within a scene. Just can’t get it to work.

Any help greatly received.

I am not sure I follow you a 100% but if I understand you correctly, you want a 2 scenes that turns on your lights only on weekdays (one for 7am and for for 8am). You will specify which scene to run the night before. If this is correct, create 1 scene that turns on your lights. Then go to the schedule tab for the scene and create 2 schedules to activate the scene (one for weekdays at 7am and one for weekdays at 8am). The night before, enable which schedule you want to be active (7am or 8am).

I would suggest using a PLEG device to create your scenes. Then, setup a virtual switch whose state means 7am or 8am. PLEG could use virtual switch state (On = 7am, Off = 8am) and a schedule to determine which setting to use for the wake up light.

More info on PLEG here:
http://forum.micasaverde.com/index.php/board,48.0.html

Yes, this is correct. My issue is that if I create a scedule for each scene (eg scene 1 - Mon - Fri 7am, scene 2 - Mon - Fri 8am), will it not run everyday? So if I run scene 1 on Sunday night and scene 2 on Monday night, I will end up with the wake up lights coming on twice a day for the rest of the week? How do you cancel the first scene if the second scene is activated? Or vice versa?

Cheers!!

[quote=“huveu, post:3, topic:175494”]I would suggest using a PLEG device to create your scenes. Then, setup a virtual switch whose state means 7am or 8am. PLEG could use virtual switch state (On = 7am, Off = 8am) and a schedule to determine which setting to use for the wake up light.

More info on PLEG here:
http://forum.micasaverde.com/index.php/board,48.0.html[/quote]

I think I follow your logic but have had trouble getting PLEG to work. I can install a PLEG device but when I go into advanced settings etc it sits there waiting without actually doing anything, even after a restart.

Any ideas please?
Many thanks,
Rich

Following your original “two scenes” theme, the setup could be like this:
Set both to turn the light on, and create one Virtual Switch called, say “Wake Up Early” (ON for early, OFF for normal):

Scene 1: has schedule set up for weekdays at 7 am, and Luup code return VSwitch.get("Wake Up Early") == "1"

Scene 2: has schedule set up for weekdays at 8 am, and Luup code return VSwitch.get("Wake Up Early") == "0"

Either scene is aborted if the switch isn’t set to its matching value.
Set the switch to the value you want any time before the wake-up call - you can even change your mind.

Code for Vswitch installed in [tt]Startup Lua[/tt] per this post:
[url=http://forum.micasaverde.com/index.php/topic,14896.msg113156.html#msg113156]http://forum.micasaverde.com/index.php/topic,14896.msg113156.html#msg113156[/url]

Instructions to put code into [tt]Startup Lua[/tt] here, if needed:
[url=http://forum.micasaverde.com/index.php/topic,14936.msg113493.html#msg113493]http://forum.micasaverde.com/index.php/topic,14936.msg113493.html#msg113493[/url]

Just one of many ways - PLEG being another approach.

[quote=“richgodfrey, post:5, topic:175494”][quote=“huveu, post:3, topic:175494”]I would suggest using a PLEG device to create your scenes. Then, setup a virtual switch whose state means 7am or 8am. PLEG could use virtual switch state (On = 7am, Off = 8am) and a schedule to determine which setting to use for the wake up light.

More info on PLEG here:
http://forum.micasaverde.com/index.php/board,48.0.html[/quote]

I think I follow your logic but have had trouble getting PLEG to work. I can install a PLEG device but when I go into advanced settings etc it sits there waiting without actually doing anything, even after a restart.

Any ideas please?
Many thanks,
Rich[/quote]

Please post more details on the issues you are having with PLEG here, or in its own sub forum. Screenshots might help too. I’m sure a few people will try to help identify the issue. I’ve had my veralite for less than a week. Also had some issues with PLEG at the beginning, but they were mostly with some triggers and actions hanging around after being deleted.

Huveu/Akboeer,

Will test tomorrow and reply back to both. Appreciate the assistance!!

Cheers,
Rich

[quote=“akbooer, post:6, topic:175494”]Following your original “two scenes” theme, the setup could be like this:
Set both to turn the light on, and create one Virtual Switch called, say “Wake Up Early” (ON for early, OFF for normal):

Scene 1: has schedule set up for weekdays at 7 am, and Luup code return VSwitch.get("Wake Up Early") == "1"

Scene 2: has schedule set up for weekdays at 8 am, and Luup code return VSwitch.get("Wake Up Early") == "0"

Either scene is aborted if the switch isn’t set to its matching value.
Set the switch to the value you want any time before the wake-up call - you can even change your mind.

Code for Vswitch installed in [tt]Startup Lua[/tt] per this post:
[url=http://forum.micasaverde.com/index.php/topic,14896.msg113156.html#msg113156]http://forum.micasaverde.com/index.php/topic,14896.msg113156.html#msg113156[/url]

Instructions to put code into [tt]Startup Lua[/tt] here, if needed:
[url=http://forum.micasaverde.com/index.php/topic,14936.msg113493.html#msg113493]http://forum.micasaverde.com/index.php/topic,14936.msg113493.html#msg113493[/url]

Just one of many ways - PLEG being another approach.[/quote]

This works perfectly, many thanks for the info.

Quick question, what is the best way to bypass both scenes for when my missus is on half term for example?

Perhaps another Virtual Switch “Alarm On/Off”?

Scene 1:

return (VSwitch.get("Alarm On/Off") == "1") and (VSwitch.get("Wake Up Early") == "1")

Scene 2:

return (VSwitch.get("Alarm On/Off") == "1") and (VSwitch.get("Wake Up Early") == "0")

Worth learning a bit more about Lua and Luup programming if you need further sophistication!

Perhaps another Virtual Switch “Alarm On/Off”?

Scene 1:

return (VSwitch.get("Alarm On/Off") == "1") and (VSwitch.get("Wake Up Early") == "1")

Scene 2:

return (VSwitch.get("Alarm On/Off") == "1") and (VSwitch.get("Wake Up Early") == "0")

Worth learning a bit more about Lua and Luup programming if you need further sophistication![/quote]

I did some reading on the previous example and this one, starting to get my head round it slowly but never really programmed before. However, I now understand the logic of this and will set this up.

I’m also using Tasker on Android (which controls the audio alarm on my phone) so that I can click a home screen widget which will enable the lights to come on at the right alarm time and also do the audio alarm at the same time. Can provide Tasker instructions if anyone is interested.

Pretty much there now and will set this up tomorrow. Many many thanks for your help.

Can I double check the scripting for this? I have enabled a virtual switch to switch between 7am and 8.30am (using separate schedules) and a secondary vswitch to toggle alarm on and off. I have implemented the script above in the two scenes and whatever option I select the lights come on at both 7am and 8.30am. Even if I set the vswitch alarm manually to off, the lights still come on.

Could it be that the schedules within the scenes are overriding the LUUP code?

Many thanks.

I had the same issue and it drove me crazy enough to read the source code. It turns out the I_WakeUpLight.xml file needs to be edited to support virtual switches.

Find the line that has:
local SWT_SID = “urn:upnp-org:serviceId:SwitchPower1”
and change it to:
local SWT_SID = “urn:upnp-org:serviceId:VSwitch1”

After that virtual switches will actually work as inhibiting devices.

[quote=“ChrisAZ, post:13, topic:175494”]I had the same issue and it drove me crazy enough to read the source code. It turns out the I_WakeUpLight.xml file needs to be edited to support virtual switches.

Find the line that has:
local SWT_SID = “urn:upnp-org:serviceId:SwitchPower1”
and change it to:
local SWT_SID = “urn:upnp-org:serviceId:VSwitch1”

After that virtual switches will actually work as inhibiting devices.[/quote]

Have looked for some guidance about how to edit the XML files but can’t seem to find anything. How do you do this?

OK, found the XML and happy to edit. How do you upload back to the Vera?

OK, the answer was staring me in the face. LOL.

Many thanks for everyones input - really appreciated!!!

Cheers.
Many thanks.

The 7am and 8.30am scenes are still firing when the Alarmonoff virtual switch is set to off. So it seems the Wakeuplight plugin is still firing based on the schedules and ignoring the Alarmonoff switch. Any other ideas please? Does the XML file amendment need to be changed to the virtual switch name? IE not vswitch1 but Alarmonoff which is what I named it?

Will test now anyway.

No, definitely not. The string you have edited is a ‘seviceId’. Be aware that everything is case sensitive. I note you wrote “vswitch1” above, and not “VSwitch1”… Did you do that in the code?

Can you post exactly what you have?

OK, here is my exact configuration

Wakeuplight plugin
Set to turn on bedroom light and lamp on over ten minutes
This works as expected

Virtual Switch - “Wakeup”
This is to flip between the two alarm times - 7.00am and 8.30am

Virtual Switch - “AlarmOnOff”
Used to turn alarm on and off

Scene “Set vswitch WFH”
Sets Virtual Switch “Wakeup” to off

Scene “Set vswitch Workday”
Sets Virtual Switch “Wakeup” to on

Scene “07:00 WUL”
Tells wake up light plugin to wake up
Schedule set to 07:00
Luup code: return (VSwitch.get(“AlarmOnOff”) == “1”) and (VSwitch.get(“Wakeup”) == “1”)

Scene “08:30 WUL”
Tells wake up light plugin to wake up
Schedule set to 08:30
Luup code: return (VSwitch.get(“AlarmOnOff”) == “1”) and (VSwitch.get(“Wakeup”) == “0”)

Lights start waking up at both times regardless of whether AlarmOnOff switch is on or off.

Can’t stress enough how much I appreciate everybody’s assistance!!

Cheers,
Rich

No, definitely not. The string you have edited is a ‘seviceId’. Be aware that everything is case sensitive. I note you wrote “vswitch1” above, and not “VSwitch1”… Did you do that in the code?

Can you post exactly what you have?[/quote]

It is definitely Vswitch1 in the xml file.

Do the scenes work as expected if you make them trigger a regular light rather than the wakeup light device?

Will test now. Remove the WakeUpLight from the equation and if it works as expected I guess its a problem with WakeUpLight?