Skip to content

This enable a pretty easy python/flask Application that takes all incoming (json) message as a webhook (for example for netatmo or telegram) and forwards it to a given mqtt-adress.

License

Notifications You must be signed in to change notification settings

JoeRu/Webhook2MQTT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webhook2MQTT

This enable a pretty easy python/flask Application that takes all incoming (json) message as a webhook/API Integration (for example for netatmo.com or telegram or thethingsnetwork.com (TTN)) and forwards it to a given mqtt-adress.

Setup

change in docker-compose the environment variable to connect to your mqtt server

MQTT_SERVER: '192.168.176.6'
MQTT_PORT: 1883
MQTT_PATH: 'webhook'

Change the desired "listening-port/server-ip" of your webports:

"127.0.0.1:5058:80"

i strongly suggest to put some reverse-proxy ahead of your installation.

Architecture

Pretty simple - a flask app initiating a new thread to forward the expected json object to mqtt. No pathes implemented. Checkout app/main.py - it is really simple - so modifications are easy.

Test

a simple curl test should do the trick - you should see the json-object in your mqtt-browser

curl -X POST -H "Content-Type: application/json" -d '{"username":"abc","password":"abc"}' http://localhost:5058/

remarks

The webhook uses meinheld-gunicorn-flask which should be able to be running in a productive environment.

About

This enable a pretty easy python/flask Application that takes all incoming (json) message as a webhook (for example for netatmo or telegram) and forwards it to a given mqtt-adress.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published