The HTTP to MQTT bridge should feel that gap of IFTTT Actions for your Custom IoT Hardwares.
The idea is to receive signals using HTTP requests and transfer them to your MQTT broker. The HTTP to MQTT bridge is written using Golang with Gin for HTTP server and Paho MQTT client.
This app could be hosted on Heroku
git clone [email protected]:subzerobo/http-mqtt-bridge.git
cd http-mqtt-bridge
go get ./...
go build -o hmb
hmb s --mqtt-host=tcp://localhost:1883
hmb s --help
- MQTT Host :
MQTT_HOST
- MQTT User :
MQTT_USER
- MQTT Pass :
MQTT_PASS
- Basic Auth Username :
AUTH_USERNAME
- Basic AuthPassword :
AUTH_PASSWORD
curl -XPOST -H 'Content-Type: application/json' -d '{"topic": "ali","message": "This is a Test Message"}' --user alikaviani:F#@{fW+/ localhost:8090/publish
This will publish message: this is a test message
to the topic : ali
You can add required environment variable through .env File accordingly or after creating the heroku app
Navigate to your app then go to Settings -> Config Vars -> Add Environment variables
git clone [email protected]:subzerobo/http-mqtt-bridge.git
cd http-mqtt-bridge
heroku create
git push heroku master
heroku open
OR