stlehmann/Flask-MQTT

Setting the client name within Flask is invalid

gdushang opened this issue · 0 comments

if set client name in flask config,using Mqtt.init_app to init app, client name of mqtt will be set to the default value,

In init_ App () should be corrected to first obtain the config of Flask, and then set up monitoring self. client_ ID,

    if "MQTT_CLIENT_ID" in app.config:
        self.client_id = app.config["MQTT_CLIENT_ID"]
    if isinstance(self.client_id, unicode):
        self.client._client_id = self.client_id.encode("utf-8")
    else:
        self.client._client_id = self.client_id