Next, I also wanted to be able to log data being produced by my Photon IoT Garage Door Minder.
Looking at it there were two types of data I wanted logged. Periodic data, like the temperature and Event data like Door Opening or Closing. The other question was where to store the data and the quick and easy answer was SQLserver Express (mainly because I’d been working with SQLserver at work, so Express was a no-learning choice)
Event data would be a bit tricky. The Particle.io cloud allows you to build “integrations” effectively allowing you to register web-hooks to respond to Particle cloud events. But then…. how to get from a web-hook to the SQL database? A bit of digging and the obvious path was to fire up a web server on my machine running SQL express and a PHP web page to receive the web-hook, parse the data and store it in the SQL database.
There was some rational to choosing PHP for the web page as there is also a PHP SDK for the Particle cloud. With that I was able to write a quick PHP utility for the periodic data. It simply runs an infinite loop, polling the published variables on a regular basis and sticking them as well into the SQL database.