I thought I’d share the results of the Adafruit.io Integration Limit question - took me a little bit to figure out the process so I thought someone else may have the same question…
In Adafruit.io (and perhaps other IO’s) each sensors output data (e.g. Temperature or Humidity) is a unique Feed. Each Feed can be displayed on a graph, chart or map depending on the type of data. Each Feed has a unique URL for sending and receiving data which Adafruit.io calls a “WebHook” which is an address that needs to be created for each Feed. A WebHook URL looks something like: https://io.adafruit.com/api/v2/webhooks/feed/BRdUSGmQUNbciybXXXXXXog.
The data point is sent as a name/value pair in the Request - I was using the Request Format ‘Form’ but as per ScruffR’s advice I tried JSON and that worked also. The result was an Integration with a specific Event Name that sends data to a specific WebHook URL with data as “value”: “{{value}}” and yes this does work…
But what I was doing inefficiently was making a separate Integration for each Event and each with a unique WebHook URL. A better method, as pointed out, is to make the Integration more of a template with ‘moustache’ variable substitution! So here’s a recap of the process…
It starts with the device firmware sending a Particle.publish as usual. I send the name of the Event and the Data (obfuscated in this example):
feedName = "QCYC-XXXXX";
celsiusString = "20";
feedID = "fdaUk4bcrypXXXXXXXXX3XZ";
feedData = "{ \"value\": \"" + celsiusString + "\", \"feedID\": \"" + feedID + "\"}";
Particle.publish(feedName, feedData, 60, PRIVATE);
This Particle.publish command triggers an “Integration” with ANY event prefix “QCYC-” from ANY device in my small fleet.
What I initially forgot was that Integrations can respond to ‘Event Names’ starting with the first letters of the event name - so all my QCYC published events can now start with a ‘QCYC-’ prefix. Instead of separate Integrations for ‘QCYC-C’ and ‘QCYC-H’ I now have one Integration that responds to both events using the Event Name “QCYC-”.
In the Integration ‘Full URL’ I now use “https://io.adafruit.com/api/v2/webhooks/feed/{{{feedID}}}” where the ‘feedID’ hash is passed to the Integration from the device firmware. The data is passed as usual using the Custom JSON object {“value”: “{{value}}”}. The name ‘value’ is an Adafruit.io requirement; in addition, GPS location data can be passed (Lat and Long) in order to map the results.
I now have one Integration that, as ScruffR points out, does all the Events under one event banner: “QCYC-” and the URL is substituted by the {{feedID}} variable. I do have other groups of devices for different clients so they can have their own Event names (‘Garden-’, ‘CityOfToronto-’, etc.) but each only requires one Integration now!
Thanks ScruffR!