Skip to content

Commit d17a78b

Browse files
committed
Move MqttError to rpc and import
1 parent 9ebdad6 commit d17a78b

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

MacroPad_RPC_Home_Assistant/code.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from adafruit_display_shapes.rect import Rect
1212
from adafruit_display_text import label
1313
from adafruit_macropad import MacroPad
14-
from rpc import RpcClient, RpcError
14+
from rpc import RpcClient, RpcError, MqttError
1515

1616
macropad = MacroPad()
1717
rpc = RpcClient()
@@ -26,9 +26,6 @@
2626
"ON": 0x00FF00,
2727
}
2828

29-
class MqttError(Exception):
30-
"""For MQTT Specific Errors"""
31-
3229
# Set up displayio group with all the labels
3330
group = displayio.Group()
3431
for key_index in range(12):

MacroPad_RPC_Home_Assistant/rpc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
class RpcError(Exception):
2626
"""For RPC Specific Errors"""
2727

28+
class MqttError(Exception):
29+
"""For MQTT Specific Errors"""
30+
2831
class _Rpc:
2932
def __init__(self):
3033
self._serial = None

MacroPad_RPC_Home_Assistant/rpc_ha_server.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import ssl
88
import socket
99
import adafruit_minimqtt.adafruit_minimqtt as MQTT
10-
from rpc import RpcServer
10+
from rpc import RpcServer, MqttError
1111

1212
mqtt_status = {
1313
"connected": False,
@@ -27,9 +27,6 @@ def disconnect(_mqtt_client, _userdata, _rc):
2727
def message(_client, topic, payload):
2828
last_mqtt_messages[topic] = payload
2929

30-
class MqttError(Exception):
31-
"""For MQTT Specific Errors"""
32-
3330
# Default to 1883 since SSL on CPython is not currently supported
3431
def mqtt_init(broker, port=1883, username=None, password=None):
3532
mqtt_status["client"] = MQTT.MQTT(

0 commit comments

Comments
 (0)