Skip to content

Commit 395a6ab

Browse files
authored
Merge pull request #1 from MO-RISE/pyais-version-bump
Using field-consistent pyais version
2 parents c0f000f + ff15b1f commit 395a6ab

File tree

7 files changed

+665
-632
lines changed

7 files changed

+665
-632
lines changed

main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from streamz import Stream
99

10-
from pyais.messages import ANY_MESSAGE, NMEAMessage
10+
from pyais.messages import ANY_MESSAGE, NMEAMessage, JSONEncoder as BytesJSONEncoder
1111
from pyais.exceptions import InvalidNMEAMessageException
1212
from environs import Env
1313

@@ -125,7 +125,7 @@ def to_mqtt(envelope: Envelope, mmsi: int, message_type: int):
125125
"""Publish an envelope to a mqtt topic"""
126126

127127
topic = f"{MQTT_OUTPUT_BASE_TOPIC}/{mmsi}/{message_type}"
128-
payload = envelope.json()
128+
payload = envelope.json(cls=BytesJSONEncoder)
129129

130130
LOGGER.debug("Publishing on %s with payload: %s", topic, payload)
131131
try:
@@ -159,5 +159,5 @@ def to_mqtt(envelope: Envelope, mmsi: int, message_type: int):
159159
LOGGER.info("Connecting to MQTT broker...")
160160
mq.connect(MQTT_BROKER_HOST, MQTT_BROKER_PORT)
161161

162-
# Lets fire this baby up!
162+
# Data driven, lets just make sure to stay connected!
163163
mq.loop_forever()

0 commit comments

Comments
 (0)