Home Automation with Logstash

Home automation is a big dream of mine – I’d like to live in a house which makes living just that bit easier… which thinks ahead for me.  First step before automation is data acquisition – the house can’t make any reasonable decisions if it is not self-aware, so I’ve started kitting out our house with sensors.

The hub (home automation system)

As a hub, and home automation software I’ve taken a Raspberry Pi mini computer (about 50EUR) and installed FHEM (a perl home automation software).  I got the COC from Busware (CC1101-OneWire-Clock extension for Raspberry Pi which can send/receive on 868MHz –  65EUR), and the JeeLink (also 868MHz, but for communicating with PCA301 devices 32.50EUR).  I got some radio controlled power switches (FS20 ST-4 and PCA-301 (which also measures power usage at the socket))

Thoughts

Security

There are a lot of products available, but very few which offer real security.  By security I mean “the device I’m controlling can only be controlled by the system” – if anyone were to sit outside our house with the same equipment I have, they could read all the values, and switch any switches without a problem… so I won’t be attaching anything important devices to it any time soon…

Fail-safe

Even without any malicious intent, a thermometer failing could cause the heating to go on full, or allow a house to freeze up (unattended) in the winter… there’s a lot of safety implications which need to be thought out before blindly automating your house.

Efficiency

The sensors and RPi etc. all consume electricity and batteries, but their consumption is so minimal in comparison to the savings possible.  In our household alone (two families in one house) we consume about 5000EUR/year of electricity, water and heating oil… a 10% reduction could pay for a lot of hardware and electricity for an intelligent household.

Big Brother

As with all the NSA scandals, meta data is king.  Even if you don’t have personal tracking (RFID chip implanted into every resident…) within the house, or motion sensors, you can infer a lot from a little data: most devices have unique power signatures making it easy to identify if a washing machine or dish washer was turned on, a meal was cooked, or just a cup of tea, or tea for two… a rise in humidity in a room can mean human presence… and the combination of these keys can pretty accurately paint a picture of who is home and what they are doing.  The danger is that once this information is available, and accessible (which it has to be to perform any useful optimisation…) it could also be used for evil…

What do the results look like?

Here’s some screenshots from the Kibana web frontend

 

Power usage for my desk for a week

Power usage for my desk for a week

Household power consumption over a week

Household power consumption over a week

Temperature in two rooms for a day

Temperature in two rooms for a day

Here’s some slides from a presentation I did at Munich Perl Mongers recently


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 Responses to “Home Automation with Logstash”

  1. Hi Robin,
    I have come across your very interesting website. I am struggeling to configure the ELK stack to process standard FHEM device logs through Filebeat (on client, for delivery), Logstash, Elasticsearch for viewing via Kibana. Believe the issue lies with the the Logstash Filter Settings. I have tried to define one via GROK but could not succeed. Are there any examples which you could share?
    Many thanks and kind regards
    Udo

  2. Hello Udo,

    Glad to hear you’re getting some use out of it! :)
    Here are my current grok patterns for the fhem output. If you have any trouble, let me know and share your configuration with some sample data in a gist.

    Cheers,
    -Robin-

  3. Hi Robin
    Thanks a lot!

Leave a Reply