Give me a lei! Its a Lua!

Sadly, no luau…. no roasted pig… no pineapples. Lua is scripting language supported by Vera. Generally speaking, it’s how you do stuff they didn’t already build in.

I mentioned that I have my pool pump turning on or off by a schedule and I have managed to get it to turn on when the temperature sensor goes below 36 degrees. That temperature may be set lower at some point, but for now, I want a margin of safety.

What is not ideal is that the schedule can turn off the pump even if the temperature is below freezing. The next time the temperature is polled, that trigger will turn it back on but that is a bit inelegant and potentially dangers. What if something suddenly stops the temperature sensor from polling for long enough for the exposed filter hoses to begin to freeze?

There are several examples of Conditional Scene Execution and I have lifted the Lua code below and attached it to the scene that turns the pump off.

local dID   = e3    — Device ID of temperature sensor
local tHigh = 37    — Highest temperature of range
local allow = true  — true runs scene when in range
local tCurrent = tonumber((luup.variable_get(“urn:schemas-micasaverde-com:device:TemperatureSensor:1”, “CurrentTemperature”,dID)))
return ((tCurrent >= tHigh) == allow)

I lifted this snippet pretty much directly from the forum then edited to be appropriate in my environment. I don’t really have range of temperatures where I want to allow the pump to turn off. It’s pretty much the one temperature. Below that, don’t turn the pump off.

I looked at the “Settings” tab of the temperature sensor to get the device ID and the “Advanced” tab to get the urn: details. I chose 37 degrees as the set point because the trigger to turn the pump on is 35 degrees. Hopefully, this ensure some hysteresis to prevent the pump from cycling back on if the temperature is hovering at 36.

Once I’m sure this is working, I will add a trigger to turn the pump off above some fairly warm temperature, say 50, to prevent it from running all day just because it happened to be chilly at 6AM when the schedule went by.

Zowie… 2 years later…

I did indeed get the VeraLite and over the intervening two years, a few devices. Incidentally, MiCasaVerde is now “Vera

Since I didn’t update this blog along the way, I kinda have a current snapshot of two years of intermittent development.

Vera’s two controllers, Vera3 and VeraLite are the same OS running in different hardware. Vera3 has more features, particularly WiFi and network routing features, whereas VeraLite does not. There may be some more connectors or lights on it; not sure. I have an established WiFi network already, so I didn’t see a reason to complicate things. VeraLite costs less as well.

Since they both run the same OS (called MiOS), they present the same web interface. The interface is reachable on the local network or through a (free) internet gateway run by Vera. VeraLite polls Vera’s website frequently using port 80, which allows you to remotely control your Vera device, usually without any special firewall configuration. This does introduce what is, to me anyway, a small but acceptable delay, especially since most of my remote operations are done with a smartphone app anyway.

The primary device that has been used consistently for almost the entire time is the 2Gig CT30 thermostat, which has since been discontinued and replaced with the CT100. The CT30 and a couple of different smartphone apps has allowed us to lazily adjust the thermostat without leaving the couch or even the bed. I have played with it remotely, but mostly just because I could. I haven’t really needed it. Our schedules mean that there is not much time during the day that the house is unoccupied.

I have a couple of lamp modules and a couple of heavy duty appliance modules. I have experimented with using them in various functions around the house. The lamp modules haven’t proven to very practical. This is mostly because there needs to be a user friendly (meaning wife friendly) way to turn them on and off without going to another room or picking up the phone, etc. If she wants the lamp on the dresser on, she usually needs it *now*. Where the lamp module has shone is with the Christmas tree. I set up a schedule to turn on in the morning, off in the early afternoon, back on in the evening, and off at bedtime. In a few days, the tree will come down and i will find something else to light up.

One kinda fun application of a lamp module came when I couple of lights in the bedroom were still connected to it. My wife did not have a phone in the bedroom with her and I needed to call her, for a wakeup call if I remember correctly. When I couldn’t get her, it occurred to me to toggle that bedroom light on and off. Hopefully, she would call to find out why its going crazy.  When she called (it worked!) she was laughing and seemed to appreciate my cleverness.

The Jasco outdoor control module is a heavy duty rain proof module designed for non-dimming  outdoor lighting, but really it just switches power to anything that needs it. I originally purchased two of these to control heaters in our water well pump house and horse trough. That attempt taught me about an important limitation of Z-Wave: range. With a brick house and a metal pumphouse, even 20 feet is too far. I could not make it go. Since the power for both comes from the barn and I have network in the barn, I can at some point add a second bridged VeraLite in the barn and control the heaters (and lots else) from there.

