2019-01-31, 01:06 PM
A very simple test to illustrate how simple it CAN (not right) be done :
import time, socket
# Initiate socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# socket.AF_INET is Internet
# socket.SOCK_DGRAM) is UDP
print("Trying to send values to SignalK")
while True:
t=input("Please enter a number: ")
x = float(t)
SignalK='{"updates": [{"$source": "OrangePi","values":[ {"path":"OrangePi.signalK.manual","value":'+format(x,'5.3f')+'}]}]}'
print(SignalK)
sock.sendto(SignalK, ('192.168.1.160', 55557))
import time, socket
# Initiate socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# socket.AF_INET is Internet
# socket.SOCK_DGRAM) is UDP
print("Trying to send values to SignalK")
while True:
t=input("Please enter a number: ")
x = float(t)
SignalK='{"updates": [{"$source": "OrangePi","values":[ {"path":"OrangePi.signalK.manual","value":'+format(x,'5.3f')+'}]}]}'
print(SignalK)
sock.sendto(SignalK, ('192.168.1.160', 55557))
Ole W. Saastad
web : https://www.homelinux.no https://algol.homelinux.no
https://github.com/olewsaa/Yacht-computer
twitter : olewsaa
web : https://www.homelinux.no https://algol.homelinux.no
https://github.com/olewsaa/Yacht-computer
twitter : olewsaa