Hi,
I am having problems with compiling my particle code. The goal is to recieve a text from input field in my view to update my location variable. Think it as assigning the particle device to a new location.
i am suppose to publish the location to my payload, so if the location gets edited and posted from the web, i think the next time it publishes it will get a new name… Please help?
You might want to try giving this field a name (such as adding name="args") to pass. I would use Javascript instead my self and there are lots of examples here in the forum about how to do that.
No, I’m not sure; you may well be right. I’ve never been a big fan of JSON with all those escaped quote marks; it seems really prone to mistakes if you have to create it manually.
Right: what is being sent to your Photon is the question here, right? So I would call your Particle.function setLoc with a known good value using curl to prove if the device is getting the correct value or not and sending back via the Particle.publish().
Another way to look at this: If you do not call setLoc, does your publish return “room_23” for the location? If you then change the location, what does the publish return?
Yes, at first it is returning “room_23”, but after call setLoc, the JSON is returning “location”: ""
I suspect that location is not set right in particle.
Would you please send me doc on how to debug with curl ? i am pretty new to this and trying my best to keep up
curl is a command line tool that sends web requests similar to how a browser works but with full control over all the parts of a request. The Particle documentation has good install instructions for curl for Windows/Mac/Linux–just search for the word curl. Once installed you can call your Particle function like this (replacing the parts in <YOUR… > with your special numbers, no angle braces needed).
It does not matter what “arg” is called. When you are done, the location should be set. Then you will know if the problem is in your firmware on the Photon or in your web code. I’m thinking web code but this will tell you for sure.