|
|
@@ -108,14 +108,14 @@ def main(): |
|
|
|
my_database.create_tables() |
|
|
|
|
|
|
|
# Create MQTT Client and connect to local broker |
|
|
|
mqttclient = mqtt.Client(BACKEND_CLIENT_ID, transport="websockets") # transport websockets required for local broker |
|
|
|
mqttclient = mqtt.Client(BACKEND_CLIENT_ID, """transport="websockets""""") # transport websockets required for local broker |
|
|
|
mqttclient.on_connect = lambda client, userdata, flags, rc: on_connect(_client=client, |
|
|
|
_userdata=userdata, |
|
|
|
_flags=flags, |
|
|
|
_rc=rc, |
|
|
|
_mydatabase=my_database, |
|
|
|
_robot=robot) |
|
|
|
mqttclient.connect(MQTT_BROKER_LOCAL) |
|
|
|
mqttclient.connect(MQTT_BROKER_GLOBAL) |
|
|
|
|
|
|
|
# Initialize logger and save in server.log file |
|
|
|
logging.basicConfig(filename="server.log", filemode="a", encoding="utf-8", level=logging.DEBUG, |