Skip to main content

Posts

Sending SMS Messages from openHAB

Background So I setup sending SMS messages from my Raspberry Pi (see article I wrote here ) and have a bash script to automate this. The next step is to integrate this into my openHAB server, so I can send SMS messages to my mobile phone when my UPS system (managed by openHAB) is on battery power (e.g. due to a mains network failure). Installing the EXEC Binding to openHAB See here . Note especially the requirement to add commands to the whitelist. Adding a Thing to openHAB Once the EXEC binding is installed the next step is to setup a thing file to use the binding for sending bash shell commands:  $ nano /etc/openhab/things/exec.things Add the following line: Thing exec:command:sendsms [ command="/usr/local/bin/sendsms.sh %2$s", autorun=true, interval=0 ] Save the file. As you can see this thing is used to pass the command to run the bash shell script to send an SMS and pass the text sent as "%2$s" to the script. Adding Items to openHAB Two items are required, one...

SMS messaging on Raspberry Pi with Gammu

Background Ever wanted to be alerted when the power fails at home? I typically worry that food in the freezer will go off when I am on vacation! (Yep, that's how I tick). I have recently installed a UPS system which I use to protect various IT and network devices from instant power loss, enabling them to shutdown gracefully. This is particulary important for my Raspberry Pi (Pi) devices, which are sensitive to this issue, as SD-Cards can be corrupted and then not re-boot.  The UPS I have installed interfaces via USB with my Raspberry Pi server using the Linux Network UPS tools NUT so that I can monitor status changes (e.g. grid power loss) and this is further integrated into my openHAB -based home automation system. This setup will be covered in another post.  I wanted to additionally be alerted when grid power fails via SMS to my mobile phone. To do this I have purchased a pre-owned USB Internet Surf Stick and a pay-as-you-go SIM card (zero cost) which I can load with credit...

Useful Raspbian Linux Commands

Return the octal file permission value for a file or directory stat -c "%a %n" * Replace * with the relevant directory or the exact filename that you want to examine. From the man page of stat , -c --format=FORMAT use the specified FORMAT instead of the default; output a newline after each use of FORMAT %a Access rights in octal %n File name Usage: With files: $ stat -c "%a %n" ./Documents/Udev.html 664 ./Documents/Udev.html With folders: $ stat -c "%a %n" ./Documents/ 755 ./Documents/

Installing AeonLabs Z-Wave Stick on a Raspberry Pi openHAB server

Background This guide is for  installing an AeonLabs Z-Wave Stick Gen5 usb stick on a a Raspberry Pi and integrating it into the openHAB home automation server for controlling Z-Wave devices. Steps Install Z-Stick on Raspberry Pi USB port - powered hub is desired The Z-Wave Stick is automatically detected without additional software installation. Correct detection of the USB stick can be verfied with the  lsusb  command: pi@raspberrypi /usr/share/openhab $ lsusb Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 008: ID 0658:0200 Sigma Designs, Inc. Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB Bus 001 Device 005: ID 045e:00f5 Microsoft Corp. LifeCam VX-3000 Bus 001 Device 006: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB The “Sigma Designs, Inc.” device is the Z-Wave USB stick. Now we ne...

Configuring openHAB on Rasberry pi

General Configuration - openhab.cfg The runtime comes with one core configuration file, the file  openhab_default.cfg . The purpose of this file is to define all basic settings, such as IP addresses, mail server, folder locations etc. The file also contains settings for all (optional) bindings. These settings are automatically dispatched to the according binding. For this, all settings come with a namespace (such as "mail:" or "knx:") to identify the associated binding. First thing after unzipping the runtime should be creating a copy of  openhab_default.cfg  to  openhab.cfg .  cd /usr/share/openhab/configurations sudo cp openhab_default.cfg openhab.cfg sudo nano  openhab.cfg All personal settings should always only be done in this copy. This ensures that your settings are not lost, if you unzip a new version of the runtime to your openHAB home directory. The  openhab_default.cfg  file comes with extensive comments which ex...

Install openHAB on Raspberry Pi

Background This guide will enable you to install openHAB on Raspberry Pi computer. Steps Install Java if 1.6 or higher is not already installed. The following will display your current Java version: java -version   Add the openHAB Bintray Repositories key to the apt-keyring  usin g curl: curl 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add - Add openHAB apt repository to the apt sources list (Note: the current openhab.list file will be overwritten) echo "deb http://dl.bintray.com/openhab/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/openhab.list Resynchronize the package index sudo apt-get update Install the openHAB runtime sudo apt-get install openhab-runtime If you have more than one OpenHAB binding with a USB device (Z-Wave, RFXCOM, etc), refer to  symlinks Start openHAB - manually sudo /etc/init.d/openhab start sudo /etc/init.d/openhab status Start openHAB - at system startup sudo update-rc....