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

Replace deprecated python mosquitto library with paho-mqtt #28

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ of MQTT environments.

Contributions welcome!

Requires mosquitto python library 1.x or greater. (1.2 will give arguably
better performance as the "max messages in flight" parameter can be tweaked)
Requires paho-mqtt python library

The tools are in multiple layers:

Expand Down
6 changes: 3 additions & 3 deletions beem/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import time

import fuse
import mosquitto
import paho.mqtt.client as paho

from beem.trackers import ObservedMessage as MsgStatus

Expand All @@ -55,7 +55,7 @@ def __init__(self, host, port, opts):
self.options = opts
self.cid = opts.clientid
self.log = logging.getLogger(__name__ + ":" + self.cid)
self.mqttc = mosquitto.Mosquitto(self.cid)
self.mqttc = paho.Mosquitto(self.cid)
self.mqttc.on_message = self.msg_handler
self.listen_topic = opts.topic
self.time_start = None
Expand Down Expand Up @@ -265,7 +265,7 @@ def init(self, path):
print("listener post init init(), path=", path)
self.cid = self.options.clientid
self.log = logging.getLogger(__name__ + ":" + self.cid)
self.mqttc = mosquitto.Mosquitto(self.cid)
self.mqttc = paho.Mosquitto(self.cid)
self.mqttc.on_message = self.msg_handler
self.listen_topics = self.options.topic
# TODO - you _probably_ want to tweak this
Expand Down
4 changes: 2 additions & 2 deletions beem/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import math
import time

import mosquitto
import paho.mqtt.client as paho

from beem.trackers import SentMessage as MsgStatus

Expand Down Expand Up @@ -63,7 +63,7 @@ class TrackingSender():
def __init__(self, host, port, cid):
self.cid = cid
self.log = logging.getLogger(__name__ + ":" + cid)
self.mqttc = mosquitto.Mosquitto(cid)
self.mqttc = paho.Mosquitto(cid)
self.mqttc.on_publish = self.publish_handler
# TODO - you _probably_ want to tweak this
if hasattr(self.mqttc, "max_inflight_messages_set"):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def read(fname):
include_package_data=True,
zip_safe=False,
install_requires=[
'mosquitto>=1.0',
'paho-mqtt',
'fusepy'
],
tests_require=[
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ envlist = py27, py33
[testenv]
commands = {envpython} setup.py test
deps =
mosquitto>=1.0
paho-mqtt