Skip to main content

Posts

Showing posts with the label openhab

Integrating NUT into openHAB

  Background This article describes the steps necessary for integrating a NUT installation on a Raspberry Pi into openHAB for a GreenCell USB UPS. For setting up NUT on a Raspberry Pi see here . Install openHAB Network UPS Binding For details of the Binding see openHAB documentation  here . Log into the openHAB Web Console as Administrator. Click on Settings: Select Bindings: Select the Binding "Network UPS", you may need to click on "Show xxx More" in the list under the heading " openHAB Distribution" : Click on "INSTALL" (here is shown "REMOVE" as I already installed it). Once the binding has been installed click on Things: Click on the Add icon in the bottom right hand corner of the page:  Click on "Network UPS Tool" in the list of "Choose Binding": Click on "Network UPS Tool Thing" in the list of " Add a new Thing: networkupstools ": In the following screen input values for "Location...

Sending SMS Alerts for UPS in openHAB

  Background So after setting up sending SMS messages from my Raspberry Pi (see article here ) and integrating this with my openHAB server installation (see article  here ) the next step is to setup an openHAB rule to send me an sms text when the UPS switches to battery power, and then again when UPS mains power is restored. Adding rules to openHAB A rule is required to pass a message text via the smstext and smssend items. The sms.rules rules then trigger an SMS text to be sent to my mobile phone.       $ nano /etc/openhab/rules/ups.rules Add the following lines: rule "Power outage" // set SMS text to be sent by ups.rule when the power switches to battery on mains loss when     Item ups_status changed from "OL" to "OB" then     logInfo("UPS:", "UPS has switched to battery power") smstext.sendCommand("UPS: mains power outage") end rule "Power returned" // set SMS text to be sent by ups.rule when the power switches ...

Controlling 433Mhz Power Sockets from openhab - sweat and tears!!!

Background Ok so I have setup openhab2 on my Raspberry PI2 as a server running on Rasbpian Jessie. One component I have added is a cheap set of 433Mhz switchable power sockets (from Unitec). I added the 433Mhz transmitter to the GPIO pins on the Pi (system is only unidirectional, so no status information is sent from the sockets) and installed/compiled WiringPi from this great source . Setup Using the sniffer I found the RF codes (see openhab items below) for the sockets I had. I created a BASH shell file called rf_send.sh in the same directory as Integrating the code to fire the RF commands to the sockets for on/off via Openhab 2 as follows: Default.Items File: // Unitec 433Mhz Socket Switches Switch  U433_Switch_Socket_1   "Door Light"         (Lights, Lounge)  { exec="ON:/usr/share/openhab2/bin/rf_send.sh 15, OFF:/usr/share/openhab2/bin/rf_send.sh 14" } Switch  U433_Switch_Socket_2   "TV Lig...

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...

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....