ParadoxIP150v2 icon indicating copy to clipboard operation
ParadoxIP150v2 copied to clipboard

Add support for MQTT auth in config.ini

Open AngelosF opened this issue 7 years ago • 2 comments

If possible, add in the [MQTT Broker] section, a Username and Password config parameters. I got it to work by modifying manually:

lib/client.py (and hard-coding in self._username & self._password)

and

lib/publish.py (and hard-coding in): def single(topic, payload=None, qos=0, retain=False, hostname="localhost", port=1883, client_id="", keepalive=60, will=None, auth= {'username':"user_name", 'password':"pass_word"}, tls=None, protocol=mqtt.MQTTv31):

AngelosF avatar Jun 03 '17 03:06 AngelosF

I am getting this on my raspberry pi running mosquito Connected to MQTT broker with result 5 Connected to MQTT broker with result 5 Connected to MQTT broker with result 5

but yet would work on my Ubuntu setup
I am now thinking its because of MQTT user name and Password as well

FigJam23 avatar Jul 10 '17 01:07 FigJam23

How about:

# -------------- MQTT ----------------
        elif State_Machine == 1:

            try:

                if speciallogging:
                    logging.info("State machine 1: starting client again")

                logging.info("State01:Attempting connection to MQTT Broker: " + MQTT_IP + ":" + str(MQTT_Port))
                client = mqtt.Client()
                client.on_connect = on_connect
                client.on_message = on_message
>>>>>>>>>
                client.username_pw_set(MQTT_User, MQTT_Password)
<<<<<<<<<
                client.connect(MQTT_IP, MQTT_Port,  MQTT_KeepAlive)

yusufk avatar Sep 11 '17 12:09 yusufk