Xenon mesh node Interfacing with RESTfull web service sample code

The scenario is a Xenon node as thermostat controlling heating . So the xenon node would get the daily weather forecast by a RESTfull web service on the internet to make better temperature setting choices.

It also would post data to a RESTfull web service on the local wi-fy exposed by a raspberry pi , who will enter that data into MySQL database also running on the same raspberry pi.

The mesh network configurations will include an Argon node

So I am looking for some sample code that does this , or just an explanation on what interfaces to use.

That’s a pretty specific use case, but have a look at webhooks, which are very suitable for this kind of scenario. Publish/subscribe can be used for communication with the Pi as well.

@Deetle, if you have a mesh of these thermostats in a home, I would pull the weather only in the Argon gateway using webhooks and distribute only the necessary data to the mesh using Mesh pub/sub. As for posting data to a local Pi, that again should be done via the Argon with Xenon nodes sending data again via Mesh pub/sub. At this time, I am not sure if the TCPClient has been implemented on the Argon. As @Moors7 pointed out, you can also use Cloud-based Particle pub/sub to send data to the Pi.

1 Like

Thanks , I will play with webhooks , it looks like I could make it work . But I was actually looking for how to make the http calls directly from mesh node. As this would make the node self contained and just require to join the node to the mesh network and it would be functional , opposed adding and maintaining code in 2 places on the node and the Particle cloud.

I see the point to make sure to only query the web data once , and share with all needed devices. Definitely something to keep in mind.