Quering the PFOD protocol (or any other TCP protocol)

#1

The ArduMower project uses the so called PFOD protocol to communicate via bluetooth and wifi. The ESP8266 provides a TCP Server and I am already able to connect to the TCP Server.

However, I am not able to query the device. I guess, the best would be to describe, how I connect via telnet:

telnet 192.168.5.38 8080
Trying 192.168.5.38...
Connected to 192.168.5.38.
Escape character is '^]'.
{m1}                            <------- this is what I have to send
{=Log sensors}
time,leftsen,rightsen,mowsen,sonleft,soncenter,sonright,perinside,permag,odoleft,odoright,yaw,pitch,roll,gyrox,gyroy,gyroz,accx,accy,accz,comx,comy,comz,hdop,sats,gspeed,gcourse,galt,lat,lon
4804.06,0.00,0.00,0.00,0,0,0,0,32,0,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,4294967295,255,-1.00,1000.00,1000000.00,1000.00,1000.00
4804.25,0.00,0.00,0.00,0,0,0,0,30,0,0,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,4294967295,255,-1.00,1000.00,1000000.00,1000.00,1000.00

It outputs these lines as long as I send a new command. For some information I have to send say {po} and get a single line.

I created already a TCP client node, but how can I send the commands and receive the lines? I created dummy data with inject and was able to split the lines and forward them to the gui. Only the TCP part is missing. Do you have some hints for me?

Edit: Since I have to query multiple sources for one widget, I guess a solution with a function node may be the right one. Is that right?

0 Likes

#2

Which TCP node are you using ? The tcp-request node ought to be the one

0 Likes

#3

I used tcp-in for this before. Because of your hint I tried an inject node (creates the input) and tcp-request and it works. Thanks for that.
Therefore I created multiple chains (inject, tcp-request, function, template) and got connection issues, since I can connect once only at the same moment. It is a limitation of the ESP8266 firmware.

Is it possible to create a function node acting like a tcp-request, in order to ensure that the requests are done serial, not parallel? I know that the sense of node red is not to create flows with overdosed functions, but I see no other way.

0 Likes

#4

The request node should be able to close its connection after each request so chains should be possible. You may need to add a small delay between each to let the esp recover.

0 Likes