Communication between Python and Offline Nodered

Hi all,
I have downloaded offline Desktop node-red, I have python 3.6.8.
I know how to send Data from python to Node-red via Cloud or server(eg>Mqtt).
I want to send data from python that is when i run the python file it should send some string to node-red without Internet or Cloud.
Can anyone know about it..?

Hi Sandy,

You could simply host a local MQTT broker (like mosquito) on the (offline) device where node-red runs.

Quick question, what do you do in python, that you couldn't do directly in node-red?

Thank you Mr.Steve for immediate response.
Mqtt requires Internet, We should not use Internet.
Yah, we can do it in node-red but we have should send data from python to Offline Node-red where it won't require Internet or any Cloud in between them.

MQTT does not require internet - a broker can be installed locally to node-red and / or where python runs

It DOES require an IP - but that IP can be localhost or or an internal 192.168.x.y address (non internet LAN)

Thank you,
Can we have other communication rather than mqtt..?

Sure, if you want to deal with pipes or raw TCP / UDP or temporary files - go ahead - but you lose the structure and simplicity of MQTT.

Why not just install a local MQTT broker? Lots of people do this.

In fact, you can run a broker inside node-red using node-red-contrib-aedes - so you don't even need too install mosquito (though it would be a better solution).

Can you share some more info or it might be better if you share an example flow

What do you need information on? You said you know how to use MQTT across the internet, there is no difference running it locally. On a Pi, for example, you can just run
sudo apt install mosquitto
and it is done. Nothing else to do apart from use it in node-red.

Alternatively, if you just need to run a python script that runs and sends it output to node red then you can call the script from an exec node.

Thank you Colin,
I will try and will update you about it.
For your Info I am clarifying that I want to run python script outside the Offline Node-Red where I will send some messages to Node-Red.

This is simply not working. Like trying to turn on a lamp if the wire is broken

I think there may be confusion about what you mean by that. Presumably you are trying to run the script in the same computer as node-red, and the node-red server is running.

yes,you are correct, but I am not using Node-Red Server it is Offline Node-Red Desktop

I have never heard of that, Do you mean

If so then I have no experience with that, I suspect no-one here has, but I may be wrong.

Yes I am Using the Same Sir

As I said I have no experience with that. I see it is using a 9 month old version of node-red, which is undesirable. Why are you not using a normal node-red install?

You can add an MQTT broker to Node-RED Desktop by installing node-red-contrib-aedes and try using that

It is just Node-RED wrapped inside an Electron container. You should still be able to communicate with other services over all of the usual channels - HTTP, TCP, UDP, MQTT, Websockets & even UNIX Pipes.

What you choose depends on how dynamic you want the connection to be, how much data and how complex or big it is. How often you need to exchange data and so on.

You can run Mosquitto broker on all common platforms and it should still be able to talk to your Node-RED instance because that isn't really "offline", but rather "local".

Thank you and sure i wiill try that

I want Offline Node-red for Offline Dashboard

As far as I can see, that software does not do anything that a normal node red install, used with a local browser, will not do.