Rule machine - as per the app developer, this app is no longer available for new installs, distribution, or support

I installed this SmartApp tonight in hopes that I could create a rule based upon a current running Logitech Harmony state. However, I don’t see a way to do this even with virtual switching because the Harmony app doesn’t expose devices or their states, let alone the hubs reported state… I noticed that a couple of people in this thread have run into the same issue or researched the problem before; I am hoping that someone can point me in the right direction.

As a hypothetical example, I would like to create a rule that would only run given certain circumstances (harmony states):

IF [Harmony Activity == ‘Watch TV’ AND Motion Sensor == ‘active’]
THEN [Turn light in room on]

It is really disappointing to me that the official Harmony Smart app lacks properties/methods to easily expose these basic states so that you could easily integrate this functionality into your rules engine. I hate to say this, but a couple of talented Vera (LUA) programmers have figured out how to expose logitech hub state as well as individual device state without the grief (or SmartLab status) that the SmartThings Groovy model seems to create!?

Bravenel, this is exceptional work on your part, thanks for the time and effort! Somebody please tell me that I am missing a very simple way to accomplish this task…

I checked out the “Dimmer Level” as a condition, and it works.

Everyone should be aware however, that when a dimmer is on and at a level, and then the switch is set to turn off, that the dimmer retains the level of the dimmer setting even though the light is off. So if you want to set a condition that says: if the dimmer is < X, where X was the last dimmer setting when the light was on, a rule based on this condition won’t trigger when the light is off (if it was turned off and not dimmer to zero) because the dimmer setting is still at X (even though the light is off).

Also currently the only way to delay a light off is to use the “Turn off these devices after a delay”, which switches the light off but retains the dimmer setting at the old level. So using the logic above creates a little bit of an issue in using the dimmer level as a condition.

This would still exist, but be alleviated a bit if everything had a delay timer as requested by others since one could delay then set the dimmer to zero instead of delay then turn switch off.

My experience in live testing is that if the rule fires True, the countdown timer starts. If that rule turns False before the countdown timer ends, the timer continues to count down and trigger the switch off. However, if the rule fires True, then False, and True again all within the countdown time, the countdown timer restarts with the full time and turns the switch off at the end of that countdown. (ie there is no way to stop the countdown and the switch must eventually turn off, but the timer can be restarted during the process if the condition goes False and True again within the original time)

Not a bit of difference…

1 Like

Ok, understand the desire to keep it simple. However, by not deactivating the counter on False, I get the following behavior with timer set to X:

  1. I enter the room, a rule triggers True and the lights turn on. If I leave the room, a separate rule delays X and turns the lights off. (this works for me)

  2. I enter the room, a rule triggers True and the lights turn on. If I leave the room, re-enter the room, and leave the room again all before X time, the timer resets to a new X upon my last leave and the lights turn off after that. (This works for me)

  3. I enter the room, a rule triggers True and the lights turn on. If I leave the room, re-enter the room and stay in there until the original X time runs out, the lights turn off while I am in the room. (This behavior is difficult to deal with)

So if I could select to have the timer deactivate completely when it turns False, then wait for a new True, the behavior in (3) would not occur. This is why I am asking for it. Or I suppose I could remain completely still prior to every X minutes once any period of stillness has occurred. I think this would also fix the issue :smile:

1 Like

Because there is an official SmartThings/harmony integration, which is there is not for Vera, there are already two simple ways to accomplish this task. I don’t want to hijack this thread, I will give you the links to a harmony topic where you can ask any follow-up questions.

Method one: just include the SmartThings device in the harmony activity

Because the Harmony/SmartThings official integration is Two way, you can already add any device controlled by SmartThings to a harmony activity as a home control device. So you can already just have say a “watch movie activity” which is triggered by your motion sensor also turn your living room lights to dim and turn your hallway light on right in that harmony activity.

So SmartThings sensor turns on Harmony activity which turns on SmartThings light. Two way integration in a single Harmony activity. This requires no custom code at all, it’s just selections from the drop-down boxes in the harmony app. :sunglasses:

Or you could have a “good night activity” in harmony that shuts off your home entertainment system, locks the door, and turns off some lights.

Method two: include a virtual switch in the Harmony activity, and on the SmartThings side have a restricted routine or a smart app subscribe to that switch going on

This is how you would manage something like the “watch movie” activity coming on but only, say, after 6 PM and then have other things happen. That is, anytime you turned on The “watch movie activity” the virtual switch would come on, but you would set up the routine or the smart app to not run unless other conditions were also true. So that’s how you would keep from resetting lights during the daytime.

As I said, both of these are already available. Which one to use just depends on the needs for the specific use case.

Here’s the FAQ on the Harmony/smartthings integration. You could also create your own topic under projects if you want to brainstorm a specific set up. :sunglasses:

As far as using rule machine with it, if you need that, the second method would probably be more appropriate. And you would just trigger from the virtual switch Being turned on.

@bravenel - I shot a pull request your way that may fix this (at least it does for my specific case). The logic may need to be tweaked a bit, but I think it’s on the right track.


I would think, if I understand your question correctly, it would only make a difference if you had an AND mixed in.

condition = z AND condition = x OR condition = y
condition = z AND (condition = x OR condition = y)

