Skip to content

Commit

Permalink
Fix type errors regarding protos
Browse files Browse the repository at this point in the history
  • Loading branch information
lukipuki committed Jan 13, 2024
1 parent f06a582 commit e0176aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/yaroc/sources/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async def _handle_punches(self, mac_addr: str, payload: PayloadType, now: dateti

async def _handle_meshtastic_serial(self, payload: PayloadType, now: datetime):
try:
se = ServiceEnvelope.FromString(payload)
se = ServiceEnvelope.FromString(MqttForwader._payload_to_bytes(payload))
except Exception as err:
logging.error(f"Error while parsing protobuf: {err}")
return
Expand All @@ -116,7 +116,7 @@ async def _handle_meshtastic_serial(self, payload: PayloadType, now: datetime):
await self._process_punch(punch, mac_addr, now, override_mac=self.meshtastic_mac)
except Exception as err:
logging.error(
f"Cannot construct SiPunch from {mac_addr} {se.packet.decoded.payload}: {err}"
f"Cannot construct SiPunch from {mac_addr} {se.packet.decoded.payload!r}: {err}"
)

async def _handle_status(self, mac_addr: str, payload: PayloadType, now: datetime):
Expand Down Expand Up @@ -146,7 +146,7 @@ async def _handle_status(self, mac_addr: str, payload: PayloadType, now: datetim

async def _handle_meshtastic_status(self, payload: PayloadType, now: datetime):
try:
se = ServiceEnvelope.FromString(payload)
se = ServiceEnvelope.FromString(MqttForwader._payload_to_bytes(payload))
except Exception as err:
logging.error(f"Error while parsing protobuf: {err}")
return
Expand Down

0 comments on commit e0176aa

Please sign in to comment.