New Plugin: Deus Ex Machina

And it’s done! A new version of Deus Ex Machina is now approved and available.

First, I’d again like to thank Andy for being super-cool and turning over the code base to me for ongoing support. The plugin code and the documentation can be found here: GitHub - toggledbits/DeusExMachina: Vacation Plugin for Vera Home Automation

Use the usual Vera install process. But first, take a minute to read…

Here’s the “express” version of what you need to know about DEMII:

[ol][li]This new version is published as a new plugin called “Deus Ex Machina II” (I call it DEMII for short). The reasons for this were two: (1) The old plugin is under Andy’s account on apps.mios.com, and there’s no obvious way to transfer it, and adding me as a contributor wasn’t working either; and (2) I no longer have access to UI5, so while I’ve made every effort to keep this new plugin compatible with UI5, it’s untested on that firmware, so leaving Andy’s old plug-in that’s at least well-understood on UI5 seemed like a good idea until I can get a UI5 test platform myself. So…[/li]
[li]I have only tested this version on UI7. It may work on UI5, but it may not. If it doesn’t, I will make an effort to resolve the problems, but since I don’t have UI5 to test on at the moment, I will need to rely on others to give me good quality bug reports, or even dig in and find my errors and make contributions to the Github repository. For UI6, I have no idea. Want to help?[/li]
[li]If you are currently using the old Deus Ex Machina plugin v1.1, do not delete the old device or uninstall the old plugin yet. This new plugin will copy your old configuration when it installs, but if you delete it, it’s not there to copy, of course. This may apply to very few people, I understand, since the old plugin really didn’t work on UI7, but some discovered workarounds for the problems.[/li]
[li]After installation, two full refreshes of the browser are recommended (ctrl-F5 on Windows and whatever you normally do on Mac, etc.).[/li][/ol]

What’s fixed?

Again, even though this is published as a new plugin, it is a revision of Andy’s code. Here’s what’s changed:

[ul][li]The problem of operating incorrectly when the “Lights Out” time was before midnight has been fixed. (UI5 and UI7)[/li]
[li]The problem of not saving configuration changes on UI7 has been fixed. (UI7)[/li]
[li]The way controlled lights are stored in configuration has been changed to a single state variable containing a list of devices (UI5 and UI7)[/li]
[li]The timing of the “Lights Out” mode has been reduced. DEM v1.1 used the same 300 to 1800 second (5 to 30 minute) range for randomly shutting off controlled lights as it did for cycling them. The problem with that is that if you have a large number of controlled lights and even modestly bad luck with the random number generator, it could take hours for DEM v1.1 to shut off all the lights. DEMII uses a 60 to 300 second (1 to 5 minute) range for random delays in the shutdown mode, making it look (I think) more like a natural “bedtime” behavior. (UI5 and UI7)[/li]
[li]DEMII on UI7 can be enabled or disabled by a scene. It can also be enabled/disabled in Lua, as it was before, but that’s been more clearly documented.[/li]
[li]DEMII on UI7 can trigger a scene (or PLEG/PLTS) when it changes state from enabled to disabled.[/li]
[li]DEMII on UI7 can trigger a scene (or PLEG/PLTS) when it changes operating state. That is, when DEMII hits sunset and is ready to start cycling lights, it sends an event that it’s now in the cycling operational mode. When the “Lights Out” time is reached, it sends an event to indicate it’s going into the shutdown mode. When all the lights have been shut off, it sends an event to indicate it’s going into its “idle” mode (waiting for the next sunset).[/li]
[li]DEMII keeps its timing delays in state variables you can see and modify (they were previously hard-coded). While I haven’t made a UI on the Configure tab for these yet (and I’m not sure how valuable that may be), you can at least change them on the Advanced tab. The four variables are: MinCycleTime, MaxCycleTime, MinOffTime, MaxOffTime. The two cycle time variables are the range used for choosing a random delay between cycling lights. The off time variables are the delay range used when shutting off lights for “bedtime”. All of these are in seconds. Please make sure any values you enter are valid integers, and the min must be less than or equal to the max.[/li]
[li]If DEMII is disabled while it is cycling lights, it will immediately shut off all controlled lights.[/li][/ul]

Let me know what you guys think.

Oh, I did a cursory test under openLuup/ALTUI while I was trying those projects out just for fun, and it seems to mostly work, although the UI layout isn’t correct. I’ll be asking those projects for guidance to resolve those issues, and it is a goal to have DEMII working there.

@Aaron,
you indicate that you too have a working PLEG “Ghost” per chance could you share a PDF copy? Mike

Richard, maybe you can provide an example PLEG that mimics the same functions as this for people that use it? I don't use this plugging but I have a PLEG that mimics our real life schedule, adding minor randomness that is more "real"... In case anyone is watching the house.

