MacWyznawca / homebridge-mqtt-switch-tasmota

Plugin to HomeBridge optimized to work with firmware Sonoff-Tasmota, MQTT.
MIT License
57 stars 18 forks source link

MQTT broker #43

Closed reinisb closed 6 years ago

reinisb commented 6 years ago

Hello,

I am new to this. I have a Sonoff Basic (flashed to Tasmota) and a Raspberry Pi with Homebridge installed. As far as I understand, I need "a MQTT broker thing" so that my Sonoff Basic and Homebridge could talk to each other. In other words, I guess the logic is the following: Sonoff Basic <——> MQTT Broker <——> Homebridge <———> iOS Home app

The question is: Can anyone please recommend a MQTT broker software, which I could install and run on my Raspberry Pi alongside Homebridge?

Thanks, Reinis

Hpridham commented 6 years ago

Mosquitto on raspberry pi. There are some simple tutorials on YouTube and the web. https://m.youtube.com/watch?v=AsDHEDbyLfg

Don’t forget to install the broker AND the client. I did and lost an hour to it.

Hpridham commented 6 years ago

Alternatively, looking at my notes (I recommend you make some to document your process should you need to do it over), this is what I did:

SSH into your raspberry pi in terminal and run the following commands:

sudo apt-get update sudo apt-get upgrade

Now, you need to add the Mosquitto repository. Enter the following commands.

sudo wget http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key sudo apt-key add mosquitto-repo.gpg.key sudo rm mosquitto-repo.gpg.key

Next, make the repository available to apt-get. First you need to change to the apt sources list directory.

cd /etc/apt/sources.list.d/

Now install the packages list for your version of Raspbian.

sudo wget http://repo.mosquitto.org/debian/mosquitto-jessie.list

sudo apt update sudo apt -y purge mosquit libmosq sudo aptitude install mosquitto n n Y

sudo aptitude install mosquitto-clients n n Y

reinisb commented 6 years ago

@Hpridham - thanks a lot for the info! I can confirm that I successfully installed and configured Mosquitto. I also configured Homebridge to see the Mosquitto and I can now control my Sonoff Basic v1.6 (Tasmota) via Mosqitto and Homebridge from the Home app on my iPhone.

PS My raspberry Pi is running OSMC (a derivative of Debian Stretch) and mosquitto successfully installed with the following commands. No need to copy the repo anymore - it is very simple now.

sudo apt-get update sudo apt-get install mosquitto sudo mosquitto_passwd -c /etc/mosquitto/passwd the_desired_username sudo nano /etc/mosquitto/mosquitto.conf (allow_anonymous false password_file /etc/mosquitto/passwd)