[DEPRECATED] Trigger Happy!

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!


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.


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.

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


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. =)

Wh not just make two nearly identical rules, one with the single trigger pushed And one with the single trigger held?

Because that would be the easy way and not keep me up until the wee hours of the morning figuring out why it didn’t work my way? :stuck_out_tongue_winking_eye:


Hey, anytime you want to find a flaw in the code, have at it!! Nice catch!

Github updated: https://github.com/bravenel/Rule-Trigger/blob/master/smartapps/bravenel/trigger.src/trigger.groovy


He could, but he’s right, and there was a bug. Great deal, to have my bugs found and fixed by the community!!


Anyone chime in on what simple thing I’m missing? I tried to move some True only rules over to Trigger Happy per @bravenel’s suggestion but I don’t seem to get any events. I can see the events in the logs but nothing happens. I tried a real simple motion active - turn on a light and zero.
I get lots of this:
7bd28b97-c304-4929-85e2-f8b0795ec62c 4:25:45 PM: error java.lang.NullPointerException: Cannot get property ‘value’ on null object @ line 726
7bd28b97-c304-4929-85e2-f8b0795ec62c 4:24:54 PM: error java.lang.NullPointerException: Cannot get property ‘value’ on null object @ line 726
7bd28b97-c304-4929-85e2-f8b0795ec62c 4:24:43 PM: error java.lang.NullPointerException: Cannot get property ‘value’ on null object @ line 726
From my understanding these are basic statements without pre-state checking so the fact that the house is in home mode already isn’t stopping it from running the gauntlet - or is it?
Also, where is the output of the “Enable Event Logging” switch within the trigger?

Looks like a bug to me. Stay tuned, I may already have it fixed…