Jump to content

Example of passing user variables to Outbound Trigger for IFTTT (sending sensor notification to Slack)


bwade913

Recommended Posts

Posted (edited)

I just got this notification program for Yolink Leak Sensors working  so that a notification message is sent to a Slack channel with information about which sensor(s) was/were triggered. I wanted to use a single Network Resource, to pass information about which of the four leak sensors triggered, so it needed to pass four variables. I ran into some hurdles, so I'm writing this example up to guide other noobs through the process.

I have one program for each sensor, that sets a variable specific to that sensor. It sets the variable if the sensor is reporting "Wet" and then resets it if the sensor goes back to "Dry". If it's wet, it runs the resource.

image.jpeg.0daa5255b049628321b44cc4acb1ed78.jpeg

 

The resource "Water_Sensor" then passes all four variables as "value1" per the wiki. There are three values that can be  passed to IFTTT. I used only one, since I'm fine eventually printing it all as a single string.

Note the variable syntax:

${var.<valueType>.<valueID>}

var is a string indicating a variable. Don't substitute your variable name, like I tried to do.

valueType is set to "1" because these are integer variables. A state variable would need a 2 here.

valueID is set to the number in the first column in the admin console variable page that corresponds to your variable. My variables are 2,3,4,5 because I've only used one variable before this.

I used the event name Water_Sensor and have an IFTTT applet of the same name.

To get your IFTTT "key", go to the following page and select "Documentation".

https://ifttt.com/maker_webhooks

 

image.thumb.jpeg.dde69e089c45a5c5f9c0b5885b5fa05e.jpeg

 

There is a a mistake in the Wiki, first noted on this forum five years ago where it says to in IFTTT, create a recipe using "maker", where you really need to use "webhooks" for the This section.  Using webhooks, there are two options, one that supports JsonPayloads and the other "Receive a web request" which supports the value1, value2, value3 string passing that we are using. In the screen cap below, I am showing what it looks like when "Add ingredient" is selected to insert the variable strings. Besides "value1" I used "EventName" and "OccurredAt" to capture the name and date stamp. 

image.thumb.jpeg.69dcc65571afd602424af5ace2efacec.jpeg

 

Here's what the notification message looks like in Slack. My wife pointed out that I misspelled Laundry.

image.jpeg.9ccb08ad21295f55de409522037d7c65.jpeg

 

BTW, I'd be interested if anyone can explain what JsonPayload would be useful for and whether UD supports it.

Edited by bwade913
  • Thanks 1
Posted

Thanks for this, until now I did not have a use for IFTT. I also have Slack at work so was able to get this running here.

I notice that there are a couple settings you must have adjusted: Content-Type: application/json and checking the Use SNI was key in making this work.

I sucessfully have it working, just not using it for anything practical yet.

 

Posted

Good to hear. Those setting differences are mentioned in the Wiki in the section about passing parameters to IFTTT. 

Posted

Where is the WiKi??  I'm fresh off the boat here, but based on this, have ordered and received a set of YoLink leak sensors and hub and would like to integrate to my issy.

I have an Issy994i with zwave module and insteon plm.  It's working great, so if possible, I'd like to keep it, and integrate.

Do i need a raspberry pi?

Do i still need the yolink hub? 

Posted
7 hours ago, johnstonf said:

Where is the WiKi??

Same place it's always been - https://wiki.universal-devices.com/index.php?title=Main_Page

Currently the best way to get node servers to link YoLink to your ISY is through eisy. You can continue to use your current ISY994 if you cannot get all the parts needed through the Canada distributor for UDI. I think others had said some items were not currently in stock. 

7 hours ago, johnstonf said:

Do i still need the yolink hub? 

That I'm not sure. I don't use YoLink so don't know the process. I would assume so, but you need to read their site first to figure out how to make their system work. 

Posted

@johnstonf yes you will need the Yolink hub. The node server gets the device configurations from the hub and makes them available in the admin console.

All of the Yolink devices I've tried so far (leak sensor, motion sensor, switches) have been very reliable. The Yolink NS developer is in the process of adding support for a Yolink remote, the four button "fob" product. Yolink makes an eight button remote that will never be supported by the NS, because it does not link to the hub, it only links to other Yolink device with a direct device to device link.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      37.2k
    • Total Posts
      372.4k
×
×
  • Create New...