Skip to content

Latest commit

 

History

History
120 lines (106 loc) · 5.97 KB

IFTTT.md

File metadata and controls

120 lines (106 loc) · 5.97 KB

Philosophy

The IFTTT is great service and integrating it in an IoT service can be wonderful.

Now, all the ideas can integrate into a real house,

For example, turn on Air-Conditioner when the weather in the area is above x degrees. Turn on the boiler when you enter the neighborhood. And any other great using.

Note, this is not an IFTTT module to used as device communication API, for this see IFTTT module

Implementation

Currently, the implementation of IFTTT integration is using IFTTT WebHooks. because implementing an IFTTT service requires registering a constant host to received IFTTT API calls, but this project made to be totally in the user's hands and control. so using Webhooks is the best option for it.

Step by step instructions

Create IFTTT and WebHooks accounts

  1. Create an IFTTT account or login if already own one.
  2. Connect WebHooks to Ifttt account.
  3. Watch and copy the webhooks API key.
  4. Login to casa-net as admin and go to settings (the small icon in toolbar) and in IFTTT integration section press on configure and paste the IFTTT api key.

Invoke IFTTT trigger when minion turned on/off

  1. Go to IFTTT applets page and press new applet.
  2. Press on the +this button.
  3. Choose Webhooks service.
    • Screenshot
  4. Choose the Webhooks trigger.
    • Screenshot
  5. Get the inner-id of a minion.
    • Open a minion menu and select device meta, then copy the inner-id value. Screenshot
  6. In event name put when, the inner-id of minion and the on/off operation, all divided by -, Look like when-xxxxxx-on, And press create trigger.

    Example here is for on operation, the off operation is just the same, but instead of 'on' put 'off'.

    • Screenshot
  7. Press on the +that button and select the Ifttt service and the action that turns the device on. For example sending phone notification, email alert, or any idea from the wide IFTTT ecosystem.
  8. Note that the 'Webhooks' trigger gives 3 variables to use, with the following values:
    • value1: contains the minion display name.
    • value2: contains the minion type.
    • value3: contains the current detailed minion status.
  9. Create the same trigger for off operation of a minion.

Turn on/off minion when IFTTT trigger invoked.

  1. Create a trigger to be invoked by any IFTTT trigger service.
  2. Select WebHooks as an action service.
    • Screenshot
  3. Select make request action
    • Screenshot
  4. Set the HTTP request as following struct:
    • URL: http://[casa-net server or remote server host/ip]/API/ifttt/trigger/minions/[inner-id].
    • Method: POST.
    • Content-Type: application/json.
    • Body:
      { 
        "localMac":"f4********83",
        "apiKey": "hjg***Webhooks API key***kjh",
        "setStatus": "on" 
      }
      
      the localMac field is required only if using remote-server. to get the local-mac-address login as admin, and in side-bar of settings click on get the local MAC address button.
    • Screenshot

Turn on/off minion when IFTTT trigger invoked with all data in one line of text.

It is used when the trigger gives only one text variable to pass to action. for example, SMS service allows passing the text message value to put it in Webhooks request.

  1. Create a trigger to be invoked by any IFTTT trigger service.
  2. Select Webhooks as an action service.
    • Screenshot
  3. Select make request action
    • Screenshot
  4. Set the HTTP request as following struct:
    • URL: http://[casa-net server or remote server host/ip]/API/ifttt/trigger/minions/raw.

    • Method: POST.

    • Content-Type: application/json.

    • Body:

      { 
        "localMac":"f4********83",
        "apiKey": "hjg***Webhooks API key***kjh",
        "minionId : "ac**ef",
        "setStatus": "on" 
      }
      

      the localMac field is required only if using remote-server. to get the local-mac-address login as admin, and in side-bar of settings click on get the local MAC address button.

    • In the example here putting in the body the ingredient text of SMS trigger: Screenshot

    • The SMS text message should look like: Screenshot

Invoke operation when IFTTT trigger invoked.

  1. Create a trigger to be invoked by any IFTTT trigger service.
  2. Select Webhooks as an action service.
    • Screenshot
  3. Select make request action
    • Screenshot
  4. Set the HTTP request as following struct:
    • URL: http://[casa-net server or remote server host/ip]/API/ifttt/trigger/operations/[operationId].
    • Method: POST.
    • Content-Type: application/json.
    • Body:
      { 
        "localMac":"f4********83",
        "apiKey": "hjg***Webhooks API key***kjh"
      }
      
      the localMac field is required only if using remote-server. to get the local-mac-address login as admin, and in side-bar of settings click on get the local MAC address button.
    • Screenshot

That's it ;).