Simplify interacting Raspberry Pi sensors and GPIO pins remotely via MQTT. Also integrates with Home Assistant.
- Temperature/Humidity
- DHT22/DHT11
- One wire (DS18B20, MAX31850, etc)
- BME280
- Binary
- Generic reed switches
- Thermostat
- HestiaPi
- Switch GPIO pins on/off. e.g. activate relay, LED, etc.
sudo pip install rpi2mqtt
rpi2mqtt --generate-config
- Update config.yaml. See configuration info.
- Open config.yaml.
- Edit MQTT broker details
# config.yaml
mqtt:
host: example.com
port: 8883
ca_cert: '/path/to/example.com.crt'
username: mqtt_user
password: secure_password
retries: 3
3. add sensors to config.yaml
# config.yaml
sensors:
- type: dht22
name: laundry_room_climate
pin: 16
topic: 'homeassistant/sensor/laundry_room_climate/state'
- type: reed
name: laundry_room_door
pin: 24
normally_open: true
topic: 'homeassistant/sensor/laundry_room_climate/state'
- Start rpi2mqtt
rpi2mqtt -c /path/to/config.yaml
rpi2mqtt --install-service
and enter run user and absolute path to config.yaml- Enable and start service
sudo systemctl enable rpi2mqtt
sudo systemctl start rpi2mqtt