diff --git a/aprsd/client/drivers/aprsis.py b/aprsd/client/drivers/aprsis.py index c7013d6..188fe15 100644 --- a/aprsd/client/drivers/aprsis.py +++ b/aprsd/client/drivers/aprsis.py @@ -180,7 +180,7 @@ class APRSISDriver: LOG.warning('client is None, might be resetting.') self.connected = False - def stats(self, serializable=False) -> dict: + def stats(self, serializable: bool = False) -> dict: stats = {} if self.is_configured(): if self._client: diff --git a/aprsd/client/drivers/tcpkiss.py b/aprsd/client/drivers/tcpkiss.py index 3d58da3..3a0c391 100644 --- a/aprsd/client/drivers/tcpkiss.py +++ b/aprsd/client/drivers/tcpkiss.py @@ -271,8 +271,19 @@ class TCPKISSDriver: """ if serializable: keepalive = self.keepalive.isoformat() + if self.last_packet_sent: + last_packet_sent = self.last_packet_sent.isoformat() + else: + last_packet_sent = 'None' + if self.last_packet_received: + last_packet_received = self.last_packet_received.isoformat() + else: + last_packet_received = 'None' else: keepalive = self.keepalive + last_packet_sent = self.last_packet_sent + last_packet_received = self.last_packet_received + stats = { 'client': self.__class__.__name__, 'transport': self.transport, @@ -280,8 +291,8 @@ class TCPKISSDriver: 'path': self.path, 'packets_sent': self.packets_sent, 'packets_received': self.packets_received, - 'last_packet_sent': self.last_packet_sent, - 'last_packet_received': self.last_packet_received, + 'last_packet_sent': last_packet_sent, + 'last_packet_received': last_packet_received, 'connection_keepalive': keepalive, 'host': CONF.kiss_tcp.host, 'port': CONF.kiss_tcp.port,