Too add some more food for thought, in terms of ultimate flexibility for the actions there are some additional ideas. Your rule engine, or conditional evaluation part is incredibly flexible. Close to being able to take over for most apps. There are certain input limitations that prevent this, and the actions or outputs are not as flexible as some of the custom one off apps. Clearly, the condition evaluation part of rule machine is as deep as it can get - which I think was your big focus, and incredible contribution.

Say I make a rule to determine if the mode changes to home - if true then:
Front Door Lock UNLOCK
Light Living Room Turn switch ON
Light Driveway Turn switch ON
Light Front Door Turn switch ON
Wait 1800 seconds THEN Light Living Room Turn switch OFF
Wait 600 seconds THEN Light Front Door Turn switch OFF
Wait 600 seconds THEN Light Driveway Turn switch OFF
Wait 1200 seconds THEN Front Door Lock LOCK

So on this action I can set custom delays for each action I decide to take. Makes one rule be able to kick off a set of actions, close the loop and run them all down with different delays for each. Single rule does everything I need without virtual devices, etc

Just but one example.

Speaking of which, there are ways to do these things in other apps, rule builders and the such, the big advantage that I see to yours it I am not authing a 3rd party engine, this is all right in SmartThings. Not putting you on the spot or asking you to justify your app, I think it’s great. But the question is for all - what is the big advantage FOR YOU - your use cases, your preferences - of using this app over others?

For me, I’d love to get to the point where this collapses 98% of other apps,and keeps advanced condition evaluations and actions in a smarthings smartapp instead of going 3rd party.

I love this smart app, and really appreciate everything you put into it. I know you are getting a lot of requests for additional functionality. I don’t want this to turn into a full-time gig for you, but there is one thing that I would love to see added.

I would really like to see triggers worked in. For example, I would like to be able to say, when a switch is turned on…not just that it is on. In fact, I would like to do both.

Here is an example, I have some Z-wave switches wired with no-load and Hue bulbs in the fixtures. With Smart Lighting I can turn the lights on and off from the switch. However, if I use any other method to turn on the lights then the switch will not turn them off. The state of the switch is already OFF.

What I want it to do; WHEN the switch is Turned OFF…IF the bulb is ON…Turn the bulb OFF. The state of the switch would never change in this case.

This may already be possible in the current version of the Rule Machine and I just haven’t thought my way through it.

Also, would it be possible to use Routines as triggers? I know you can lunch a Routine as an action, but what about the other way around? Could you say, WHEN Good Morning is activated…do X? Now I’m just musing.

1 Like

I’m confused about what you’re asking for in this post… the scenario you suggest of turning lights on and then delayed off works, does it not for you?

Well, you’re right on base, not that this is bruce’s cross to bear, but the ‘inputs’ and ‘outputs’ here aren’t as flexible as would be required to take over the functionality of many apps I know I use.

The evaluation part is the incredibly flexible genius part.


I have specific delays for specific lights. Not all the same delay.

AND delays only currently work for a switch. Although my example was switch, the delay would be more flexible if it were merely an option you can add to any action.

You make a good point though, and I am going to modify my example to demonstrate locks. Varied delays to those actions as well.

What I want it to do; WHEN the switch is Turned OFF…IF the bulb is
ON…Turn the bulb OFF. The state of the switch would never change in
this case.

you would write a rule that has your switch and hue bulb as conditions, and set the switch condition as OFF and Hue Bulb ON, and your action would be to turn bulb OFF.

someone did suggest a universal delay/timer option, and I think that made it on the list of potential future updates. Though, if you really wanted to pull that kind of rule action for locks before any kind of universal timer in Rule Machine, you can add a virtual switch and tie it to the lock…

What happens there is; whenever I turn on the Hue bulb (not via the switch) it turns itself off immediately. The rule reads the two states as soon as one of them changes and activates.

Brutally honest question… why not set up your actions etc to turn the bulb on by the switch instead?

1 Like

Perfectly valid question. I do. However, I can not control color via the switch. So I have some automatons setup that can set colors and dim levels. Also, from time to time, I turn on the lamps and set the color directly form the ST app. I even use the Hue app occasionally.

At any rate, it was a simple example. I also want to make a toggle switch for my Garage door so that I don’t have to have an ON button and an OFF button. The wife doesn’t love that. Then there’s the fireplace control…

Not really and difference in terms of efficiency. However, read the paragraph in the original post about Rule Machine concerning how it evaluates the rule.

At this point there is no extension of Rule Machine into integrations (Harmony, Hue, Echo, etc.). It supports core ST capabilities.

This is well beyond the original intended scope of Rule Machine. Timers can be very tricky, and I maintain that they are best implemented in an app that has some context, which Rule Machine does not. I will look at enhanced timer functionality.

If effect, it already does this. The app subscribes to the events of a switch that is a condition. When the rule evaluates, obviously it looks at the state of the switch. Due to the subscription, when the switch is turned on or off, that triggers an evaluation, which discovers the state of the switch, and if the rule truth changed, caused the actions.


I found it easier not to mix functions with rules. What I mean by that, is I keep the “virtual toggle” functions separately from the Rule. You can set up " virtual groups" of switches in Smart Lighting that would tie your bulbs to the switch. Group A …when switch turns on/off, also turn bulbs on/off. This way your bulbs will always be in sync with your switch. One less condition to remember when setting up other rules…