iot-root / garden-of-eden

Truly own that which is yours!
GNU General Public License v3.0
33 stars 9 forks source link

add mqtt broker instructions #55

Open iot-root opened 6 months ago

iot-root commented 6 months ago

Example:

installing apt install -y mosquitto

Setup password mosquitto_pub -h localhost -t testtopic -m "Hello, MQTT!" -u "yourusername" -P "yourpassword"

setup the .env with port and broker host

iot-root commented 6 months ago

MQTT with HomeAssistant

For homeassistant:

You need a mqtt broker either on the gardyn pi or homeassistant.

To install on the pi run

sudo apt-get install mosquitto mosquitto-clients

Add mqtt-broker username and password:

sudo mosquitto_passwd -c /etc/mosquitto/passwd <USERNAME>

Note: make sure to update the .env file which is used by config.py for mqtt.py

Run sudo nano /etc/mosquitto/mosquitto.conf and change the following lines to match:

allow_anonymous false
password_file /etc/mosquitto/passwd
listener 1883

Restart the service

sudo systemctl restart mosquitto

you just need to edit the .env

Next run the ./bin/setup.sh, this will install all OS dependencies, install the python libs, and run services pigpiod, mqtt.service

Ensure the pigpiod, mqtt, and broker daemon is running

sudo systemctl status pigpiod
sudo systemctl status mqtt.service
sudo systemctl status mosquitto