ParadoxIP150v2
ParadoxIP150v2 copied to clipboard
Add support for MQTT auth in config.ini
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):
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
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)