Skip to content

Code and Config files for a Raspberry Pi MQTT bridge

Notifications You must be signed in to change notification settings

DETImotica/SensorGateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sensor_Gateway

Code and Config files for a Raspberry Pi MQTT bridge

Installation

  1. Install docker
sudo apt install docker
  1. Pull the eclipse-mosquitto image
docker pull eclipse-mosquitto
  1. Create the necessary directories
mkdir -p /var/mosquitto/log
mkdir -p /var/mosquitto/data
chmod ugo+w /var/mosquitto
  1. Create the configuration and passwd files
wget https://raw.githubusercontent.com/DETImotica/Sensor_Gateway/master/configuration/var/mosquitto/mosquitto.conf -P /var/mosquitto
wget https://raw.githubusercontent.com/DETImotica/Sensor_Gateway/master/configuration/var/mosquitto/data/passwd -P /var/mosquitto/data
  1. Start a docker container in daemon mode
docker run -d -it -p 1883:1883 -p 9001:9001 -v /var/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf -v /var/mosquitto/data:/mosquitto/data -v /var/mosquitto/log:/mosquitto/log eclipse-mosquitto
  1. (Optional) Install mosquitto-clients package to be able to subscribe and publish to topics via the CLI
sudo apt install mosquitto-clients

Usage

Credentials (temporary)

Username: detimotic

Password: testpw

Subscribing to topics

Using mosquitto-clients:

mosquitto_sub -h <address> -v -t "<topic>" -u detimotic -P testpw

Replace <topic> for the desired topic

Replace <address> for the IP address of the gateway or localhost if done on the gateway itself

Publishing to topics

Using mosquitto-clients:

mosquitto_pub -h <address> -t "<topic>" -u detimotic -P testpw -m "<message>"

Replace <topic> for the desired topic

Replace <address> for the IP address of the gateway or localhost if done on the gateway itself

References

About

Code and Config files for a Raspberry Pi MQTT bridge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages