SignalK and microPython

What would be the best way to import/export signalK data on a dev board running microPython? I found this library https://github.com/ph1l/python-signalk-client but it has not been updated in 2 years.
3 Replies
Teppo Kurki
Teppo Kurki2w ago
@PaddyB my memory tells me you’ve done micropython but is that correct? Just connecting to websocket with nothing subscribed, then sending subscription and parsing incoming deltas is not very much code Adding auth support and reconnects a bit more
Blaise
BlaiseOP2w ago
I may be able to reuse some of the stuff in pypilot too
PaddyB
PaddyB2w ago
I use UDP to send which seems to work OK, def insertIntoSigKdata(self, path, value):
_sigKdata = { "updates": [ {"values":[] }]} _sigKdata["updates"][0]["values"].append( {"path":path, "value": value }) self.sendToUDP(ujson.dumps(_sigKdata),'10.10.10.1', self.conf['sigK_udp-port'])
try: self.debugPrint1(_sigKdata) except Exception as e: print("debug print error=",e)
def sendToUDP(self, message, udpAddr, udpPort): try: s = usocket.socket(usocket.AF_INET, usocket.SOCK_DGRAM) s.sendto(message, (udpAddr, int(udpPort))) s.close() except Exception as e: print("UDP sending error=",e) pass the git is very old & I'm not a programmer so messy and probably inefficient but feel free to grab anything whih looks useful. https://github.com/boatybits/boatymonpy/blob/master/boatymon.py My new all knowing best friend https://www.perplexity.ai/ will help to rewrite it at some point, 😎

Did you find this page helpful?