What is the best way to publish events from a Raspberry Pi?

I have multiple photons running the same code that can be activated by publishing a public event, and I want to connect that up to some scripts running on a raspberry pi server so the Pi can publish events to all the photons.

What would the best way to go about this be?

1.) If you are part of the Raspberry Pi beta, you can simply write Arduino code like that you have done for a Photon with all the Particle goodies like Particle publish()

2.) Another option is to publish using Particle-CLI with particle publish EVENT_NAME DATA

3.) You can also write your own script and hit the API endpoint documented here: https://docs.particle.io/reference/api/#publish-an-event

I am actually part of the beta, the problem is I need the publish to be based on some python script, and I don’t know how to connect the two.

I tried installing the CLI on raspbian, but was unsuccessful. I’ll try to figure that out.

Thanks for the responce

You can run any command and call any script using Process Control.

https://docs.particle.io/reference/firmware/raspberry-pi/#process-control

For example, you could run a Python script and get the output:

Process proc = Process::run("python /home/pi/someScript.py");
proc.wait();
String scriptOut = proc.out().readString();

Also, try this to install particle-cli:

sudo npm install -g --unsafe-perm node-pre-gyp npm serialport particle-cli

The third option worked out great! thank you