esp_ifttt_maker is a component for the esp-idf framework, designed to connect to the IFTTT’s Maker Webhooks service for sending events.
The source code of esp32_ifttt_maker is available on Github.
To use the component in your program, first download the most recent release. In the folder that contains your project, create a subfolder named components.
Unzip the archive downloaded from Github into this folder, so that:
First you have to include in the main program the component’s header file:
Then initialize the component calling the ifttt_maker_init method specifying the secret key of your IFTTT account as the argument:
You can retrieve the key in the Maker Webhooks settings:
To send an event to the service, you can use the ifttt_maker_trigger method that accepts the name of the event:
If you need to specify any parameters, you can use the ifttt_maker_trigger_values values which accepts as parameters the name of the event, an array with the parameters and the number of parameters in the array:
ifttt_maker_trigger_values(char* event, char* vals, int valc);
Both the methods return a numeric value that is the result of the call. The possible values are:
#define IFTTT_MAKER_OK 0 #define IFTTT_MAKER_ERR_DRBG_SEED 1 #define IFTTT_MAKER_ERR_CONNECTION 2 #define IFTTT_MAKER_ERR_SSL_DEFAULTS 3 #define IFTTT_MAKER_ERR_SEND 4 #define IFTTT_MAKER_ERR_KEY 5 #define IFTTT_MAKER_ERR_UNKNOWN 10
In general, if the value is 0 the call was successful, while a value > 0 means an error.
A complete example that shows how to use the component is described in this post.
Here a short video about the demo program:
[youtube id=”amb0Tdu2Lns” width=”600″ height=”350″]
– First public version