Stopping parts of a scenes actions

Hi guys.

I don’t own a Vera just yet, but I’m just seeking out the market right now. Since I do not have a Vera (and there’re no demo interface), I’ll have to ask a little question here.

Obviously, when the scenes lua-script returns false, it’ll stop the execution/activation of that particular scene. But is there a way to stop parts of a scene?

Say I have a scene called “TV Time” (probably a quite common one). I want the lights of all the rooms visible from the TV-area to dim down to 30 % and after 10 seconds turn off entirely. Obviously, that can be achieved through delays with no scripting at all. But now, if my hallway lights are off, I dont want it to turn on to go to 30 %. Neither if the current dim level is 20%. Sooo I could stop the scene execution completely by doing if(lightLevel<=30) then return false end. However, I still want say my kitchen lights to dim to 30% if they were at 80 %.

Solution 1
Leave the lights alone in the GUI, but script them. i.e.

if(llHallway > 30) then
    dimToThirty(hallway_device_id)
end
if (llKitchen > 30) then
   dimToThirty(kitchen_device_id)
end

and so on. That however “destroys” the overview of the scene.

Solution 2
Use PLEG.

But my question is - are there any other solution to this kind of task?

Thanks in advance! Looking forward to be a part of the Vera-community!

Best Regards
Rasmus Dencker

You cannot stop parts of a scene from executing. You could use multiple scenes with the same trigger and use Lua in each one to add the conditional logic. Otherwise the options are as you have shown - luup actions in the scene or PLEG.

I would advise using PLEG. Once you get up the learning curve, you will find it makes the implementation of timed and/or complex logic quite straightforward.

Thank you. I took a look at the PLEG docs, and it does look nice indeed. I also checked some videos out on YouTube. The functionality looks promising. However, SRP is very important when doing any kind of coding/scripting/logic that, at some point, will expand. It just seems like a big clutter when you have a lot of conditionals in PLEG, as it seems that the inteded usage is collecting all the logic in one “device/plugin”. Is it possible/ideal to have more than one or two PLEG’s? Say I have a kitchen-PLEG, living room-PLEG and so on; what’s the pros and cons of that, and is it even possible?

EDIT:
It does seem like I can create n numbers of PLEG’s as long as I buy a license for every four.

As you have discovered, it is indeed possible to have multiple instances of PLEG. The downside is that each instance will consume about 2MB of available memory so it is less efficient than having a small number of PLEGs with a larger set of Conditions. This memory impact occurs on all plugin devices not just PLEG.

Memory usage is more of an issue on Vera Lite than on Vera3 which has twice the capacity.

Hm, that’s an interesting subject. While we’re on it, how much mem do you believe an average plugin / device consumes? 2 megs all over?
I don’t need any routing capabilities or anything; just the Z-wave interface. I’m planning on running about ~20-30 Z-wave devices and also running a network of Arudino-devices (probably 10-15 child devices talking through one host connected to the Veras USB port). I don’t know if linking is allowed on this forum but I’m sure that you’re familiar with the Arduino system.

Will the Vera Lite be sufficient?

Each parent plugin consumes about 2MB. Child devices have much less impact - really just the space required for state variables and the device files.

With 30 Z-Wave devices, the Arduino host and 15 child devices you may be OK on a Vera Lite if you don’t have too many other plugins. There are some very useful plugins, though, and most of us end-up installing a quite a few of them. This could push the capabilities of a Vera Lite and result in an unstable system.

Most HA systems tend to grow beyond the original intent and new firmware releases are inevitably larger so, in your position, I would personally go for a Vera3 for the memory headroom.

So, let me understand the terminlogy; can you correct my understanding of the words you used:

[ul][li]Parent plugin: The unique plugin that does the logic part. (fx. a dimmer-plugin or a simple on/off plugin). This consumes 2MB.[/li]
[li]Child device: A device that is connected and controlled via a plugin. So if I have 10 dimmable lamps, they all run on instances of the same “parent plugin”? Let’s say each instance consumes 0.5 MB for variables and identification data.[/li][/ul]

So for a system consisting of only 10 dimmable lamps (with every other plugin uninstalled/removed, just for the sake of the example), the math would be something like:

2 + (10 * 0.5) = 7MB total memory usage

Am I getting it right?

[quote=“RexBeckett, post:6, topic:183664”]With 30 Z-Wave devices, the Arduino host and 15 child devices you may be OK on a Vera Lite if you don’t have too many other plugins. There are some very useful plugins, though, and most of us end-up installing a quite a few of them. This could push the capabilities of a Vera Lite and result in an unstable system.

Most HA systems tend to grow beyond the original intent and new firmware releases are inevitably larger so, in your position, I would personally go for a Vera3 for the memory headroom.[/quote]

You do make a great point here. I still think that +$130 MSRP is a bit high (obviously biased by the fact that the Vera3 has a lot of features that I’m not gonna be using).

Again, thank you for your time. It’s much appreciated.

EDIT: Unfortunately, the european version of the Vera3 seems to be out of stock at all the suppliers I’ve found, including getvera.com (which seems to be the official site).

Am I getting it right?

The principle is right. Z-Wave devices do not normally need a plugin - support is embedded in Vera’s LuaUPnP engine. Plugins are used for virtual devices like PLEG, VirtualSwitch, Weather, IP-controlled devices, etc. I have not measured it but I doubt that child devices use more than 100KB of memory each.

Z-Wave devices can also have a parent/child structure. One example is that of a multi-function motion detector that includes light, temperature and humidity sensors. As with the children of a plugin, I would not expect each device to require more than 100KB of memory.

You do make a great point here. I still think that +$130 MSRP is a bit high (obviously biased by the fact that the Vera3 has a lot of features that I'm not gonna be using).

Most people do not use the Wifi and Switch on the Vera3. It is really only the additional RAM and extra USB port that have value. You can find many posts on this forum from people who, often reluctantly, upgraded from Vera Lite to Vera3 and got a more stable and reliable system.

Unfortunately, the european version of the Vera3 seems to be out of stock at all the suppliers I've found, including getvera.com (which seems to be the official site).

I have not done an exhaustive search but both Vesternet and Swarm Automation seem to have them in stock.

Yep, but since the engine is modular, I just assumed that the embedded support are just pre-packaged plugins.

I didn’t know Swarm Automation.

Thank you for your time, Rex. Looking forward to getting into this whole world of HA, and Vera seems to be the perfect platform for a developer like myself.

Have a great day.