Integrating Home Automation & Alarm

I have been thinking lately about improving my approach to home automation, and particularly in making better use of the various technologies I’ve got. I think one of the mistakes made in home automation generally is neglecting the ‘automation’ part. I’ve seen plenty of approaches which really just substitute one set of switches for another (albeit electronic). I can’t see much point in in switching lights on and off using a phone or remote when it’s much easier to do so using the light switch! So really what you want is a largely automatic system which anticipates your needs and does what you want without user intervention.

So far as I have written about before I already have a mixture of systems with MAX for heating (currently controlled using FHEM) and Z-Wave for which I have been using a Vera Lite. I have been using a 3rd party plugin which provided an interface between the Texecom panel and the Vera, but in spite of this I’ve never been that happy with it as a controller. The interface is rather old fashioned, the newer updates (so called UI7) have had a decidedly mixed reception and I’ve never really felt I understood how to program it properly. Whilst the UI looks pretty it was also rather clunky when you tried to use it.

I’ve written before about FHEM and whilst I know it’s not everyone’s cup of tea I have really got to like it because although it looks unappealing it gives you a huge amount of information and lets you do pretty much anything you want with a few command lines. I also think that it helps you understand a lot more about the devices you are using. So the obvious thing to do was to bring all my Z-Wave devices into FHEM and try to integrate heating and lighting and also build integration with the Texecom panel.

The key to all this is a USB Z-Wave adapter for my main server. These don’t come cheap and there is some choice. I eventually bought an Aeotec Z-Stick Gen5, which came recommended but pretty expensive at about £40.

aeotec-z-wave-usb-z-stick-526

 

There are others available, including the Z-Wave.Me UZB which seems rather cheaper. This should also work with FHEM and other software although the Aeotec seems slightly better established. The other and much cheaper option is to use an experimental method whereby CULFW devices can be set up as Z-Wave controllers. However this lacks some of the benefits of the proper controllers (including battery back up etc) and probably is not for ‘production’ systems just yet.

So far all has gone well. FHEM recognised the controller and configured it correctly. I had to ‘exclude’ all the devices from the Vera to reset them and then ‘include’ to the Z-Stick. You can do this either by physically taking the stick to the device and pressing the button on the stick, or else simply setting the Z-Stick into ‘inclusion mode’ from FHEM and then doing whatever is needed on the device.

I would recommend doing the latter, as then FHEM will automatically pick up and configure the devices for you. I now have a variety of Fibaro devices and a Minimote which are all available as devices in FHEM with a lot of detail about them. I have recreated a few scenes which I was using before (such as one which turns on a few table lamps in the front room).

Now I need to find a better way of integrating with the alarm. I am using an Arduino with one of the outputs from the panel to report whether the alarm is set or unset and therefore whether the house is occupied or not. I’m using this at the moment to trigger a ‘notify’ event in FHEM which sets the heating into low power mode and now sends Z-Wave events which turns off all the lights. What I would really like is to get FHEM to interface directly with the panel to read out the status of the sensors etc directly. I have been able to get some information about this so I am going to see if I can learn how to do this.

As always I’d be very interested to hear from anyone else who is exploring this kind of thing.

Advertisements

Using Fhem for Heating Control

Having discussed in previous posts my hardware approach to heating control I’ll now talk about the software.

The key to the whole system is FHEM which is a real discovery. As I’ve found before with the hardware, the Germans seem to have really got to grips with home automation. This system is open source and very mature, having been around for quite a long time and now being up to version 5.7. The problem is that at least initially it doesn’t appear particularly accessible or easy to use, but this is rather misleading. With a bit of effort invested you can get the system working well and it is incredibly flexible.

There is a good community supporting it, although it is predominately German speaking. Most of the documentation is too, but Google Translate has proved very helpful in navigating the forums and the wiki .

I won’t go into the basic setup, but you will need some kind of server (I am using a fairly old but extremely useful HP Proliant Microserver) and a suitable operating system. There are various ways to install Fhem which are detailed on the website and elsewhere.

So once you have a working Fhem system you can access it via a local URL and then the fun begins!

The basics are to get the interface installed and working. Fhem does have automatic mechanism for detecting and installing devices, which is based around a set of configuration files, they key one being fhem.cfg. In my case I am using a CUL device (as in previous posts) but there are various other ways of doing it. Some people have used the official MAX controller although it’s not much cheaper than the CUL and some difficulties have been reported. There are some other ways of getting CUL firmware onto cheaper devices but I haven’t explored these as yet.

What I really like about Fhem is that its basic structure supports a whole range of different devices (see the documentation for details) but it has a common approach to dealing with them. Also, whilst it is mostly based on configuration files the standard front end UI whilst basic is very effective.

So once you have a basic Fhem system up and running and your CUL or equivalent device has been detected – what next?

