Plugin - Vacation Ghost (BETA)

Plugin has been unpublished by me. I don’t want to continue to work for such a company.

Description:
This plugin allows you to let lights be turned on and off automatically/randomly when you are in vacation or absent. It allows you to define in how many times in which phase it should turn on lights and how long they are supposed to be running on which level. Based on variables you define the plugin does all the calculations itself. These ghost a generated newly in every phase, so on each day the times when a light turns on and how long it stays on will vary.

As for the moment one plugin device is capable of controlling up to eight lights. But since you can create further devices the number of controlled lights is basically unlimited.

Tab “Lights & Times” => Settings/Variables:
LightID: Defines which light is controlled by the ghost.
Start: Defines when the on phase starts.
Stop: Defines when the on phase ends.
Cycles: Defines how many times a light will be turned on and off.
OnTime: Defines how long a light will stay on.
Variation: Defines the variation of the OnTime.
DimLevel: Defines the Dimlevel of a light (if it is sett to zero it will be choosen randomly)

Example:
LightID: 7
Start: 09:00
Stop: 10:00
Cycles: 5
OnTime: 5
Variation: 2
DimLevel: 0

The example above will turn the light with the id 10 on/off 5 times in between 09:00 and 10:00 for 3-7 Minutes with a random dimmer level.

The Tab “Ghosts” will then show something like (Note: The plugin only generated 7 ghosts, not ten. It realized itself that in one hour you cant fit 10 phases of up to seven minutes):

Name ID From To On
Ghost117 7 9:03 9:09 21.12.2012
Ghost127 7 9:20 9:24 21.12.2012
Ghost137 7 9:25 9:30 21.12.2012
Ghost147 7 9:31 9:35 21.12.2012
Ghost157 7 9:36 9:42 21.12.2012
Ghost167 7 9:43 9:48 21.12.2012
Ghost177 7 9:49 9:54 21.12.2012

Icon State:
Red: Vacation Ghost is disabled.
Orange: Vacation Ghost is enabled and ghost have been calculated. But no ghost ist active.
Green: Ghost is active (a light is actually turned on by a ghost).

Luup Code:
To enable Vacation Ghost:

luup.variable_set("urn:upnp-org:serviceId:VGhost1","OnOff","1",devID)

To disable Vacation Ghost:

luup.variable_set("urn:upnp-org:serviceId:VGhost1","OnOff","0",devID)

Replace “devID” with the devices id number from your vacation ghost device.

Step by Step Installation and example Setup:

Installation:

  1. Install the plugin from apps.mios.com.
  2. Reload the lua engine by clicking the “reload” button on your vera’s webinterface.
  3. Reload the Webinterface in your browser by reloading (usually F5) the page.

