Forked from trieb/Howto setup a RaspberryPi with openHAB and mosquitto
Created
September 24, 2018 20:02
-
-
Save drmaq/2b7c6d5415a3a0cca15ca49b8a4b4cab to your computer and use it in GitHub Desktop.
Revisions
-
trieb revised this gist
Jun 3, 2016 . 1 changed file with 22 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Instructions ## Content 1. Install OS @@ -9,14 +9,16 @@ 6. Install mosquitto ## Install OS 1. Download OS image [raspberrypi.org](https://www.raspberrypi.org/downloads/raspbian/) 2. Burn file to SD card 3. Boot the Raspberry Pi ## Connecting to the Pi First you have to find out what IP address your Pi got in the network. Later with will set a static IP, but for now the find the dynamically assigned IP address. * On Windows you can use *Advanced IP Scanner* * On Linux you can use `>> arp -a` to list all addresses. @@ -25,16 +27,13 @@ Later with will set a static IP, but for now the find the dynamically assigned I 3. Post: 22 4. Connection Type: SSH Press **Open...** The default user is *pi* And the default password is *raspberry* ## Setting up Raspbian ### Assign a static IP address 1. Show ifconfigs @@ -74,48 +73,51 @@ iface eth0 inet static ### Raspberry Pi setup references * [Nice guide on how to setup Raspberry Pi](http://www.element14.com/community/community/design-challenges/forget-me-not/blog/2014/08/02/how-to-setting-up-your-raspberry-pi) * [Tutorial how to give your raspberry pi a static ip address](http://www.modmypi.com/blog/tutorial-how-to-give-your-raspberry-pi-a-static-ip-address) ## Install openHAB Get openHAB: ``` >> cd openHAB >> wget https://bintray.com/artifact/download/openhab/bin/distribution-1.7.1-runtime.zip >> wget https://bintray.com/artifact/download/openhab/bin/distribution-1.7.1-addons.zip >> wget https://bintray.com/artifact/download/openhab/bin/distribution-1.7.1-demo.zip >> unzip <files> /opt/openhab/1.8.3/. ``` Make openHAB auto-start after reboot. 1. Downloads scrits from: https://mcuoneclipse.com/2015/12/24/autostarting-openhab-on-raspberry-pi/ 2. Move openhab to /etc/init.d/ directory 3. Update paths to openHAB in openhab.conf 4. Move openhab.conf to the /etc/default/ directory ## Install mosquitto Mosquitto is the mqtt broker and will be used to distribute messages between the #IoT-nodes and openHAB. ### 1. Goto [Mosquitto](http://mosquitto.org/2013/01/mosquitto-debian-repository/) and follow the instructions to install ### Testing mosquitto Start mosquitto: ``` >> mosquitto -v -c /etc/mosquitto/mosquitto.conf ``` Subscribe to all topics ``` >> ./mosquitto_sub.exe -v -h 192.168.78.40 -t "#" ``` Publish a test message on some topic: ``` >> ./mosquitto_pub.exe -h 192.168.78.40 -t "test/" -m "Hello World" @@ -130,4 +132,4 @@ If message received properly, mosquitto is up and running! * http://blog.thingstud.io/recipes/how-to-make-your-raspberry-pi-the-ultimate-iot-hub/ * http://jpmens.net/2013/09/01/installing-mosquitto-on-a-raspberry-pi/ * [Enable logging](http://www.switchdoc.com/2016/02/tutorial-installing-and-testing-mosquitto-mqtt-on-raspberry-pi/) * https://www.youtube.com/watch?v=PgsH43Tpqjc -
trieb revised this gist
May 27, 2016 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,9 @@ 1. Install OS 2. Connecting to the Pi 3. Setting up Raspian 4. Enable secure login 5. Install openHAB 6. Install mosquitto ## Install OS 1. Download OS image [raspberrypi.org](https://www.raspberrypi.org/downloads/raspbian/) @@ -39,7 +40,7 @@ Ge RPi:n statisk ip: [ref](http://www.modmypi.com/blog/tutorial-how-to-give-your ``` >> ifconfig inet addr: 192.168.78.51 Bcast: 192.168.78.255 Mask: 255.255.255.0 ``` -
trieb created this gist
May 27, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,132 @@ # How to set up a raspberry pi with openHAB and mosquitto ## Content 1. Install OS 2. Connecting to the Pi 3. Setting up Raspian 4. Install openHAB 5. Install mosquitto ## Install OS 1. Download OS image [raspberrypi.org](https://www.raspberrypi.org/downloads/raspbian/) 2. Burn file to SD card 3. Boot the Raspberry Pi ## Connecting to the Pi First you have to find out what IP address your Pi got in the network. Later with will set a static IP, but for now the find the dynamically assigned IP address. * On Windows you can use *Advanced IP Scanner* * On Linux you can use `>> arp -a` to list all addresses. 1. Download [PuTTy](https://www.element14.com/community/external-link.jspa?url=http%3A%2F%2Fthe.earth.li%2F%7Esgtatham%2Fputty%2Flatest%2Fx86%2Fputty.exe) 2. Enter host name (the IP address of the RPi) 3. Post: 22 4. Connection Type: SSH Press "Open".. The default user is "pi" (without the quotes) And the default password is "raspberry" (no quotes!) ## Setting up Raspbian ### Give RPi a static IP address Ge RPi:n statisk ip: [ref](http://www.modmypi.com/blog/tutorial-how-to-give-your-raspberry-pi-a-static-ip-address) 1. Show ifconfigs ``` >> ifconfig inet addr: 192168.78.51 Bcast: 192.168.78.255 Mask: 255.255.255.0 ``` 2. Show netstat ``` >> netstat -nr Gateway: 192.168.78.254 Destination: 192.168.78.0 ``` 3. Edit config ``` >> sudo nano /etc/network/interfaces ``` Change ``` iface eth0 inet dhcp ``` to ``` iface eth0 inet static ``` ### Raspberry Pi setup references * [Nice guide on how to setup Raspberry Pi](http://www.element14.com/community/community/design-challenges/forget-me-not/blog/2014/08/02/how-to-setting-up-your-raspberry-pi) ## Install openHAB Get openHAB: >> cd openHAB >> wget https://bintray.com/artifact/download/openhab/bin/distribution-1.7.1-runtime.zip >> wget https://bintray.com/artifact/download/openhab/bin/distribution-1.7.1-addons.zip >> wget https://bintray.com/artifact/download/openhab/bin/distribution-1.7.1-demo.zip >> unzip <files> /opt/openhab/1.8.3/. Make openHAB auto-start after reboot. 1) Downloads scrits from: https://mcuoneclipse.com/2015/12/24/autostarting-openhab-on-raspberry-pi/ 2) Move openhab to /etc/init.d/ directory 3) Update paths to openHAB in openhab.conf 4) Move openhab.conf to the /etc/default/ directory ## Install mosquitto Mosquitto is the mqtt broker and will be used to distribute messages between the #IoT-nodes and openHAB. ### 1. Goto [Mosquitto](http://mosquitto.org/2013/01/mosquitto-debian-repository/) and follow the instructions to install ### Testing mosquitto 1. Start mosquitto: ``` >> mosquitto -v -c /etc/mosquitto/mosquitto.conf ``` 2. Subscribe to all topics ``` >> ./mosquitto_sub.exe -v -h 192.168.78.40 -t "#" ``` 3. Publish a test message on some topic: ``` >> ./mosquitto_pub.exe -h 192.168.78.40 -t "test/" -m "Hello World" ``` If message received properly, mosquitto is up and running! ### Mosquitto references: * http://mosquitto.org/2013/01/mosquitto-debian-repository/ * http://blog.thingstud.io/recipes/how-to-make-your-raspberry-pi-the-ultimate-iot-hub/ * http://jpmens.net/2013/09/01/installing-mosquitto-on-a-raspberry-pi/ * [Enable logging](http://www.switchdoc.com/2016/02/tutorial-installing-and-testing-mosquitto-mqtt-on-raspberry-pi/) * https://www.youtube.com/watch?v=PgsH43Tpqjc