Skip to main content

Posts

Showing posts from February, 2022

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"

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  4096   Jan 11 00:49 .

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 Light"          (Light, Lounge)  { exec="ON:/usr/sha