Z-Wave Home Automation
The objective of this project is to replace the unreliable X10 equipment in our home and to better understand the capabilities of the Z-Wave technology. We also have some specific home automation tasks that we would like to implement:
- Provide a wireless door contact sensor on our back door as part our home security system.
- Automate the extractor fan in our main bathroom.
- Automate the security lighting in our conservatory.
The Z-Wave controller and Z-Wave modules we have chosen and similar ones currently on the market enable much more powerful control and automation than we are attempting here, including heating and cooling control, security elements and energy efficiency and monitoring. We are not looking to implement whole house automation with Z-Wave technology though. We want to understand how the technology can be integrated into our existing hybrid technology Home Control System (HCS) and to also understand the strengths and weakness of the Z-Wave technology, so we can use it where most appropriate. This will be the first of several Z-Wave projects planned for 2012.
Because we have built already our own Home Control System (HCS) with the required intelligence, we are initially only using a limited number of X10 modules to provide sensors, monitoring and control of appliances and lighting. Initially, we were simply looking for a simple Z-Wave controller to integrate into our system but, whilst researching Z-Wave we discovered the MiCasaVerde Vera Internet Gateway. This devices is an Ethernet connected controller, with an extensible set of capabilities. Whilst it is more expensive than a simple USB controller device, the chances of us getting Z-Wave working in our home are much higher with a device like this. It also has good support and an active community of users. By being Ethernet connected, we inherently gain its remote access capability and the ability to monitor and control things using mobile phone apps.
This initial Z-Wave project uses the following components:
The Everspring SM103 is a door and window contact sensor. The specification and features are covered in more detail in our Z-wave design (sensors) section. The plan is to use this device on our back door, where we have no way of running any wires it into our existing Home Control System (HCS), due to the lintel over the door and the gas boiler to one side of it. The first thing that we noticed is that this looks very different to the image displayed on the site I bought it from (Z-Wave Products). It is silver in colour and not white as advertised. It is really too big and ugly to fix to our new white UPVC back door.
The Everspring AN157-3 is a plug-in appliance or lighting module for 240Vac and loads up to 16A. The specification and features are covered in more detail in our Z-wave design (appliances) section. The '-3' part of the module name signifies a UK plug pin layout, this device also being available for use in countries such as France, where the mains plugs have different pins and voltages. The plan is to use a number of these appliance modules to control a mains-powered, low-energy lamps in our conservatory and other rooms. The conservatory lamp provides both convenience lighting and security lighting.
The Everspring ST814 is a temperature and humidity sensor. The specification and features are covered in more detail in our Z-wave design (sensors) section. The plan is to use this device to monitor both temperature and humidity in our main bathroom and to automatically control the ceiling fan to reduce humidity. In a later project we would like to link this to a Z-wave radiator valve, to more intelligently control the bathroom temperature. The main heating source in our bathroom is a towel rail / radiator with an existing 'dumb' thermostatic radiator valve.
The Fibaro FGS221 is a dual relay switch that is very small and designed to mounted in a wall box, behind a switch plate. The specification and features are covered in more detail in our Z-wave design (sensors) section. It really is tiny! These types of devices don't have to be mounted in wall boxes or behind switch plates and they can control low voltages as well as mains voltages. We intend to use this device to control our main bathroom ceiling fan. We opted for this dual device because it cost the same as the single relay/switch equivalent and we might use the other switched output later with the bathroom lighting.
Installation & Setup
The plan was to have the VeraLite located in our 19" rack cabinet our loft, along with the other Home Control System (HCS) components, so that it is powered via our 12V DC [PR] UPS. Our testing shows that it won't work very well in a metal cabinet and radio range will be severely reduced. It is going to now be sited somewhere close by. It will also be connected using Ethernet networking components that are protected from power cuts. The key thing is that it needs to be 'in sight' of the other devices, so that it can talk to them wirelessly. For the purposes of set up and testing, the VeraLite was located in our study, about 2m below where it will finally rest.
Having connected a network cable and power, the lights all flash once, leaving the blue 'power' light flashing while the Vera Lite boots up. After about 30 seconds this settles to a steady on state and the orange 'ready' and green 'network' lights come on. It's then time to open a web browser (on the same local network) and open up the URL: http://www.micasaverde.com/setup. Note that once it is set up, the VeraLite does not have to have a network connection to work but, it is required for remote access and some other features.
We continued to a page where our device was detected and we were informed that our Vera Lite was running firmware V1.5.220, English language and UI5. We were also informed of an available firmware update and proceeded to install firmware V1.5.254. This can take up to 15 minutes but it was much less than that. You are informed when the update has completed and clicking the continue button allow you to connect directly to the devices web interface.
From the UI5 web interface the first thing to do is to register as a new MIOS user and associate the VeraLite device with this new account. You can then proceed to configure your Z-Wave network, scenes, timers and triggers.
This section covers the main features of the VeraLite controller as exposed by the UI5 web interface. The interface is accessed using a web browser and uses Flash technology in places.
You can 'pin' devices to the dashboard and this is the entry screen with UI5.
This takes you to a structured set of help pages that reside on the VeraLite. We haven't used them yet.
In the 'Device' tab we clicked 'Add Device' and plugged our Everspring AN157 appliance module into a socket close by. The button/light on the front flashes, indicating that it had not been assigned a node ID. The instructions with this device were not very clear but whilst the Vera Lite searched for devices we pressed and held down the button to enter inclusion mode. Once given a node ID, it was possible to operate the module via the web interface.
While we were adding devices we also added the Everspring ST814 temperature and humidity sensor. This is just a matter of pressing the ºC/ºF button 3 times to enter inclusion mode. We also added the Everspring SM103 contact sensor and pressing the tamper switch 3 times to enter inclusion mode. After adding each device you get prompted to save the configuration.
Scenes & Timers
Using the Vera UI5 user interface, you can create scenes. These are like scripts where things happen based on events or schedules. We created a scene called 'Dusk' with the intention that some lights will (the conservatory lamp being one of them) will come on at dusk.
We then created a timer for this scene, also called 'Dusk'. This schedule runs the scene depending on how you configure it. We configured this schedule to run the scene every day at predicted sunset. This is not as clever as our current Home Control System (HCS) twilight sensor which uses measured ambient light intensity but, it's a good start. There are Z-Wave devices that can measure light levels too.
We then created another scene called 'Good Night', which switches off lamps after we have gone to bed. For this scene we created two schedules, one for work nights and another for Friday and Saturday nights, which is set for a later time. With this simply bit of logic we now have a conservatory lamp that comes on at dusk and goes off just after we have gone to bed.
local socket = require("socket")
host = "192.168.1.25"
local sensor = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 5)
c = assert(socket.connect(host, 4445))
c:send("Zwave,Bathroom,Bathroom Temperature," .. sensor)
local sensor = luup.variable_get("urn:micasaverde-com:serviceId:HumiditySensor1","CurrentLevel", 5)
c = assert(socket.connect(host, 4445))
c:send("Zwave,Bathroom,Bathroom Humidity," .. sensor)
In this sub-tab, you can create rooms, to which you can allocate devices. These are essentially containers to simplify the management and the various views. Devices don't have to be in a defined room and rooms don't have to be used.
By setting up your location, Vera can work calculate sunrise and sunset times, which can then be used in scenes. You can also set other locality data here and also the time and date.
Allows you to grant remote access to technical support and supply contact details.
Net & Wi-Fi
Allows you to set up your network configuration and DHCP or static IP. We have used a static IP address so that other devices can call the Vera Lite interfaces.
Allows you to set auto-backups and see when they have been done. You can also save you network configuration or restore to a previous configuration.
Logs are described here. Vera can store logs locally if you have inserted a USB pendrive into the USB port. It is not clear to us what the advantages are but reading the support forums we found this: The logging was needed for the power users who had many devices 50+ and also had many plugins. This caused the Vera unit to run very low on memory and even caused the device to reboot.
There are quite a few settings in this section and we will add stuff here as we learn more.
One of the settings here is to enable or disable Z-Wave polling. Polling is bad in our view and very inefficient. With the devices we have on our Z-Wave network and the way we have configured them, we don't see that we need to use polling but, we have had some unexpected behaviours when we have turned it off. We are researching these further.
One of options here is to repair your Z-wave network.
Enables Insteon and X10 support if you have a suitable interface connected.
Does a check to see if you are running the latest version, allows you to do both upgrades and manual updates (including downgrades).
You can rename your unit here and set limits on the notifications per day.
There is also an option to 'secure this MiOS'. Checking this will require you to enter your user name and password before being able to access your Vera. This is not via SSL. Your username and password will be sent in the clear.
Despite being quite compact, there is not enough width of door frame to accommodate a sensor of this size. Fortunately, we installed a hidden magnet and reed relay in the door frame, when the door was installed. The wires are out of sight (behind the skirting board) and run across to a space behind some removable plinth close by. My plan was to open up this sensor and wire it to my existing reed switch but, this sensor provides some contacts for a remote reed switch and this makes my installation a whole lot simpler. This one clever piece of design has negated our initial disappointment with this device. This device has a tamper switch on the rear which is also used for to enable network include, exclude and association.
This device is installed and we have associated created two scenes for this device. Both assume the device is armed and the scene BackDoorOpen is triggered when the sensor is tripped (door open). The scene BackDoorClosed is triggered when the sensor is untripped (door closed). Both scenes have Luup code to send a message to our Home Control System (HCS) using socket layer communications. As far as all our main HCS process is concerned, these are just some more I/O event notifications.
In the BackDoorClosed scene we have also added the following code, to detect the battery level of this device. This is then also reported using socket layer comms and our HCS can send us an SMS message if it detects a battery going flat in any of our Z-Wave devices.
local battery = luup.variable_get("urn:micasaverde-com:serviceId:HaDevice1", "BatteryLevel", 6) // Assuming 6 is the device ID
c = assert(socket.connect(host, 4488))
c:send("Zwave,Battery,Back Door," .. battery)
The Everspring SM103 contact sensor is an interesting device. The additional terminals for a remote reed switch or micro switch means that we can envisage it being used in outdoor applications, such as a shed door or inside a garage. We are also looking to see if it can be used on our garden gate, with the main device mounted inside our integrated garage.
12th Dec 2012 - This sensor reported a new battery level of 80%.
Physical installation of this device is simply a matter of plugging it in to the mains socket and then plugging the lamp plug into the socket on the front. We have used an on/off appliance module as we don't require or want dimming and most low energy light bulbs do not support dimming. There is a combined button and light on the front of this module for manually toggling the state and to also enable network include, exclude and association. With the VeraLite searching for new devices to include, inclusion is simply a matter of pressing the button on the front.
Having installed this in our conservatory, we could reliably control it over the Z-Wave network. This is about as distant from the VeraLite as you can get in our current house. Looking through the Vera log, we can see that there is no direct line of communication to this device and that some communications attempts are failing and having to be repeated to get through. This is because this node is distant and we don't have many nodes in our network yet. We will be adding some more nodes and this should improve the situation.
We have set up some scenes to control these directly via the VeraLite initially. Once we are happy with the installation, the Timer element of the 'Dusk' scene will be removed and our will invoke the scene based on input from our twilight sensor.
This device reports its status back instantly when the button on the device is pressed. This is handy as it means we have written a set up some scenes to send notifications to our Home Control System (HCS) using socket layer comms.
This sensor comes with a table stand. It also comes with both double-sided sticky foam and screws and rawl-plugs, to fix it to a wall. For this project we have used the stand and it is mounted on a shelf in our bathroom. We have set the humidity ON value to 75% and the humidity OFF value to 70%.
Although the ST814 device measures and reports to 0.1ºC resolution, the VeraLite will only display integer values. This is apparently because it does not fully conform to the UPnP specification.
We have found there is an issue in getting regular temperature and humidity reports from the ST814. Reading through the MiCasaVerde forum thread, it looks like this is a default configuration issue with the VeraLite. It's with issues like this that you suddenly find yourself diving into the depths and technicalities of Z-Wave :-(
The intention is that this device will control the bathroom ventilation fan directly, so it does not need to communicate with our Home Control System (HCS) but, we would like to monitor and log temperature and humidity. To enable this we have set up some scenes that trigger when this device operates the fan and heating control device and then use socket layer comms to convey values and battery status back.
This devices uses three AA batteries and we use Duracell 'Ultra Power' Alkaline batteries. These typically last around 12 months. Batteries changed: 5th October 2013.
Basic trigger level configuration is done with the buttons on the device. We set the beep to off as we don't like our home automation to be intrusive, though this is useful for setup and testing.
The device supports two association groups, with a single node in Group 1 and up to three nodes for Group 2. Group 1 includes POWER_APPLIED, SENSOR_MULTILEVEL _REPORT, ALARM_REPORT an d BATTERY_REPORT_COMMAND, Group 2 includes BASIC_SET. Associations in Vera is under the Device Options tab. You create the Association Groups you need and add the the devices you want in the different groups. For the ST814 you need to create a Group 2 under the parent device and place the devices you want ST814 to turn on or off in this group.
We created a Group 1 as described in the manual, so that the device will send auto-reports to the Vera but this doesn't work from what we can see. The ST814 always reports that Node 2 is the one in this group regardless of what you enter in the field. To make auto reports work as described above, you need to delete Group 1 completely from the device.
I'm not sure where this stuff is documented but I discovered in the forums that you can set some device variables to change the behaviour of the ST814, as shown here. Var 7 means the device should report status every time the temp changes by 1ºC and Var 8 means the device should report status every time the humidity changes by 5%. The VeraLite does receive the auto-reports but, it doesn't update the dashboard to reflect this as they go to the master device and not the sub-devices, which display values on the dashboard.
Vera will not poll battery powered devices by default. The only way around this appears to be to schedule some Lua code to poll values from the device. Even if you did set frequent polling or short wake-up intervals the battery would be drained very quickly.
Scenes & Triggers
We created two scenes for this device called 'BathroomFanOn' and 'BathroomFanOff'. Theses are used purely to enable us to capture these events in our HCS log. Each has a trigger to run the scene. The 'FanOn' scene matches the trigger values entered in the ST814 to turn on the fan when humidity >75% and the 'FanOff' trigger also matches the trigger points in the ST814 and turns off the fan when humidity <70%. Both scenes use Luup code to send structured messages to our Home Control System (HCS) using socket layer comms.
We wired up this device to an old mains lead initially, to test it and configure it. To include the device you simply put the VeraLite in inclusion mode and press the recessed button on the front of the FGS221. For now, we have called the device 'Bathroom Switches' (Node ID 6 & Device ID 10) and called the two switches 'Bathroom Fan' (Device ID 11) and 'Bathroom Towel' (Device ID 12). We are thinking we might use the second switch for Z-Wave intelligent towel rail project. We were slightly confused when three devices appeared in the VeraLite UI, with on/off toggle switches. Our testing showed that in the VeraLite UI, the 'Bathroom Switches' mapped to the first switch (the 'Bathroom Fan'). Changes in state triggered by this element didn't immediately reflect back in the UI. To simplify things we pinned 'Bathroom Fan' and 'Bathroom Towel' to the dashboard.
Our testing showed that the ceiling fan in our bathroom needs upgrading. It takes far to long to bring the humidity back down to a reasonable level. The one currently fitted is an Xpelair Britex in-line 30W shower fan kit. It is rated at 58m³/hr and has a noise level of 36dBA at 3m.
Our ceiling fans have a permanent feed (to allow them to run for a time period after switched power is removed) and a switched feed to turn the fan on and off. This makes installation of the Z-Wave module easy as our Fibaro module can simple connect the permanent feed to the switched feed to keep the fan working.
We replaced the fan with a Vent-Axia ACM100 in-line fan. It is rated at 220m³/hr and has a noise level of 23dBA at 3m. This means a much greater air flow and reduced noise.
This is the fan set up with the Fibaro module and a switch to test various configurations.
Before we installed the new fan, we used the iPhone 'SPL Meter' app to measure the noise levels in our shower cubical. The ambient background noise level was about 30.0dB (central heating switched off) and we measured the old fan at 47.2dB. The noise level for this new fan has yet to be measured but, it is louder. It is not the fan that is making the noise but the induction roar. This thing is shifting some serious air! Probably too much in fact as it reduces the humidity very quickly and also keeps the humidity level much lower in the bathroom. Having tested the fan on its fastest setting for a while we swapped it over to its slower setting and this makes it quieter. It still shifts a lot of air and works very effectively.
Testing shows a slight issue with our configuration. This module is designed to toggle the relay when the manual control switch changes state. With single UK light (bi-stable) switch, this could look a bit odd, because a normal light switch also indicates a state typically (in at the top = off, in at the bottom = on). As it is acting as a toggle switch now, this is no longer the case and this could be a little bit confusing to users (intelligent home automation behaves as a typical user would expect!). To overcome this the Fibaro module can be configured to work with a monostable switch but this would involve changing the light switches to push button or momentary switches.
This is less of an issue with a pull-cord switch like we have in our bathroom, because it indicates no state (though it does feel and sound slightly different when operated). However, we have a 'fly in the ointment' in that the pull-cord switch also operates the light over the shower, in the normal on/off (bi-stable) way.
The Configuration options and variables for the Fibaro module are described in the supplied instructions. In the device settings we set Var 14 = 0 which tells it a monostable switch is connected. Operating our pull-cord switch twice quickly toggles the relay on/off (operating it twice slowly does not) but, this does not help us. Setting Var 14 to 1 tells it that a bi-stable (normal light) switch is connected.
The easiest option is to simply wire it in parallel with the ceiling fan. The problem with this approach is that the person using the shower will switch the light off over the shower as they leave and thus switch the fan off too. Not really an option.
Our preferred option works better from both a usability and functional perspective and it is to have the light manually controlled and the ceiling fan fully Z-Wave controlled and driven by the ST814 humidity sensor.
Life would have been so much simpler if we had 12V lighting and fans and then we could use diodes in the both the switched outputs (to implement the logical OR function), to have the fan come on with either the manual switch output or Fibaro module output. With mains voltages we have no ability to use diodes to implement this simple logic, and the manual switch would not switch off the lamp if the Fibaro module output was enabled :-(
We set up association on the 'Humidity Sensor' device (Device ID 8) and created a new Group 2. We then set this to Device ID 11 and breathed on the sensor to make it pass it's 85% humidity trigger. As the humidity crossed 85% on trigger level, the 'Bathroom Fan' switched on. As the humidity dropped below our 80% off trigger level, the 'Bathroom Fan' device switched off. This means that the VeraLite is not involved in the control process and doesn't need to be on for the bathroom fan to work as intended.
This device reports its status back instantly when the switch is activated manually or via another device. Again, we have written a set up some scenes to send notifications to our Home Control System (HCS) using socket layer comms.
The VeraMobile iPhone app shows this view of the FGS221 devices. It looks like the 'Bathroom Switches' toggle switch operates both relays together but, our testing shows this not to be the case.
Interfaces & Integration
The VeraLite user interface is well defined and based around UPnP.
We are confident that our main Home Control System (HCS) process can send out HTTP requests to run scenes and activate Z-Wave devices but, we are still working through the interfaces and exact details.
We would like our elements to feed back state changes into our wider Home Control System (HCS). In particular we are keen to understand how door contact sensors can send HTTP or socket layer notifications to other processes running on our HCS server. The most likely way to achieve this seems to be to have scenes triggered by the sensors. These can then have some LUUP code associated with them that makes an HTTP or socket layer request back to our Home Control System (HCS) processes.
Luup (Lua-UPnP) is MiCasaVerde's new software engine which incorporates Lua, a popular scripting language, and UPnP, the industry standard way to control devices. It provided a programming environment for scenes on the VeraLite.
Luup requests are documented on MiCasaVerde wiki. In addition to sending requests using standard UPnP, you can also do most things using a simple HTTP requests. As an example,
http://192.168.1.27:3480/data_request?id=user_data&output_format=xml returns the configuration data for Vera, which is a list of all devices and the UPnP variables which persist between resets as well as rooms, names, and other data the user sets as part of the configuration.
If the VeraLite can make HTTP requests (get web pages), then we have a method to pass information back to our Home Control System (HCS) processes.
Our testing shows that this approach works, so we could add the following line (as an example) to the Luup tab for a scene and call a web page that then sends a socket layer message to our chosen HCS process:
local status, result = luup.inet.wget("http://192.168.1.80/zwave/update.php?command=sometext", 5)
This is a method that works and enables socket layer communications with our other HCS processes, even if it is a bit circuitous.
There is a easy way to run scenes on the VeraLite as described on the UI Notes Wiki. The following URL will run the scene numbered 19:
It is also possible to control devices directly and in our experience, this is quicker than doing it via scenes. The following URL is used to turn our hall light (via a Fibaro FGD211 module):
Socket Layer Communication
Direct socket layer communication is our preferred method of interfacing the VeraLite to our Home Control System (HCS) processes, since this is the method that they are based upon. We were not sure what level of support the VeraLite has for socket layer communication, so we have asked the question in the MiCasaVerde forums and the LuaSocket library is supported. This is really good news!
This is an example of the working code we have used in our scene Luup tab:
local socket = require("socket")
host = "192.168.1.xx"
c = assert(socket.connect(host, 4488))
This is really made our life a lot easier and means we have two-way communications and integration of Z-Wave technology in to our existing Home Control System (HCS), by using scenes and by directly controlling devices via our hardware abstraction layer.
Get the system configuration:
This URL provides a live log view on the VeraLite:
The ability to do socket layer comms on the VeraLite has opened up the device and allows us to implement some very neat features.
Battery Powered Devices
Some of our Z-Wave devices are battery powered and this has a number of implications. Battery powered devices do not relay messages through the mesh network, as they go into a 'sleep mode' to conserve battery power. The battery is also a weak spot in terms of long term reliability. Fortunately, all of devices we have used so far can report battery level in their status updates.
Our plan is to collect this information in the VeraLite on each trigger event and to send it as to our Home Control System (HCS) using socket layer comms. These events and battery levels will then be logged in our HCS log, so we can monitor how long they are lasting. In addition, we can also send out warnings if they get below a certain level and plan to do this using SMS messages from our Home Control System (HCS).
We have made huge progress in less than a week and are now close to completing this project, having met all of the objectives we set at the start. This alone says a lot about the quality of the Z-Wave protocol/standard and the associated products available from a large number of manufacturers.
As much as MiCasaVerde would like potential customers think the VeraLite is a simple and easy way to automate your home, our experience so far shows that this is thin veneer and the reality of a complex Z-Wave implementation requires research and knowledge, to work through the issues likely to be experienced. And this is based upon our relatively simple set up. We can envisage that attempting full home automation using Z-Wave technology would be a time consuming and frustrating experience for both novice and technical users. There is little documentation provided but there is a lot of information on the Internet, if you know where to look.
That said, the technology appears to be both powerful and reliable. The two-way communication is a key part of this and enables confirmation that requests have been actioned. Despite having to do lots of reading and quite technical configuration, we have made rapid progress. More importantly, we have met all of our objectives with this project now. There is definitely a place for Z-Wave in our next home based on what we have seen and experienced so far.
The ability to perform socket layer communications via scenes has enabled a good level of integration with our existing Home Control System (HCS). This was a key risk for us with this technology but our considered approach and adoption of the VeraLite gateway seems to have paid off. The support services and the developer community have been a key factor in this too.
Some other things we have learnt from this project:
- Z-Wave technology can be used as part of hybrid home automation system like ours and although we would always chose wired over wireless technologies, there are times when a wireless network is required or can make things so much easier.
- We can log battery status and we will be keeping a keen eye on the devices to see how battery life is affected by various configuration settings.
- One thing we have learnt from installing these kinds of devices is that in our new house build, deep wall/pattress boxes (~45mm) are the best option.
- Z-wave enabled light switches also now become sensors that could trigger the alarm system if it is active.
- If you are going to use mains lighting, then make sure you run live, earth and neutral to every switch box.
We are not necessarily recommending that people use Z-Wave technology as we have done in this project. There are simpler and cheaper ways to have a bathroom fan controlled by a humidity sensor! We would always choose a wired approach given the choice. It has been a useful way to test out the capabilities and reliability of this technology though in our current home.
We have had months of rain this year and it has raised the ambient humidity up to around 72%, sometimes higher. To avoid the bathroom extractor fan coming on when not required, we modified the humidity ON value to 80% and the humidity OFF value to 75%. This seems to work just as well and has the advantage that the fan doesn't seem to switch on and off quite as much.
5th October 2013
Received an SMS message from our Home Control System (HCS) this morning to warn us that the battery level in our Everspring ST814 temperature and humidity sensor has reached 30% and needs to be changed.
1st October 2014
The firmware upgrade from UI5 to UI7 on our Vera Lite appears to broken the associations. This is quite likely, given that it also changed some of the device IDs.