Setup:

  1. Open the device “Vacation Ghost” on your vera. Don’t enable it yet. The icon of the device should be red.
  2. Open the Tab “Lights & Times”
  3. In this example we will setup one light which will be controlled by the ghost. In the first row “LightID:” ind the first ligne, choose which light should be controlled.
  4. In the row “Start” choose when the OnPhase starts. For example 10:00 AM.
  5. In the row “Stop” choose when the OnPhase stops. For example 11:30 AM.
  6. In the row “Cycles” choose how many times the light should be turned on wihin the onPhase (from “Start:” to “Stop:”). For example 4.
  7. In the row “OnTime” choose how long the lights should be turned on. For example 10 Minutes.
  8. In the row “Variation” choose how much the length which you defined in “OnTime” should vary. For example 5 Minutes. (Since you have Setup “OnTime” to 10 in step 7, the ghost will now turn on the lights from 5 (OnTime-Variation) to 15 (OnTime+Variation) Minutes.
  9. In the row “DimLevel” choose to which level the light should be dimmed. If it is a switch this field may be ignored. If it is a dimmer and you set “DimLevel” to zero, the dimlevel will be randomized in between 0 and 100.
  10. Hit the “Save” Button on the bottom of the tab to save your settings.
  11. Go to the “Control” Tab and enable the ghost. Wait till the icon of the ghost device turns orange, meaning the ghost has calculated the ghost.

The ghost should now calculate 4 Ghost, which all have a length from 5 to 15 Minutes, which all run in between 10:00 AM and 11:30 PM. When you leave the ghost enabled these lights will be turned on and off according to the calculated ghost. If the ghost has calculated and turned on a light, the icon will be green. The calculated ghost can be seen in the tab “Ghosts”.

Once all lights have been turned on and off and all ghost have passed, the plugin will wait until the next day and then recalculate the ghost. This means the Vacation Ghost will recalculate the ghost every day within your parameters.

If you change the settings in the tab “Lights & Times”, disable the ghost, wait till the icon is red. Then enable it again after changing your settings, wait till the icons becomes orange or green again.

Versions:

Version 0.90:
http://forum.micasaverde.com/index.php/topic,12952.msg95549.html#msg95549

Version 0.91:
http://forum.micasaverde.com/index.php/topic,12952.msg124453.html#msg124453

Version 0.92:
http://forum.micasaverde.com/index.php/topic,12952.msg127475.html#msg127475

Version 0.94:
http://forum.micasaverde.com/index.php/topic,12952.msg129213.html#msg129213

Version 0.95:
http://forum.micasaverde.com/index.php/topic,12952.msg129364.html#msg129364

Version 0.90:

http://apps.mios.com/plugin.php?id=2928

This is the initial release and should be considered as “beta”. Please tell us about any bugs or wishes you have!

Up to now this has not been tested on UI4. If somebody feels like doing this we would be glad to get some feedback. Here is the download link for all the files:
http://apps.mios.com/download-plugin.php?PK_Version=9126

my compliments, brilliant idea & plugin

Plugin has been approved. Thank you very much @mcvflorin

Happy holidays to everybody!

Great idea!!!

Any idea why I am now getting a “Stack oveflow at line:1” error when I log into the UI5 dashbaord.

I have not used the pluging at all yet. All i did was install it, and now I am receiving these messages upon login into the veralite.

My Light ID drop down shows only two devices?!? Vera 3 with UI5.

When the vacation Ghost is enabled, the light turns on on the Vera at the exact time. But, in fact, the light stays off. So, nothing happened.
Can someone help me or is it a plugin’s bug ?

Chixxi,
This is awesome.

I have a few questions…

a) We have a very predictable light on/off schedule at the house so I want to mimic that. I’m setting the Start/Stop/OnTimes accordingly… I set the Cycles to 1, yes?

b) Any plans to have the Start/Stop times be Sunset/Sunrise with ± minutes? This is perfect for those of us that turn on lights based on when it gets dark outside (and in our house)- and off as it gets bright outside.

c) Will you be my new best friend! You just allowed me to deleted like 6 events!!!

[quote=“Aaron, post:8, topic:173675”]Chixxi,
This is awesome.

I have a few questions…

a) We have a very predictable light on/off schedule at the house so I want to mimic that. I’m setting the Start/Stop/OnTimes accordingly… I set the Cycles to 1, yes?

b) Any plans to have the Start/Stop times be Sunset/Sunrise with ± minutes? This is perfect for those of us that turn on lights based on when it gets dark outside (and in our house)- and off as it gets bright outside.

c) Will you be my new best friend! You just allowed me to deleted like 6 events!!![/quote]

Chixxi,
I still have the above questions but I also hit a problem when trying to add a 2nd Vacation Ghost device.

Problem: no matter what settings I use (different lights, times, etc) it always says it saves but it does not. The settings move back to the default “undefined”

I think I figured out the problem… a bug I suspect. No matter what I tried it would not save the settings on the 2nd VG device, I even tried deleting the 2nd one, then adding another. It finally ‘worked’ but only AFTER I changed the name of the device under the ‘Advanced’ tab. Then it will save all the settings.

I don’t know if this is a bug in your code or vera… but if you can make sure the Name of the device is unique then it will fix the problem.

thx

Sorry to everybody who has problems, as posted above the first release should be considered as “beta”, we will try to fix all problems as soon as possible!

I need a little more information to be able to help you further. Please post a screenshot of the settings you have in the tab “Lights & Times”.

@theos2:
Where and when do you get this error? Can you maybe post a screenshot? Please clear your browser cache and reload the UI5 and reload the lua engine.

@chuck1026:
Please clear your browser cache and reload the UI5 and reload the lua engine. Do you have more devices available in the drop down now? Are all your lights assigned to rooms? Which ones are shown and which are missing?

