Menu

Skip to content
Sytone's Ramblings
  • Home
  • About

Sytone's Ramblings

the occasional posts of a guy who plays with technology

Category: General

Setting up Mosquitto on your Pi as part of the home hub

Posted on October 25, 2015 by Sytone

To enable all your nodes to communicate we are using a protocol called MQTT, on the pi we are using Mosquitto as the broker to support this. The broker allows nodes to publish information or subscribe to get information when it is published.

MQTT uses simple channels to dictate where messages go, here are some examples:

HOME/Garage/DoorOne/State
 HOME/Garage/DoorTwo/State
 HOME/Garage/Temperature

The structure of the channel is up to you, just keep it short and logical! In these articles I will have them set to how I like them, feel free to change them as you need. To install Mosquitto on your Raspberry Pi run the following commands.

sudo apt-get install mosquitto mosquitto-clients

Now you have it installed lets test it to ensure it is working. You can do this in a few ways but I’m going to use mqtt-spy. Head to the github site and download the latest version (0.3.0 at the time of writing). Once you have it open it up and ensure a default configuration is created.

Now you can add in your nice new broker. In the connections menu select new connection. The Server URI is the IP address of your Pi running OpenHab. To get this if you do not have it run ifconfig in a SSH session. Click on Apply and the Open the Connection.

If everything is good you will have a new green tab at the top of the window, this is the connection to your Mosquitto broker instance. Right click on the tab and select Show Broker Statistics to see the $SYS channel and data. This is a good indication of traffice going to and from the broker and you have a connection up and running from another machine.

To test subscribing and publishing make a subscription to test/my/channel in the new subscription section and press enter. In the publish section enter test/my/channel as the topic and Hello World as the data (what else…). Press publish and you will see it turn up in the subscription you just made.

mqtt-spy is a handy tool to have around so keep it in your home automation toolbox.

You now have Mosquitto installed and running on your system. Next we need to configure OpenHab to work with MQTT to send and receive messages.

Share this:

  • Email
  • Print
  • Reddit
  • Twitter
  • Pocket
  • Pinterest
Posted in General | Leave a comment

Setting up a Pi with a NRF24L01+ Radio

Posted on October 25, 2015 by Sytone

I’m using my PI as the central hub running OpenHAB, a MQTT broker and other services for home automation.

On the Pi I am using a NRF24L01+pa+lna SMA Antenna Wireless Transceiver, this provide more range (1000m) from my main unit. All the nodes in the network will be running on Arduino chips and using a Mesh network so the house should have good coverage.

First, wiring in the NRF24L01 to the Pi.Using Female-to-Female dupont cables use the following table to connect the units, the NRF24L01 is ~3-3.6V.

Raspberry PI 1 – B+ to NRF24L01 Mapping Table

Raspberry PI 1 – B+ NRF24L01+
 Ground (20)  GND
 3v3 (17)  V+
 BCM 8 /CE0 (24)  CSN
 BCM 22 (15)  CE
BCM 10 / MOSI (19)  MOSI
BCM 11 / SCLK (23)  SCK
 IRQ
BCM 9 / MISO (21)  MISO

I recommend checking the connections twice. A good Pi Layout can be found here: Raspberry Pi GPIO Layout Worksheet

Now we have the wiring in place time to get the pi working. This assume you have followed guides on this site or other site and you are running rasberian. As I am using the awesome work by TMRh20 we are installing the bits in his github repo.

Connect to the pi using SSH and run the following commands.

wget http://tmrh20.github.io/RF24Installer/RPi/install.sh
chmod +x install.sh
./install.sh
for D in *; do echo "Building and Installing $D"; cd "$D"; sudo make install; cd ..; done

After you run the installer.sh file it will prompt you to install components. Go ahead and select yes for all of them. If you ever need to do a update of the libraries in the future you will need to delete all the folders under rf24libs.

Now the pi is ready to go with the RF unit and needed libraries.

