I have a problem where I need to package up some configuration data from a web app (e.g. various user settings like time zone, daylight savings etc.) and send to them to a particular device ideally in JSON format.
As far as I know calling a function on the device won’t work as it can only take a string. Closer to what’s needed in implementation seems to be Particle publish, however I can’t see how this can be used to only send the data to the device in question (I don’t want the user to update settings on every other users devices).
Apologies if there’s a simple solution I’ve missed…
A function takes a String, but it can easily be converted to a number using String.toInt() or String.toFloat(). For multiple values, you could use more functions, a single function with a “name value” string that you parse, or comma delimited values that are parsed using String.indexOf() and String.substring(). Parsing JSON on your own could be a bit more challenging.
I’d say JSON is a formatting convention based on string as container format.
So you could still use JSON (and parse it yourself) or use any of @CuriousTech’s alternative suggestions.
This would be the preferable way.
Using publish/subscribe would be like using a screwdriver to drive a nail into wood.
It’s doable but not the best way
Thanks for your excellent replies @ScruffR and @CuriousTech I’ll give that a go!