@lwinter:
Did I get this right: You see the message “Transmitt OK” and the light is set to on in the UI5, but the light doesn’t turn on? Is it a dim-able light or a switch? Does it also turn off again?

@Aaron:
a) Well basically the plugin is to randomize lights, not to make them run at exact times. (It is a good idea for the next plugin!) But if you set the phase for example from 11:00 to 12:00, Cycles to 1, OnTime to 50, Variation to 0, and DimLevel to 100, then the plugin generates one ghost which will run for 50 minutes within that one hour phase. The plugin uses a minimum brake of one minute, so when you phase is one hour (11:00 to 12:00) the maximum OnTime you can set is 58 minutes. Otherwise the OnTime will not fit in the phase and the no ghost will be generated.

b) We have taken this into our wishlist for the plugin.

c) Glad you like the plugin.

d) Second Ghost Device: We are able to reproduce some of these errors. We will fix this as soon as possible and release and update. Thanks for your feedback.
EDIT: After creating a second device you need to reload the lua engine again. Then instead of “undefined” the variables are set to 0. This is what happened after you changed the name, when you clicked “SAVE” the lua engine was reloaded.

[quote=“chixxi, post:10, topic:173675”]@lwinter:
Did I get this right: You see the message “Transmitt OK” and the light is set to on in the UI5, but the light doesn’t turn on? Is it a dim-able light or a switch? Does it also turn off again?[/quote]
Thanks Chixxi for your work and answers.
Yes, I see the ‘Transmitt OK’ message and the light is set to on in the UI5 and the light doesn’t turn on. In fact, the light is on a Everspring AN1576.

[quote=“lwinter, post:11, topic:173675”]Thanks Chixxi for your work and answers.
Yes, I see the ‘Transmitt OK’ message and the light is set to on in the UI5 and the light doesn’t turn on. In fact, the light is on a Everspring AN1576.[/quote]

This is very strange and I am not sure if it is plugin related. Does the plug work when you normally turn it on or off? I do have such an everspring plug, will do some testing today… Do you happen to have any other devices you could test?

I tried with a Fibaro FGD-211 and it works well.
I don’t understand why it doesn’t work with the Everspring device.

[quote=“lwinter, post:13, topic:173675”]I tried with a Fibaro FGD-211 and it works well.
I don’t understand why it doesn’t work with the Everspring device.[/quote]

Yes, you are right. The device has the same error in my house. Behaves exactly as you describe. Sorry, for some reason we didn’t see this during testing, I will investigate this and let you know as soon as possible. Thank you very much for your detailed feedback.

As you said, it’s a “beta version”. I will try again on next version.
Thanks Chixxi for your work.

[quote=“chixxi, post:10, topic:173675”]d) Second Ghost Device: We are able to reproduce some of these errors. We will fix this as soon as possible and release and update. Thanks for your feedback.
EDIT: After creating a second device you need to reload the lua engine again. Then instead of “undefined” the variables are set to 0. This is what happened after you changed the name, when you clicked “SAVE” the lua engine was reloaded.[/quote]

It is easier to rename the VacatonGhost device :wink: … especially since I’d want to do that anyway. If you can, I suggest you code it to make the names unique by default which might avoid the problem completely and at minimum help users identify between multiple VG devices when making several.

I think I found a problem using Appliance Modules…
I set the dim level to 100 – this does not turn the appliance module on. It does not seem to make any ‘Ghosts’ on the Ghost tab?

Given the time of year this should be renamed the “Home Alone” plugin! :slight_smile:

Hi,

I would like to activate/disabled this plug in with an App. For that I would like to create to scene and one smartswitch.

But I cannot activate the plug with a scene. Do you know how can I do it?

Thank you
Matteo

If you want to activate the plugin in a scene, here is the code :

luup.variable_set("urn:upnp-org:serviceId:VGhost1","OnOff","1",devID)

and to desactive :

luup.variable_set("urn:upnp-org:serviceId:VGhost1","OnOff","0",devID)

Yes, we have noted that this can`t be done thruogh the UI at the moment, will be fixed in the next update.

Until then, this can be achieved by going to the “Advanced Tab” in a scene and add the ghost device there. Then choose “set”. Then you can enter 0 for off and 1 for off.

EDIT: Or as posted by lwinter