app.config['MQTT_CLEAN_SESSION'] = True app.config['MQTT_USERNAME'] = '******' app.config['MQTT_PASSWORD'] = '******' app.config['MQTT_KEEPALIVE'] = 10 app.config['MQTT_TLS_ENABLED'] = False # app.config['MQTT_LAST_WILL_TOPIC'] = '/admin/83c241/attrs' app.config['MQTT_LAST_WILL_MESSAGE'] = '' app.config['MQTT_LAST_WILL_QOS'] = 0 # Parameters for SSL enabled # app.config['MQTT_BROKER_PORT'] = 8883 # app.config['MQTT_TLS_ENABLED'] = True # app.config['MQTT_TLS_INSECURE'] = True # app.config['MQTT_TLS_CA_CERTS'] = 'ca.crt' mqtt = Mqtt(app) socketio = SocketIO(app) bootstrap = Bootstrap(app) subs_list = [] # Rotdas do Flask e API @app.route('/') def dash(): return render_template('dash.html') # Rotdas do Flask e API @app.route('/msg') def index():
def __init__(self): self.mqtt = Mqtt() self.mqttclient_pub_topic_list = [] self.mqttclient_sub_topic_list = [] self.recv_msg_buffer = RingBuf(15) self.is_mqtt_client_connected = False
# ### **************************************************************************** ### from flask import Flask from flask_mqtt import Mqtt #from flask_wtf.csrf import CSRFProtect from flask_bootstrap import Bootstrap from flask_socketio import SocketIO from config import config import toml bootstrap = Bootstrap() mqtt = Mqtt() #csrf = CSRFProtect() import eventlet eventlet.monkey_patch() socketio = SocketIO(async_mode='eventlet') #socketio = SocketIO(async_mode='eventlet', ping_timeout=30, logger=False, engineio_logger=False) #socketio = SocketIO( ping_timeout=30, logger=False, engineio_logger=False) def create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) config[config_name].init_app(app)
from spam.models import Staff, Location, Problem from spam import router from flask_mqtt import Mqtt import json from threading import Lock, Timer from time import sleep, time from spam.thread_decorator import thread from spam import socketio, mail import image_processing from spam import assist from flask_assistant import Assistant, tell, ask from flask_mail import Message # Variable assertion mqtt = Mqtt(spam) db = SQLAlchemy(spam) # First brick is BRICK 30 # Second brick is BRICK 10 # GLOBAL VARIABLES battery_info_volts = 0 battery_info_volts_2 = 0 delivery_status = "State.LOADING" # Delivery Status should assume one of these >> "State.DELIVERING", "State.RETURNING", "State.LOADING", "State.STOPPING", "State.PANICKING" location_info_lock = Lock() location_info = "Nothing reported yet." connection_status = False connection_status_2 = False path_planning_result = [] recipients = []