Created
October 2, 2017 14:40
-
-
Save mirhec/27e8df1b2ff52196fabb0f9ea5f4313f to your computer and use it in GitHub Desktop.
Revisions
-
mirhec created this gist
Oct 2, 2017 .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,37 @@ # Install Mosquitto on Raspberry Pi with OpenHAB Install a raspberry pi with the latest OpenHABian version. ## Install Mosquitto wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key sudo apt-key add mosquitto-repo.gpg.key rm mosquitto-repo.gpg.key cd /etc/apt/sources.list.d/ sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list sudo apt-get update sudo apt-get install mosquitto mosquitto-clients Edit the mosquitto config file at `/etc/mosquitto/mosquitto.conf` and add the following line: listener 1883 Now restart the service with `sudo /etc/init.d/mosquitto restart`. ## Test Mosquitto mosquitto_sub -d -t hello/world Connect to another ssh session and run mosquitto_pub -d -t hello/world -m "Hello from terminal window 2!" ## Configure OpenHAB Now install Mosquitto binding and enter `binding-mqtt1` in the `binding` list in the `addons.cfg` file. Create a new file `services/mqtt.cfg` and enter the following content: mosquitto.url=tcp://localhost:1883 mosquitto.clientId=OpenHAB2 mosquitto.user=<user> mosquitto.pwd=<password> Then restart openhab with `sudo /etc/init.d/openhab2 restart`.