Skip to main content

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 Light"         (Light, Lounge)  { exec="ON:/usr/share/openhab2/bin/rf_send.sh 7, OFF:/usr/share/openhab2/bin/rf_send.sh 6" }
Switch  U433_Switch_Socket_3   "Sofa Light"        (Lights, Lounge) { exec="ON:/usr/share/openhab2/bin/rf_send.sh 11, OFF:/usr/share/openhab2/bin/rf_send.sh 10" }


Note

Comments

Popular posts from this blog

Setting up NUT on a Raspberry Pi for Greencell USB UPS

  Background This article provides a guide for installing a USB UPS attached to a Raspberry Pi. In my case I had purchased a GreenCell 600 360W USB UPS. Integrating the USB UPS requires using NUT (Network UPS Tools). This UPS uses the blazer_usb driver. Installation NUT Plug-In the UPS USB-Connection to the host. My device showed up as Device 006 below: # lsusb   Bus 001 Device 006: ID 0001:0000 Fry's Electronics MEC0003 Bus 001 Device 005: ID 0bda:0309 Realtek Semiconductor Corp. USB3.0-CRW Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub Install the NUT package with the apt package manager:   sudo apt-get install nut Make some configurations and changes in the nut directory /etc/nut: # cd /etc/nut drwxr-xr-x 2  root nut  40...

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

Setting up Calibre Web on Raspbery Pi

Install Calibre Web Install pip and also venv for the python version: $ sudo apt install python3-pip python3-venv Go to the folder where you want to install Calibre-Web, e.g. /opt/calibre-web Create virtual environment for calibre web in folder venv $ python3 -m venv venv Install dependencies by running  $ ./venv/python3 -m pip install --system -r requirements.txt Download and extract Calibre-Web into the current folder (in this example /opt/calibre-web, need to create this directory tree) $ pip install calibreweb Starting Calibre Web To start Calbre Web manually execute the command: $ cps To open Calibre Web web application open your web browser and enter the URL http://<server>:8083 where <server> is either the host name or the ip address of the server running Calibre Web. Login with default admin login Username: admin   Password: admin123 Configuring Calibre Web Set the location of the Calibre database to the path of the folder where the Calibre library (metadat...