Raspberry pi not connected with internet than node red should store data in device once it reconnected to the internet it should send to the cloud using tcpip

Dear Sir,

i Just want to send simple data from Raspberry pi using node red tcp/ip communication, when raspberry pi is connected with internet it should send the data ,and when the raspberry pi is not connected with internet it should store data & once it reconnected it should send stored data please help.
please help sir ,this project is my life please tell is that possible or not, please.

Thanks & Regards,
Amit

Yes, that is possible. Which bits do you not know how to do?

For the online/offline part, search on the node red flows site for guaranteed delivery and you will find a flow that does that.

[
{
"id": "51c6499e43ce6873",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env":
},
{
"id": "224cb7d30bd7fb8e",
"type": "inject",
"z": "51c6499e43ce6873",
"name": "Data",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "3",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "5",
"payloadType": "num",
"x": 230,
"y": 180,
"wires": [
[
"065257d2bdae4eef",
"109815f67a129df7"
]
]
},
{
"id": "109815f67a129df7",
"type": "debug",
"z": "51c6499e43ce6873",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 560,
"y": 280,
"wires":
},
{
"id": "065257d2bdae4eef",
"type": "tcp out",
"z": "51c6499e43ce6873",
"name": "",
"host": "192.145.1.",
"port": "3306",
"beserver": "client",
"base64": false,
"end": true,
"tls": "",
"x": 580,
"y": 180,
"wires":
}
]

this is my code flow.

[
{
"id": "51c6499e43ce6873",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env":
},
{
"id": "224cb7d30bd7fb8e",
"type": "inject",
"z": "51c6499e43ce6873",
"name": "Data",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "3",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "5",
"payloadType": "num",
"x": 230,
"y": 180,
"wires": [
[
"065257d2bdae4eef",
"109815f67a129df7"
]
]
},
{
"id": "109815f67a129df7",
"type": "debug",
"z": "51c6499e43ce6873",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 560,
"y": 280,
"wires":
},
{
"id": "065257d2bdae4eef",
"type": "tcp out",
"z": "51c6499e43ce6873",
"name": "",
"host": "192.145.1.",
"port": "3306",
"beserver": "client",
"base64": false,
"end": true,
"tls": "",
"x": 580,
"y": 180,
"wires":
}
]

i want to store this output 5 in local storage when the internet is disconnected ,once the device reconnect to the internet it should send the stored data
please help sir,
this only i have to do with node red please sir

Did you see my previous reply?

i did not found anything please send url or something

https://flows.nodered.org/search?term=guaranteed

I'm not familiar with the flow that it shows but I have a suspicion that if @Colin recommends it he probably knows it's reliable! :stuck_out_tongue_winking_eye:

ps "this project is my life" - It would be interesting to know a bit more about the project.

Dear Sir,

i started startup campany sir this is my first project what customer want we have to use TCP/IP to Send Data to the cloud .
by using MQTT msg send on unexpected disconnection but there is no option wih tcp ip the url that you send this is also not works.
i also don't know about node red flow .and i don't know what to do next

Regards
amit

i am already invested my everything there is no way.

Did you read the instructions on how to use the flow? Have you imported it and tried to understand what it does?

now tcpip in diconnected so wait for msg is zero only ,
it should buffer sir ji than fail stage should start

after reconnecting to the internet no message sended via tcpip

You must work out how to know when a TCP transaction has completed ok, and send the ok message to let the next one through, or if the TCP has failed and send the failed message.

if i know this things how to do that than why should i ask ,if you want i can pay u as well . i already buy 200 raspberry pi

The flow does everything else you need, storing messages when they cannot be sent and retrying to check whether the connection is good again. All you have to do is to detect the TCP error or success. I have not used the TCP node, but presumably it indicates that a timeout has occurred. Have you checked to see if there are messages from the catch or complete nodes? Make sure you have linked them to that node.
I am retired and on holiday so can only point you in the right direction.

1 Like

Just pop the messages on a queue like RabbitMQ. Then on the Raspberry pi side just connect and process everything on the queue until it's empty then disconnect. I use the STOMP protocol for Rabbit MQ mostly with Perl but I see node-red has node-red-node-stomp as well.