For now, one of the outdoor modules is controlling the pump for our little above ground swimming pool. I currently just have it on a time schedule to run overnight since our Texas winter freezes overnight and thaws every day. I’d like to run the filter basically an hour on and two hours off, all day long, but also continuously any time temperatures outside approach freezing. I have a Homeseer HSM100 3 in 1 sensor (motion, light level and temperature) but I am having trouble getting it to work from outside. Maybe the metal garage door is an issue. I’ll try putting the sensor somewhere else, closer to the appliance module for Z-wave network reliability.

The light sensor in the 3 in 1 will hopefully be pushed into service to operate some outdoor lighting at some point. The motion detector, outside, will probably be useless, but I may try having it run the outdoor lighting, if its dark enough.

The final cool thing I have been playing with is video cameras. MiOS is smart enough to be able to grab images from many, maybe most, common IP cameras and can present them through the remote portal. I can monitor the doggies during the day and the horses in the barn at night, from home or away.

Another thing I want to be able to do is monitor our water system. Our well has a lot of sand, so it took a year or so to replumb enough filtering devices in line to keep it from clogging up a filter in the middle of a shower. Water comes from the well (420 feet or so deep) into the garage where the scary plumbing is.

I got pretty good at PVC piping. Sadly, not until after the incident that painted the walls with that rusty orange wash.

Water comes into the garage and splits between the pressure tank and the inlet to the large filter on the right. This is a self-flushing sediment filter. It is programmed to flush at the next 1AM each time 1000 gallons has flowed through it. This is the most frequent interval possible. Sadly, our well produces enough sand that sometimes, this isnt frequent enough.  Next in line is a standard cartridge filter, which used to be the first filter in line. This gets the fine silty stuff that eludes the sediment filter. This cartridge has to be changed at random intervals, but monthly is not unusual and I can deal with that. Before the big filter, it rarely lasted more than a few days. Next in the chain is dual stage filter that was already here. Due to the previous lack of prefiltering, it probably needs to be replaced. Next is a water meter. This is just so we can monitor our own water usage. It has a contact that closes once for each gallon, so I really would like to be able to log and report on the usage. There is a little more piping and valves to allow some or all of the filtering to be bypassed if needed and a pre-filter spigot where we can get essentially firehose flow and pressure. This spigot is before the filters, which means it is also before the meter, so I don’t get to monitor it. Adding another meter there would be easier and probably cheaper than replumbing. Again.

In any case, monitoring pressure differentials can indicate when a filter needs to changed or flushed and electronically monitoring water flow would reveal any leaks or other such issues.

Schlage / Nexia

While searching for some X-10 equipment (the only consumer automation system I was familiar with), I saw “ZWave” several times. I finally looked it over and was definitely intrigued.
For reliable communication, X10 sometimes requires some equipment in the breaker box to bridge between phases and pretty much by design, the control stream doesn’t jump between electric subscribers. In my new case, there are separate meters for the house and workshop/barn and a desire to control devices in both locations. ZWave, with it’s mesh networking protocols and fairly wide variety of devices and brandnames to choose from, seems like a good match.

I first tried the Nexia controller (formerly SchlageLink). The first thing that irritated me was a need to *pay* for an account for the privilege of controlling devices at my own home. I presumed incorrectly that there might be a local webserver on the device, but not only does it require an account to work, it requires a reliable internet connection. I can understand offloading the heavy lifting from the tiny local appliance, and system response was very good when I tested it at work and even when I moved it home. However, later that evening, my internet was slow and it took as much as 30 seconds to turn a light on; at least whenever it didn’t simply time out and never come on. It is not acceptable for my wife to randomly wait as long as 30 seconds to turn on the lights in a security issue moment, so I cancelled the account and have requested a refund on the equipment. At this point, I await an RMA. They have been kind and responsive when calling, but they do not appear to be in any hurry to pay out.
So, I kept looking for ZWave automation controllers and found the Vera line. VeraLite had *just* begun shipping. VeraLite has all the software features of Vera3, with no router and wi-fi. I don’t need those features from Vera, so I placed an order for VeraLite and a few outdoor rated switch modules.

A new project, to add to all the others….

We bought a new house, new to us in any case. I wanted to automate the old house, but just never got started. The new place is a large house with a detached workshop/horsebarn, a water well, a large pond and several other automation targets. My hope is to make life easier for us and hopefully save a little money at the same time.