Compare commits
2 Commits
d7260fbd71
...
bb7a5ed08e
Author | SHA1 | Date |
---|---|---|
Hemna | bb7a5ed08e | |
Hemna | a5ef1f10d4 |
|
@ -8,6 +8,7 @@ import time
|
||||||
import aprsd.messaging
|
import aprsd.messaging
|
||||||
import paho.mqtt.client as mqtt
|
import paho.mqtt.client as mqtt
|
||||||
from aprsd import plugin, threads
|
from aprsd import plugin, threads
|
||||||
|
from aprsd.threads import tx
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger("APRSD")
|
LOG = logging.getLogger("APRSD")
|
||||||
|
@ -199,7 +200,7 @@ class WeewxMQTTThread(threads.APRSDThread):
|
||||||
|
|
||||||
def on_message(self, client, userdata, msg):
|
def on_message(self, client, userdata, msg):
|
||||||
wx_data = json.loads(msg.payload)
|
wx_data = json.loads(msg.payload)
|
||||||
LOG.debug(f"Got WX data {wx_data}")
|
LOG.debug("Got WX data")
|
||||||
# Make sure we have only 1 item in the queue
|
# Make sure we have only 1 item in the queue
|
||||||
if self.msg_queue.qsize() >= 1:
|
if self.msg_queue.qsize() >= 1:
|
||||||
self.msg_queue.clear()
|
self.msg_queue.clear()
|
||||||
|
@ -216,6 +217,7 @@ class WeewxMQTTThread(threads.APRSDThread):
|
||||||
self.client.disconnect()
|
self.client.disconnect()
|
||||||
|
|
||||||
def loop(self):
|
def loop(self):
|
||||||
|
LOG.info("Loop")
|
||||||
self.client.loop_forever()
|
self.client.loop_forever()
|
||||||
# self.client.loop(timeout=10, max_packets=10)
|
# self.client.loop(timeout=10, max_packets=10)
|
||||||
return True
|
return True
|
||||||
|
@ -351,7 +353,7 @@ class WeewxWXAPRSThread(threads.APRSDThread):
|
||||||
# and then send it out to APRS
|
# and then send it out to APRS
|
||||||
packet = self.build_wx_packet(wx)
|
packet = self.build_wx_packet(wx)
|
||||||
packet.retry_count = 1
|
packet.retry_count = 1
|
||||||
packet.send()
|
tx.send(packet)
|
||||||
self.last_send = datetime.datetime.now()
|
self.last_send = datetime.datetime.now()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue