mirror of
https://github.com/jketterl/openwebrx.git
synced 2025-12-06 07:12:09 +01:00
18 lines
441 B
Python
18 lines
441 B
Python
|
|
from paho.mqtt.client import Client
|
||
|
|
from owrx.reporting.reporter import Reporter
|
||
|
|
from owrx.config import Config
|
||
|
|
import json
|
||
|
|
|
||
|
|
|
||
|
|
class MqttReporter(Reporter):
|
||
|
|
def __init__(self):
|
||
|
|
pm = Config.get()
|
||
|
|
self.client = Client()
|
||
|
|
self.client.connect(host=pm["mqtt_host"])
|
||
|
|
|
||
|
|
def stop(self):
|
||
|
|
self.client.disconnect()
|
||
|
|
|
||
|
|
def spot(self, spot):
|
||
|
|
self.client.publish("openwebrx/spots", payload=json.dumps(spot))
|