Skip to content
Permalink
7f34d01102
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
18 lines (14 sloc) 463 Bytes
from flask_mqtt import Mqtt
from app.mqtt import mqtt_message_handler
def init_app(app):
"""
Function to connect the mqtt to the app and setup
on connect and on message callbacks
"""
mqtt = Mqtt(app)
@mqtt.on_connect()
def handle_connect(client, userdata, flags, rc):
mqtt.subscribe('owntracks/4009user/#')
@mqtt.on_message()
def handle_mqtt_message(client, userdata, msg):
mqtt_message_handler.getMsg(msg)