Calling custom command from IFTTT?

Hi. I’m using Broadlink RM Bridge to control my A/C using @af950833’s code as a starter. Basically, I find that defining buttons as momentary buttons rather than a switch seems to be a better way for me. So I have something like

definition (name: "Broadlink - AC", namespace: "smartthings", author: "af950833 + fishix") {
		capability "Momentary"
        command "ac_off"
        command "ac_25"

def ac_off() { ... }
def ac_on() { ... }

I can send those commands fine. Now I’m trying to work with IFTTT so that when the door opens, say, have the A/C turn off. When I get to IFTTT setup (in Smartthings app), my custom device doesn’t show up. I believe IFTTT only shows devices with some specific capabilities (switches, motion sensors, contact sensors, etc.) but not momentary buttons. Just curious if there’s a way I can have the THAT part be a custom command.

This thread seems to suggest that a SmartApp could do that… but the code seems to have been removed. Any pointers would be very much appreciated.

Thanks so much!

This is the only momentary button I could find that would work with IFTTT.

Hi, if you have a virtual device you could try something called “CLOUD INTERFACE”

Basically, you can choose the virtual device and setup a http command link to the action
it would look like this:

Then you can afterward create an ifttt with action as “MAKE A WEB REQUEST”

  • Put your http link in the url field
  • method: post
  • type: application/json

This is what i remembered on top of my head (note i do not have this anymore!!!)

To show up in IFTTT it needs capability switch. The momentary button basically turns a switch on and then immediately off

Take a look at the ST code for the momentary button here

def push() {
	sendEvent(name: "switch", value: "on", isStateChange: true, displayed: false)
	sendEvent(name: "switch", value: "off", isStateChange: true, displayed: false)
	sendEvent(name: "momentary", value: "pushed", isStateChange: true)

def on() {

def off() {
1 Like

Thanks!.. so if I understand this correctly, I can have something like

definition (name: "Broadlink - AC", namespace: "smartthings", author: "fishix") {
    capability "Momentary"
    capability "Switch"

def push() { .... }
def on() { push() }
def off() { push() }

Then I should be able to create a device with one switch, right? That sounds reasonable enough. Thanks for the pointer!

I guess my next question is how do I create a device with many momentary buttons. One way is to create each button as a switch, then create a composite device. That seems a bit too cumbersome though. What I had in mind was having IFTTT calling a custom command in a device handler directly. Guess that’s not supported?

Yeah, that won’t work with IFTTT. It can only send an On or Off command to the device itself. There’s no way to do that with the standard IFTTT ST support to have multiple buttons.