Skip to content

Commit e7c5a0d

Browse files
committed
Fix error when WIS2 mqtt was not configured
1 parent 0dee0f2 commit e7c5a0d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ingest/api/ingest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def __init__(
3434
):
3535
self.uuid_prefix = uuid_prefix
3636
self.client = None
37+
self.WIS2_client = None
3738
try:
3839
if mqtt_conf["host"]:
3940
self.client = connect_mqtt(mqtt_conf)
@@ -91,7 +92,7 @@ async def publish_messages(self, messages: list, publishWIS2: bool, baseURL: str
9192
detail="Data ingested to datastore. But unable to publish to mqtt",
9293
)
9394
try:
94-
if publishWIS2:
95+
if publishWIS2 and self.WIS2_client:
9596
send_message(
9697
generate_wis2_topic(),
9798
generate_wis2_payload(msg, baseURL).model_dump(exclude_unset=True, exclude_none=True),

0 commit comments

Comments
 (0)