Particle variable from c# when pc and particle are on the same wifi connection

from the particle cli
C:\Users\David Carlson>particle.exe list
will print in the terminal or cmd prompt the following:
device_name [000000000000] (Photon) is online
Variables:
phoresistor (int32)
Force (double)
ForceRaw (double)
Alcohol (double)
Functions:
int led7(String args)

All my Variables, Great.
I “think” that the particle cli goes to the web, but I’m not sure how it knows the device name or the token ID because all I typed was “list”

But, if my pc is connected to the same wifi as the photon is there a way to get to the variables, specifically their values from a c# program?

Hi @dcarl661

The particle list command lists everything it “knows” from the Cloud about your device(s). In this case you seem to have one device with a few variables and one function called led7 registered to the Particle cloud. It “knows” this because you logged in to the Particle Cloud through the particle CLI command.

Any computer/program on the internet can read your devices variables if you use the right API and give it your login credentials. You do not have to be on the same WiFi.

I think you should have a look at the “Tutorials” section here on the Particle forum–click on the three line icon on the upper right. I wrote several tutorials a few years ago on how to access Particle variable and functions from any modern web browser using Javascript but there are others using Python or C# or a variety of other programming languages.

3 Likes

Thanks,
Yea I’ve already gone pretty far with the tutorials but I have a situation, at work, where I can’t rely on the internet for data

What!? you ask?

Well our “devices” are used in disaster sites and other such places where there is no infrastructure remaining (or not there yet) thus no internet.

We will have our own wifi mesh setup, but no “particle cloud”.

We will be using the particle to monitor stats about our “smart” gateway such as remaining power, mesh stats, cpu temperatures, (and i want to throw in a grip of sensors)

So far the answer is of course use serial and turn off the wifi.

I was just kinda thinking out-loud about getting to the device without a “cloud” or perhaps making its own local system “cloud” with node.js node-red and the cli.

Thanks. Oh let me know if I shouldn’t have posted something that’s more of a “thought” then specific question.

OK, well that is an interesting use case.

Do you know about the local cloud? This is a fork of the Particle Cloud without all the enterprise scaling made for smaller groups or individuals to run on their own server. Some folks here have extended it and added features as well.

You certainly could also use TCP or UDP connections with something MQTT or your own protocol. Another choice might be to run an HTTP server on the Particle so you can surf to a small web page to get status.

There are lots of ways you could accomplish this depending on your time and level of skill.

1 Like

The mentioned "standalone cloud server" based on Patrticle's own "local server" can be found here

2 Likes

No I didn’t know any thing about a local cloud, but suspected that there must be some kind of “local” way to run, because a local system was probably used to develop before activating the “real” particle cloud.

Thanks for your help! I’ll add it to my giant list of tasks on my list.

Dave Carlson
Senior Software Engineer
Safeenv.com Valencia. Ca.

1 Like