IFTTT rule not working

Hello @bravenel,

I can't get the IFTTT to work correctly. I have a Roomba virtual switch setup with IFTTT monitoring that switch. If turned on it should start the roomba. Here are the errors I see in the logs:

app:4592018-09-12 11:51:38.582:errorpostJsonData Error:[errors:[message:No notifications were found in the request body.]]

app:4592018-09-12 11:51:38.318:debugCreating Trigger Event(trigger_on) - Roomba(switch: on)

1 Like

I have the same thing. Known issue, supposed to be fixed in next release.

1 Like

Driving me nuts this one, have to keep checking whether my "goodbye" set the Wyze cams on :frowning: Sometimes yes, sometimes no.

I have IFTTT to control my Neato with a virtual switch, sometimes it takes hours to respond, hope we see that upgrade soon, apparently it will have a lot of fixes.

I found a URI Switch by tguerena on the ST forum. I modified for HE and added a state change so you can use the driver when creating a virtual switch. Then it can be used as a normal switch triggering each webhook you may want, one for on, one for off. I haven't tested any local URL executions, but don't see any reason they wouldn't work. I simply needed the ability to execute webhooks.

Now I can trigger what I want without errors whilst we wait for a fix. Just enter the Webook path in the External On URI for on, and External Off URI for off. Have this working some Magic Home LED controllers, Harmony executions and enabling motion detection on my Wyze cams linked to triggers from SHM, working very nicely.

	/*
* Author: tguerena and surge919
*
* Device Handler
*
*
* Modified by Royski for Hubitat 14/09/2018
* 
*/


preferences {
	section("External Access"){
		input "external_on_uri", "text", title: "External On URI", required: false
		input "external_off_uri", "text", title: "External Off URI", required: false
	}
	
	section("Internal Access"){
		input "internal_ip", "text", title: "Internal IP", required: false
		input "internal_port", "text", title: "Internal Port (if not 80)", required: false
		input "internal_on_path", "text", title: "Internal On Path (/blah?q=this)", required: false
		input "internal_off_path", "text", title: "Internal Off Path (/blah?q=this)", required: false
	}
}




metadata {
	definition (name: "URI Switch", namespace: "tguerena", author: "Troy Guerena") {
		capability "Actuator"
			capability "Switch"
			capability "Sensor"
	}

}

def parse(String description) {
	log.debug(description)
}

def on() {
	if (external_on_uri){
		// sendEvent(name: "switch", value: "on")
		// log.debug "Executing ON"

		def cmd = "${settings.external_on_uri}";

		log.debug "Sending request cmd[${cmd}]"

			httpGet(cmd) {resp ->
				if (resp.data) {
					log.info "${resp.data}"
				} 
			}
			sendHubCommand(result)
			sendEvent(name: "switch", value: "on", isStateChange: true) 
			log.debug "Executing ON" 
			log.debug result
	}
	if (internal_on_path){
		def port
			if (internal_port){
				port = "${internal_port}"
			} else {
				port = 80
			}

		def result = new hubitat.device.HubAction(
				method: "GET",
				path: "${internal_on_path}",
				headers: [
				HOST: "${internal_ip}:${port}"
				]
				)
			sendHubCommand(result)
			sendEvent(name: "switch", value: "on", isStateChange: true) 
			log.debug "Executing ON" 
			log.debug result
	}
}

def off() {
	if (external_off_uri){
		def cmd = "${settings.external_off_uri}";
		log.debug "Sending request cmd[${cmd}]"
			httpGet(cmd) {resp ->
				if (resp.data) {
					log.info "${resp.data}"
				} 
			}
			sendHubCommand(result)
			sendEvent(name: "switch", value: "off", isStateChange: true)
			log.debug "Executing OFF" 
			log.debug result
	}
	if (internal_off_path){
		def port
			if (internal_port){
				port = "${internal_port}"
			} else {
				port = 80
			}

		def result = new hubitat.device.HubAction(
				method: "GET",
				path: "${internal_off_path}",
				headers: [
				HOST: "${internal_ip}:${port}"
				]
				)

			sendHubCommand(result)
			sendEvent(name: "switch", value: "off", isStateChange: true)
			log.debug "Executing OFF" 
			log.debug result
	}
}
1 Like

Well,, I couldn't resist. There is extra code in there that is not necessary on Hubitat, so I cleaned it up added some logging config and here it is. Since everything is local on Hubitat, you don't need to treat external in internal URIs any differently. It's always difficult to decide when to credit the original creators, but I figured since I basically changed every line in the file, I would just make it a generic "community" for namespace, etc.

2 Likes

Brilliant @chuck.schwer, thank you very much for your help! :slight_smile:

update Works like a charm :+1:

Well, @mike.maxwell is always around to keep me honest, I made a couple more updates to the driver to only send the on or off event if there is a successful response from the URI. It is availabe in our public repo now.

1 Like

Nice idea! Updated thx :slight_smile:

@chuck.schwer could you give a bit more info on using this to deal with the broken IFTTT \ Virtual switch issue?

Are you using the webhooks service in IFTTT?

I am not, yet. Still trying to figure out how that works.

If you add the webhooks service, then once added you can view the documentation and obtain the URL you need.

In the URL the “event” can be replaced with the text you can use to trigger automations you set up.

So when the “event” is called, it will trigger the applet you’ve configured. Example.

If I create one like the below, it will set my Nest to 22 degrees. “boost_heat_on” using this as the section in the URL you’ll see in your documentation.

Once you have an applet like this, the full URL would be used in the On URI. Then you can assign another if you want for the Off URI.

Hope this makes sense as I’m on my phone :wink:

That got me a lot closer @Royski. I've got the Webhooks services connected now.

I created an IF that looks for blink_on. I've also created a virtual switch in Hubitat and have it using @chuck.schwer's httpGetSwitch.groovy driver.

I've got the xxxx://maker.ifttt.com/use/crtxxx link that is associated with my webhooks connection. I'm still missing something on how to do the "full URL" part.

Now look at the service again, then “documentation”. This will give you a full link with /{event}/ in. Replace the {event} with the name you’ve used for your applet without {}

Then it should be pasted in the On URI. Then flip the switch :+1:

It was that "documentation" step I was missing. Thanks for the help @Royski

1 Like

What response is required... currently my get requests are to a perl script that
provides no response at all... is there a specific response require would would any
valid html code be ok...
Thanks... I'm still a newbie... only had my Hubitat since Nov. 20...
lot of fun learning to do...

None, will do just fine