2020-11-10, 08:18 PM
Ok I'm stuck.
Here is my code:
On my PI, I can use netcat on the 3333 port and see the JSON-DELTA UDP sentence, so I know it transmitting and recieving. If I copy the netcat output into the SignalK datafiddler it is valid, so I know the format is correct. I have added the connection in SignalK as a Signalk connection on port 3333 with "no self mapping" and logging disabled. When I look in the SignalK diagnose tool there is no temperature readings. What am I missing?
Kind Regards,
Peter
Here is my code:
Code:
#include "WiFi.h"
#include "AsyncUDP.h"
const char * ssid = "hidden";
const char * password = "hidden";
AsyncUDP udp;
void setup()
{
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("WiFi Failed");
while(1) {
delay(1000);
}
}
if(udp.connect(IPAddress(10,10,10,1), 3333)) {
Serial.println("UDP connected");
udp.onPacket([](AsyncUDPPacket packet) {
Serial.print("UDP Packet Type: ");
Serial.print(packet.isBroadcast()?"Broadcast":packet.isMulticast()?"Multicast":"Unicast");
Serial.print(", From: ");
Serial.print(packet.remoteIP());
Serial.print(":");
Serial.print(packet.remotePort());
Serial.print(", To: ");
Serial.print(packet.localIP());
Serial.print(":");
Serial.print(packet.localPort());
Serial.print(", Length: ");
Serial.print(packet.length());
Serial.print(", Data: ");
Serial.write(packet.data(), packet.length());
Serial.println();
//reply to the client
packet.printf("Got %u bytes of data", packet.length());
});
//Send unicast
udp.print("Hello Server!");
}
}
void loop()
{
delay(1000);
//Send broadcast on port 3333
// udp.broadcastTo("this is now working", 3333);
Serial.println("Sending packages.... ");
Serial.println(millis()/1000);
// udp.print("$INMTW,17.9,C*1B");
udp.print("{\"updates\":[{\"source\":{");
udp.print("\"values\":[{\"path\":\"environment.outside.temperature\",\"value\":");
udp.print(millis()/1000);
udp.print("}]}}]}");
}
On my PI, I can use netcat on the 3333 port and see the JSON-DELTA UDP sentence, so I know it transmitting and recieving. If I copy the netcat output into the SignalK datafiddler it is valid, so I know the format is correct. I have added the connection in SignalK as a Signalk connection on port 3333 with "no self mapping" and logging disabled. When I look in the SignalK diagnose tool there is no temperature readings. What am I missing?
Kind Regards,
Peter