Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MQTT client. #71

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading