Skip to content

Commit

Permalink
Update MQTT client.
Browse files Browse the repository at this point in the history
  • Loading branch information
DailyDreaming committed Feb 27, 2024
1 parent b3e707a commit 6217617
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies = [
'matplotlib',
'nptyping',
'numpy',
'paho-mqtt',
'paho-mqtt>=2',
'pandas',
'powerlaw',
'redis',
Expand Down
17 changes: 6 additions & 11 deletions src/braingeneers/iot/messaging.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
""" A simplified MQTT client for Braingeneers specific connections """

import redis
import tempfile
import functools
import json
import inspect
import logging
import os
import re
import time
import io
import configparser
import threading
import queue
import uuid
from typing import Callable, Tuple, List, Dict, Union
import random
import json
import braingeneers.iot.shadows as sh
from paho.mqtt import client as mqtt_client
from deprecated import deprecated
import pickle
from tenacity import retry, wait_exponential, after_log

from typing import Callable, Tuple, List, Dict, Union
from deprecated import deprecated
from paho.mqtt import client as mqtt_client
from paho.mqtt.enums import CallbackAPIVersion


AWS_REGION = 'us-west-2'
Expand Down Expand Up @@ -767,7 +762,7 @@ def on_log(client, userdata, level, buf):
self.logger.debug("MQTT log: %s", buf)

client_id = f'braingeneerspy-{random.randint(0, 1000)}'
self._mqtt_connection = mqtt_client.Client(client_id)
self._mqtt_connection = mqtt_client.Client(CallbackAPIVersion.VERSION1, client_id)
self._mqtt_connection.username_pw_set(self._mqtt_profile_id, self._mqtt_profile_key)
self._mqtt_connection.on_connect = on_connect
self._mqtt_connection.on_log = on_log
Expand Down

0 comments on commit 6217617

Please sign in to comment.