Control Smart Home Features with (Satechi®) Bluetooth Button

Sometimes you need another button to control one specific feature in your smart home where no button/control element had been planed. Naturally, digging holes through existing walls in order to lay a new cable is not an option in most cases. I faced this scenario when trying to add another doorbell to my front door. I quickly came up with the idea to use a Bluetooth device to send a signal to some kind of controller – a Raspberry PI in my case – and trigger my KNX-based bell from there.

satechi_bt_home After doing some browsing, I decided to use a Satechi® Bluetooth Button, type Home. It looks quite nice, without any fancy design, and comes with a 3M sticker, so you can put it nearly everywhere. Unfortunately, my existing R-PI (controlling most parts of my KNX installation) was out of range, hence I had to set up a new one for the sole purpose of reacting to the Bluetooth device. The new R-PI then calls a small REST service on my old R-PI, which then triggers the door bell via a signal on the KNX bus.

bluetooth-r-pi-knxHere is a quick list of steps that I took in order to get my new door bell running:

  • Connect R-PI with Bluetooth to my home WIFI network
  • Connect/Pair Bluetooth Button to R-PI using bluetoothctl command (how to)
  • Run a small script to watch for Bluetooth connections using bluetoothctl
  • Upon connection: Call REST service in KNX R-PI

I can confirm the Satechi® Buttons to work flawlessly with the Raspbian OS installed on my PI. Of course, there is a little delay between pushing the button and the bell to ring due to the latency of Bluetooth and WIFI. However, it is quite okay for this scenario. I am pretty sure I will use the same set up for further controls, such as a central off (when leaving the house).

Advertisements

Controlling Home Automation via Telegram Bot

We have been moving to a different house with a KNX-based smarthome installation lately. I have spent quite some time coming up with my own visualisation and automation, mainly using a Python implementation relying on the KNXD (a fork of the well-known EIBD) software for Linux.

When I read about the new Telegram API for Bots, I got excited about the idea of creating a bot for my home automation installation. Using simple commands, I wanted to switch on/off lights, control the temperature, get status messages …

telegram_knxd

Using the Telegram documentation and my PI-based main KNX controller, it was quite easy to come a with a first prototype, which I can use to switch on and off devices. The screenshot is in German, but you can basically see how I use it to switch on my lights and some outlets. More advanced commands will follow soon. Since I have a smart watch (LG Urbane) which I can use to send Telegram messages via voice input, I can even use it as a voice-to-KNX interface without developing a special (watch) app, just relying on existing technology. (Unfortunately, I am cannot start a new chat with my bot for now, but this is a problem of the watch’s OS.)

I am quite happy with this first version and can’t wait to enhance it. Also, I am considering using this “human to machine interface technology” in enterprise/business apps. What do you think?

 

Install KNXD on Raspbian (8)

I am currently in the process of planning the KNX set up for our new home. I have decided to use a Raspberry PI 2 (Model B) with Raspbian OS for the more fancy stuff, such as visualization, logging of measured values, automatic jobs etc. Communication with the KNX bus will be handled by KNXD.

The KNXD git hub page offers a small shell script that can be used — in theory — to install the software on Debian based system (Raspbian is based on Debian). Unfortunately, a few packages are missing in the requirements section (apt-get install).

I have added these packages creating a new version of the KNXD install script specifically for Raspbian OS. My PI runs on Raspbian 8, however, it should work with other releases as well.

#!/bin/bash

# first, install build tools and get the source code
sudo apt-get install git-core build-essential debhelper cdbs autoconf automake libtool libusb-1.0-0-dev libsystemd-daemon-dev dh-systemd
git clone https://github.com/knxd/knxd.git

# knxd requires libpthsem which unfortunately isn't part of Debian
wget https://www.auto.tuwien.ac.at/~mkoegler/pth/pthsem_2.0.8.tar.gz
tar xzf pthsem_2.0.8.tar.gz
cd pthsem-2.0.8
dpkg-buildpackage -b -uc
cd ..
sudo dpkg -i libpthsem*.deb

# now build+install knxd itself
cd knxd
dpkg-buildpackage -b -uc
cd ..
sudo dpkg -i knxd_*.deb knxd-tools_*.deb