Difference between revisions of "Connect-150 Webhook POST"
Line 13: | Line 13: | ||
{\"value1\":\"<sensor_input_number>\", \"value2\":\"<sensor_parameter_number>\", \"value3\":\"<sensor_parameter_value>\"} | {\"value1\":\"<sensor_input_number>\", \"value2\":\"<sensor_parameter_number>\", \"value3\":\"<sensor_parameter_value>\"} | ||
− | where <sensor_input_number> is any number between | + | where <sensor_input_number> is any number between 1 and 8 representing the sensor inputs 1 .. 8, and <sensor_parameter_number> is always 1 since analog sensors only output one parameter, ie. the sensor output voltage. |
<u>Digital (I2C) sensors, standalone mode</u> | <u>Digital (I2C) sensors, standalone mode</u> | ||
Line 19: | Line 19: | ||
{\"value1\":\"<sensor_input_number>\", \"value2\":\"<sensor_parameter_number>\", \"value3\":\"<sensor_parameter_value>\"} | {\"value1\":\"<sensor_input_number>\", \"value2\":\"<sensor_parameter_number>\", \"value3\":\"<sensor_parameter_value>\"} | ||
− | where <sensor_input_number> is any number between | + | where <sensor_input_number> is any number between 1 and 8 representing the sensor inputs 1 .. 8, and <sensor_parameter_number> is any number between 1 and 16 depending on the method selected for the digital sensor. The method determines how many parameter values the sensor outputs. |
<u>Digital (I2C) sensors, host mode</u> | <u>Digital (I2C) sensors, host mode</u> | ||
− | + | For a sensor that outputs a value for only 1 parameter the format is the same as for analog sensors: | |
− | where <sensor_input_number> is any number between | + | {\"value1\":\"<sensor_input_number>\", \"value2\":\"<sensor_parameter_number>\", \"value3\":\"<sensor_parameter_value>\"}. |
+ | |||
+ | where <sensor_input_number> is any number between 1 and 8 representing the sensor inputs 1 .. 8, and <sensor_parameter_number> is 1. | ||
+ | |||
+ | For a sensor that outputs values for 3 parameters the format is: | ||
+ | |||
+ | {\"value1\":\"<sensor_input_number>\", \"value2\":\"1\", \"value3\":\"<sensor_parameter1_value>\", \"value4\":\"2\", \"value5\":\"<sensor_parameter2_value>\", \"value6\":\"3\", \"value7\":\"<sensor_parameter3_value>\"}. | ||
+ | |||
+ | The maximumm number of parameters is 16. | ||
Revision as of 04:42, 13 January 2018
Connect can output sensor data to the web, for use in IoT (Internet of Things) applications. This enables use of I-CubeX devices to trigger an event on the web using an IoT platform such as IFTTT and Zapier. The Web field in the digitizer view window requires a Webhook URL address that may be provided by the IoT platform.
Output format
Connect will send the sensor data using a POST message with a JSON attachment, with one of the following formats, depending on the type of sensor and the digitizer's mode of operation:
Analog sensors
{\"value1\":\"<sensor_input_number>\", \"value2\":\"<sensor_parameter_number>\", \"value3\":\"<sensor_parameter_value>\"}
where <sensor_input_number> is any number between 1 and 8 representing the sensor inputs 1 .. 8, and <sensor_parameter_number> is always 1 since analog sensors only output one parameter, ie. the sensor output voltage.
Digital (I2C) sensors, standalone mode
{\"value1\":\"<sensor_input_number>\", \"value2\":\"<sensor_parameter_number>\", \"value3\":\"<sensor_parameter_value>\"}
where <sensor_input_number> is any number between 1 and 8 representing the sensor inputs 1 .. 8, and <sensor_parameter_number> is any number between 1 and 16 depending on the method selected for the digital sensor. The method determines how many parameter values the sensor outputs.
Digital (I2C) sensors, host mode
For a sensor that outputs a value for only 1 parameter the format is the same as for analog sensors:
{\"value1\":\"<sensor_input_number>\", \"value2\":\"<sensor_parameter_number>\", \"value3\":\"<sensor_parameter_value>\"}.
where <sensor_input_number> is any number between 1 and 8 representing the sensor inputs 1 .. 8, and <sensor_parameter_number> is 1.
For a sensor that outputs values for 3 parameters the format is:
{\"value1\":\"<sensor_input_number>\", \"value2\":\"1\", \"value3\":\"<sensor_parameter1_value>\", \"value4\":\"2\", \"value5\":\"<sensor_parameter2_value>\", \"value6\":\"3\", \"value7\":\"<sensor_parameter3_value>\"}.
The maximumm number of parameters is 16.
Testing
To test this feature use the digitizer in standalone mode. Configure the digitizer with EditorX to use eg. the Threshold or Peak signal processing methods to output a sensor value incidentally as a way to trigger an event. Sending messages to the web continuously at a high rate, eg. at 100 ms interval or less could have unexpected or even undesirable results.
For example, to use this feature with IFTTT.com do the following (assuming you have already created an account) at IFTTT.com):
- Create a new applet, eg. by selecting "New Applet" from the user menu in the top right.
- Click on the blue "This" word in the "If This Then That" phrase
- Enter Webhooks in the search field for "Select a service".
- Click the "Receive a web request" button.
- Enter a name for the event, eg. "I-CubeX_Sensor_Triggered".
- Click on the blue "That" word in the "If This Then That" phrase.
- Select an action service, eg. Email
- Click the "Send me an email" button
- Click "Create action". The applet is now created.
- Click on your username, then services.
- Choose Maker, and click on the settings on the top right near/below your username.
- Copy the URL to the Web field in Connect.
- In the URL replace the word "use" with "trigger/<name_of_event>/with/key", where "<name_of_event>" is the name given to the event, eg. "I-CubeX_Sensor_Triggered".
- Set the "Active" toggle in Connect.
Now, if the Web every time a sensor outputs a value an email will be sent to the email address specified in the applet.#