[DEPRECATED] Trigger Happy!

Small bug fix update: Version 1.0.1

Release notes:

  • bug in disable trigger identified and fixed

To update: copy code for Trigger from Github https://github.com/bravenel/SmartThingsPublic/blob/master/smartapps/bravenel/trigger.src/trigger.groovy
Paste it into Trigger in IDE, overwriting previous version, and Save. Do not publish!

1 Like

Hey thanks. Will this solve the issue I mentioned? Also, where is “rule”? Are you saying I should just replace the existing code and click save?

I highly recommend NOT using a mode. The problem is that the trigger is going to fire everytime the power meter reports its power. So, this isn’t the way to go about this.

You could use a Rule to do it instead of a Trigger. The conditions of the Rule would be the same, namely power over 100. The difference is, that the Rule will only do the action when the rule truth changes. It shouldn’t change until the power goes below 100, at which point, if you want, it could rebrighten the lights.

Github integration is now live for Trigger Happy. See the OP above for the links.

3 Likes

How do I set up a rule? I’m not sure how to tell the difference between a rule and a trigger? Is it a different app?

Sorry, go here to get started:

Can someone explain how to setup GitHub replication for other repo’s besides the Smartthings master one (i.e: to @bravenel)

Form another thread:

Thanks. The problem is YOUR smartapps are under a subfolder in the smartapps subdirectory. Therefore when I map to that repo, it doesn’t show your smartapps, only the ones in the root. My guess is you linked the public ST repo to your public repo, and then added yours? Also - I see your Rule and Rule Machine smartapps, but not your Trigger and Trigger Happy smartapps.

Got it. Thanks again!

New version released: Version 1.1.0. This introduces an enhanced feature, thanks to @adgwill!

Release notes:

  • It is now possible to compare values of one device to another device of the same type. This feature is available for temperature, humidity, illuminance, power, energy, battery, and dimmer level. Now those can be compared to a numeric value, or the current value of another device.

  • Added dimmer level as a condition that can be tested, relative to a number or the level of another device

  • Cleaned up mode input

To update: copy code for Trigger from Github https://github.com/bravenel/SmartThingsPublic/blob/master/smartapps/bravenel/trigger.src/trigger.groovy
Paste it into Trigger in IDE, overwriting previous version, and Save. Do not publish!

2 Likes

I have have setup a trigger to trip when I physically turn on a switch. I choose “physical switch” but the trigger won’t trip. It works fine if I use “switch” but obviously is not a solution to only trip when a switch is manually turned on.

If I choose physical switch nothing trips. Not a physical turn on or from an app.

Is there something I am not understanding on how to use this feature?

Not yet had the chance to try this but based on the success of previous releases… I cannot wait!! Should give my nest a very ‘smart’ upgrade!! Thanks Bruce @bravenel

So this morning I had a very simple trigger fail to fire. I reset the trigger to a later time and tested it, it worked fine then.

I’m not sure how to get a log on something that doesn’t fire.

This is the trigger:

Bear in mind, that Trigger Happy is as susceptible to ST problems as any other app. I’ve had one fail also. At this point I delete the one that failed, and put it in again.

I had 3 instances of a different smartapp that were failing on every mode change from Night to Day, but worked for all other mode changes. Go figure! Again, the fix was to delete the apps, and put them in again. Now they are working again properly. It seems that sometimes ST’s database gets bad links or something.

It’s just very odd, since I do not use mode changes at all.

Also, the only things I have had fail were only in trigger. I moved the others back to rule machine and they work just fine.

I only mentioned mode changes as an example of how the cloud can have little corruptions in its data and links. Removing and reinstalling the app is the fix. It has nothing to do with Trigger Happy vs Rule Machine.

2 Likes

I have a Legrand Event Controller (RFLC) on my LAN that controls zones and scenes for the Legrand Adorne whole-house lighting. Can Trigger Happy be used to go to a specific url on my LAN that will trigger a lighting scene e.g. http://192.168.1.15/rflc_ctrl.cgi?_=1448798872198&cmd=sexec&sid=1.

1 Like

You would have to have an intermediary app, that could access the url, when triggered by a virtual switch that is flipped by Trigger Happy.

1 Like

Bruce,

Not sure if I’m going about this the right way or not. I wanted a trigger to fire if a button is either pushed or held.

Our toddler is afraid of going upstairs to the bathroom when the room and hallway are dark, so I grabbed an Iris Smart Button and created the following trigger so he could turn the lights on/off with a button push. He tends to keep his finger on buttons longer than necessary, so I also added the “held” trigger:

The event only fired if I held the button, never when pushed, because the for() loop enclosing the if(evt.name == button) makes result equal to the last condition checked. In this case, the push condition.

I was able to resolve this by adding a break statement in testEvt() like so (5th line from the bottom of this snippet, line 711 in the full file):

def testEvt(evt) {
    def result = false
	if(evt.name == "mode") return modeXOk
	if(evt.name == "routineExecuted") {
		for(int i = 1; i < state.howMany; i++) {
			def myCapab = (settings.find {it.key == "rCapab$i"}).value
			def state = settings.find {it.key == "state$i"}
			if(myCapab == "Routine") result = result || evt.displayName == state.value
		}
		return result
	}
	for(int i = 1; i < state.howMany; i++) {
		def myDev = (settings.find {it.key == "rDev$i"}).value
		myDev.each {if(evt.displayName == it.displayName) {
			if(evt.name == "button") result = getButton(myDev, evt, i)
			else result = getOperand(i)}
		}
		if (result) break
	}
//	log.debug "testEvt result: $result"
	return result
}

I’m obviously not as familiar with the code as you are so I’m not positive that this won’t break something. That said, I like to offer at least a half-baked solution to problems I find. =)