Just a short note of appreciation for all your efforts in getting this app to work in UI7. One of the major reasons for purchasing the Edge was in large part due to early investigation and seeing the original DEM. Imagine my disappointment when I couldn’t get it to work! Many Thanks!!

I wanted to add my thanks for DEMII as well. I rely on it while I am away.

I do have a question: Has anyone found a way to add DEMII to HomeWave for iOS? I was able to add DEM back in the day, but can’t seem to add DEMII…

Nice I am new to the VeraPlus and the whole Vera thing and your plugin has been a big help… Last I did home automation was back in the X10 days … now I am back and muddling through with the VeraPlus

Need help with this plug in.
I am using version "“II” at my Vera Plus.
I have configured some built in Qubino Flush 1 reays and Fibaro dimmers that should be used with the plugin.
I have enabled the plugin, but it doesnt turn on/off anything?

The plugin will only cycle lights between sunset and the “lights out” time (specified in Device Configuration). Make sure you’re within that period.

You just saved my life!! My home brew Vacation Ghost Luup code just stopped working after the latest firmware update (actually it still works if you run it manually just cant save the code in a scene anymore for some reason) and I’m about to leave town for a month. I was scrambling to get something going before I leave, then along comes DEMII. Thank goodness. I used DEM for a while, but then went with my own code that worked well for about the past year.

Will be trying out DEMII tonight. Thanks for reviving this much needed app!!

Happy to help! ;D

DEMII v2.3 has been submitted for approval (still pending, just checked). It includes an important bug fix (see below), and support for operating only in selected House Modes (UI7 feature).

The little bug that was causing some big problems for some folks was a failed initialization of a variable at the time of install in v2.2 and ealier. The variable that stores the time to start shutting off lights isn’t initialized properly when the plugin is first installed, resulting in failure of the plugin to operate at all. This is easily remedied if you have those versions by simply changing the lights-out time to something other than the default 23:59. After changing it, you can then change it back to 23:59 if that’s what you want, but the important thing is that you change it. After that, you shouldn’t have any trouble. Version 2.3 fixes the initialization.

I’ll post a follow-up when MCV releases the update.

Just wanted to echo the thanks for taking the time to track down the original owner and update the plugin.

It’s people like you that keep Vera afloat. This was something that has been desired and talked about for years.

Great plugin!

However I have a problem. I have set it up to only run when away (only “Away” checked under House modes) but it will still run in “Home” mode. I’m running version 2.3 on a VeraEdge with UI7 latest firmware.

@mht, if you go into the device > Advanced > Variables, what’s the value of the HouseModes variable?

The HouseMode variable is 4.

Could it be that if the app starts running in away mode, it will keep running even if the mode In Vera is changed to home?

DEMII checks the house mode before each activity (that is, if eligible to run, before it turns a light on or off in its active period between sunset and “lights out”). If the house mode changes from Away to Home (or from an allowed mode to a disallowed one, more generally), it will go into “lights out” mode and progressively shut off any lights it has turned on. It may take it a few minutes to do this, or with a large number of lights, possibly an hour or more.

Since you posed that question, I’m wondering if what you were seeing was just DEMII slowly turning off lights after the transition to “Home” mode. Did you see it turn any lights ON, or was it just turning one off at a time at random intervals?

It randomly turns the selected lights on and off. My Vera is i home mode and Deus is configured to run only in away mode.

Until the issue is resolved, I will set up PLEG to enable/disable DEUS depending on Vera modes.

OK. If you can, enable DEMII after sunset with your house in Away mode. Wait a minute or two, then use this URL to view the log file (put your Vera IP in where shown).

http://your-vera-IP/cgi-bin/cmh/log.sh?Device=LuaUPnP

Copy and paste the results and email them to me patrick (at) toggledbits (dot) com. There be logging there that will help me see what DEMII is thinking.

I will send you a log file in about 10 days.

LOL! OK. Enjoy your vacation?

Hello!,

I have just installed this app and have a question about his behaviour.

-2 lights are checked and I have als checked all the modes.
-the app is enabled and it is night.

What happends , when I enable the app/device when it is allready night, will it still do it’s thing or will it only wait untill the next sunset and than start turning on and off lights?

If this is the case , that the app will only start switching on-off lights the next night , is there a way to circumnavigate this?

thanks,
Cor

Hi, love this plugin!

Any chance you could turn on and off ZigBee lights, as well as z-wave? Since moving to a Vera plus, I can’t get my hue lights to work, as z-wave devices, but they work well as ZigBee, but then they won’t turn on and off in the demii plugin, as they’re not recognised.

Or would it be possible to control virtual on/off switches, or could it toggle on and off scenes etc?

Thanks
Tony

Firmware: 1.7.2138