Skip to content

Commit

Permalink
Switch from HBMQTT to aMQTT
Browse files Browse the repository at this point in the history
The HBMQTT project appears to be dead. Instead of maintaining our own fork, we
will use the aMQTT project which is a continuation of HBMQTT.
  • Loading branch information
kruton committed Jan 25, 2022
1 parent d710510 commit a0feb14
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 166 deletions.
6 changes: 3 additions & 3 deletions feeder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
for named_logger in LOGGING_CONFIG["loggers"]:
if named_logger:
LOGGING_CONFIG["loggers"][named_logger]["level"] = "DEBUG"
LOGGING_CONFIG["loggers"]["hbmqtt.client.plugins"] = {"level": "INFO"}
LOGGING_CONFIG["loggers"]["hbmqtt.broker.plugins"] = {"level": "INFO"}
LOGGING_CONFIG["loggers"]["hbmqtt.mqtt.protocol.handler"] = {"level": "INFO"}
LOGGING_CONFIG["loggers"]["amqtt.client.plugins"] = {"level": "INFO"}
LOGGING_CONFIG["loggers"]["amqtt.broker.plugins"] = {"level": "INFO"}
LOGGING_CONFIG["loggers"]["amqtt.mqtt.protocol.handler"] = {"level": "INFO"}
dictConfig(LOGGING_CONFIG)

app = create_application()
Expand Down
2 changes: 1 addition & 1 deletion feeder/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"level": "INFO",
"propagate": False,
},
"hbmqtt": {"handlers": ["default"], "level": "INFO", "propagate": False},
"amqtt": {"handlers": ["default"], "level": "INFO", "propagate": False},
"databases": {"handlers": ["default"], "level": "INFO", "propagate": False},
},
}
Expand Down
2 changes: 1 addition & 1 deletion feeder/util/mqtt/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
from secrets import token_hex

from hbmqtt.plugins.authentication import BaseAuthPlugin
from amqtt.plugins.authentication import BaseAuthPlugin
from feeder.database.models import KronosGateways

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion feeder/util/mqtt/broker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from os.path import abspath
from hbmqtt.broker import Broker
from amqtt.broker import Broker
from feeder import settings


Expand Down
4 changes: 2 additions & 2 deletions feeder/util/mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from typing import List

import semver
from hbmqtt.client import MQTTClient
from hbmqtt.mqtt.constants import QOS_2
from amqtt.client import MQTTClient
from amqtt.mqtt.constants import QOS_2

from feeder.database.models import (
KronosDevices,
Expand Down
2 changes: 1 addition & 1 deletion feeder/util/mqtt/topic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import logging

from hbmqtt.plugins.topic_checking import BaseTopicPlugin
from amqtt.plugins.topic_checking import BaseTopicPlugin
from feeder.util.mqtt.authentication import local_username

logger = logging.getLogger(__name__)
Expand Down
329 changes: 177 additions & 152 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ alembic = "^1.7.5"
aiosqlite = "^0.17.0"
databases = "^0.4.3"
fastapi = "^0.65.2"
hbmqtt = { git = "https://github.com/feedernet/hbmqtt.git" }
amqtt = { git = "https://github.com/feedernet/amqtt.git", rev = "f9e72c9e5b503ba385b9dd16d3e35b49662549df" }
pytz = "^2021.3"
semver = "^2.13.0"
sqlalchemy = "^1.3.24"
uvicorn = "^0.17.0"
aiofiles = "^0.8.0"
Jinja2 = "^3.0.3"
cryptography = "3.3.2"
websockets = "8.1"

[tool.poetry.dev-dependencies]
black = {version = "21.12b0", allow-prereleases = true}
Expand All @@ -55,6 +54,6 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"


[tool.poetry.plugins."hbmqtt.broker.plugins"]
[tool.poetry.plugins."amqtt.broker.plugins"]
auth_petnet = "feeder.util.mqtt.authentication:PetnetAuthPlugin"
topic_petnet = "feeder.util.mqtt.topic:PetnetTopicPlugin"
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import alembic.config
from fastapi import FastAPI
from fastapi.testclient import TestClient
from hbmqtt.client import MQTTClient, QOS_2
from amqtt.client import MQTTClient, QOS_2

from tests.certificates import PRIVATE_KEY, PUBLIC_KEY

Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils/test_mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest

from hbmqtt.client import MQTTClient
from amqtt.client import MQTTClient
from fastapi.exceptions import HTTPException


Expand Down

0 comments on commit a0feb14

Please sign in to comment.