Share this:

  • Email
  • Print
  • Reddit
  • Twitter
  • Pocket
  • Pinterest
Posted in General | Leave a comment

Rooting the WINK Hub with Windows

Posted on February 13, 2015 by Sytone

I do have a Linux machine in the house but that is on a Pi running as a squeezelite client for my house music collection. So looking at the instructions on the web I have translated them for use in Windows. Of course I have use PowerShell! The only addition I have is I use Kitty as a SSH client. This uses the approach @ http://www.dinnovative.com/?p=348

  1. Open up the box and plug in the WINK unit. Do not download any app or hook it up to the internet. If you do this the latest firmware will overwrite the ability to do the hack below without popping open the case and hitting the chip directly.
  2. When you have the pink flashing light open a laptop and connect to the WINK wireless network. It starts with WINKHUB….
  3. Open a browser and go to http://192.168.0.1 and you should see home page or a download prompt for a JSON file. If so all good!
  4. Open up a PowerShell instance.
  5. Run:
    Invoke-WebRequest -Uri http://192.168.0.1/set_dev_value.php -Method Post -Body @{nodeId='a';attrId=";dropbearkey -t rsa -f /root/.ssh/winkkey.dbprv.rsa > /root/.ssh/winkkey.rawpub.rsa;"}
    Invoke-WebRequest -Uri http://192.168.0.1/set_dev_value.php -Method Post -Body @{nodeId='a';attrId=";dropbearconvert dropbear openssh /root/.ssh/winkkey.dbprv.rsa /var/www/winkkey.rsa;"}
    Invoke-WebRequest -Uri http://192.168.0.1/set_dev_value.php -Method Post -Body @{nodeId='a';attrId=";grep ssh /root/.ssh/winkkey.rawpub.rsa > /root/.ssh/authorized_keys;"}
    Invoke-WebRequest -Uri http://192.168.0.1/winkkey.rsa -OutFile winkkey.rsa
  6. You now should have the rsa key locally. If you are using kitty/putty you need to get putty gen and open the rsa file up and then save it as a putty version of the key. You can then open up putty/kitty and access the WINK hub.

Reference Links:

  • http://www.rootwink.com/index.php
  • http://arahuman.blogspot.com/2014/11/how-to-root-your-wink-hub-step-by-step.html
  • http://www.dinnovative.com/?p=348
  • https://winkhubroot.wordpress.com/
  • http://forum.xda-developers.com/general/off-topic/wink-hub-root-t2969205

Share this:

  • Email
  • Print
  • Reddit
  • Twitter
  • Pocket
  • Pinterest
Posted in General Home Automation | Tagged hack Home Automation PowerShell winkhub | Leave a comment

Post navigation

  • Older posts
  • Newer posts

Tags

API autohotkey Binding c# cache Content Deployment development engineering forge Games General Gnomoria hack Home Assistant Home Automation hosting ISO ISY JSON libraries Microsoft Microsoft Flow minecraft MoCA mod network openhab outlook paper PowerShell REST Security SharePoint site SQL toodledo troubleshooting Tweak Visual Studio Visual Studio Code windows 7 Windows 8 Windows Phone winkhub XAML

Recent Posts

  • iPhone hotspot issues? Getting it to work with windows.
  • Getting a DietPi image running on Hyper-V
  • Getting HP Officejet Pro 8620 scan to network working…
  • Developing Home Assistant on Windows using the Subsystem for Linux
  • Using Microsoft Flow with Home Assistant

Recent Comments

  • Shrabean on Automating OneNote with AutoHotKey to be a Journal V1.1
  • danbutter on Integrating ISY into OpenHAB
  • Sytone on Integrating ISY into OpenHAB
  • rick Sumter on Integrating ISY into OpenHAB
  • Sytone on Automating OneNote with AutoHotKey to be a Journal V1.1

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
Proudly powered by WordPress
Theme: Flint by Star Verte LLC
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.