First thing to do is register all the MAX devices and pair them with your system. You will need to do this using the ‘learn’ mode on the devices and also by setting the CUL device to listen out for new devices.

You can do this by selecting ‘pairmode’ on the Fhem screen for the CUL device:

pairmode

This then sets it to listen for a short period of time, and you then need to set the devices to pair. What exactly you do depends on which device you have, and you’ll need to check the instructions. However, for most of the thermostats I think you have to hold down the ‘boost’ button for a few seconds and then it begins a countdown, which stops again once the pairing is complete.

You will then see the MAX devices appearing in your Fhem screens. The screen for each looks something like this:

maxscreen1maxscreen2maxscreen3

This screen demonstrates the strengths and weaknesses of Fhem, depending on who you are. For me this is great – lots of details, loads of options to play with etc. On the other hand you might think it looks overcomplicated and intimidating… in which case this probably isn’t for you.

All Fhem devices have settings (via the ‘set’ button at the top) and the pick list shows you what variables you can set. The ‘readings’ section shows the enormous amount of data you can extract from what is in reality quite a simple device. This includes the weekly ‘profile’ for each device – ie the combination of settings and times throughout the week. This is different for each individual thermostat which is good from a flexibility point of view, but not so good for consistency and ease of programming. There are solutions to this which I will come to in future.

So you should now be able to pair up all your thermostats, and the Fhem screens will allow you to see the measured temperature and make some changes. However, this isn’t much of a control system on its own and I’ll come to what I’ve done to tie it all together in future posts.

I know I’ve kept this quite general but please post comments or questions and I’ll try my best to answer them. There is a lot of info on the Fhem forums / wiki which are a good place to start if you are stuck.

Boiler Control using MAX hardware

So now I’ve got a number of MAX radiator valves around the house which are linked up to FHEM which is providing some monitoring and control. I’ll go into some more detail on the software side in another post. However, I realised that the amount of value that you get out of this system is pretty limited unless you can find a way of controlling the boiler.

Most of the other systems like this which I have seen do have some form of relay or control (sometimes called a ‘boiler interlock’) so that the individual zones can ‘call for hear’ and similarly the boiler shuts off automatically when heat isn’t required. Without this all you have is some fancy valves but the boiler control is still only by a basic thermostat or timer.

Unfortunately, there is nothing available in the MAX range which does this. This seems to me a major omission as all the others do (FHT, HomeMatic, evoHome etc). I had a bit of a problem, as I needed to be able to address the relay via FHEM on the computer, but the CUL device can only be used in one mode at a time. So if I wanted to use a relay from a different system (eg HomeMatic) I would need to have a second device to do so which will obviously cost a lot more.

I thought about this a lot because I really didn’t want to spend a lot of money on this and I didn’t want to overcomplicate matters. After a bit of digging around I found this:

max-zwischenstecker-v-web-a528e9e5

This is one of the MAX products (details here ) although it is a little obscure. To be honest I’m struggling to work out when exactly anyone would use. It is basically a switched mains plug just like many which you find in home automation systems. However it is designed to work as part of a MAX system. So far as I can make out from the documentation it is supposed to be used with electric heaters or pumps that plug in to the wall. I’ve never seen anything quite like that… but maybe they have them in Germany.

The good news is that because it is a MAX device I can address it from FHEM without using any additional devices. However it wasn’t immediately obvious how I would use it to switch my boiler directly, which used a 240V switched circuit which normally goes to the thermostat. I had a few ideas, including stripping the whole unit down and somehow wiring the relay in directly and whilst I did get the board out to have a look there was no obvious way of doing this. The fact that it uses a European plug (aka Schuko) is another obstacle.

So I considered a few options, including buying a Schuko socket to plug it into. However as above I was trying to keep the costs down and keep it simple. My boiler already has main supply to the existing thermostat receiver so it’s fairly easy to wire things in. So what I have ended up with is starting with a UK socket, then an adaptor, then the switch unit, and then an older shaver plug with a flying lead.

The other end of the lead goes to a huge and rather OTT mains relay which I got for a few pounds from ebay:

1223200123

Luckily it fits quite nicely into a blanked off single switch box, with the wires poked in through a hole in the bottom and fixed to the screw terminals on the base. The output from the flying lead on the switch goes to energise the coil, and the output contacts are wired to the thermostat input. So I’m using a mains relay to switch a relay to switch the boiler on! It’s a bit convoluted… but it works!

The end result in the boiler cupboard looks like this:

IMG_20160104_220538

So a little inelegant perhaps… but I’m happy with the result.

In FHEM it can be configured as a MAX thermostat (so it appears exactly the same as one of the radiators) but it can be switched on and off by sending an ‘on’ or ‘off’ command to it.

I’ll cover the FHEM configuration in a bit more detail in the next post