Trigger *Changed* is showing as on/off in actions to run

I have a powder room with a motion sensor, light, and fan. Using the motion lighting app, If the motion sensor is activated, the light turns on, and turns off after 5 minutes.

I'd like to enhance this to: if the fan is on, set the time out to 10 minutes. If either button is turned off, it turns both off.

IF (Motion)
THEN
	Turn on light
	IF (Fan is on)
	THEN	
		IF (Light or fan turns off)
		THEN Turn both off
		ELSE
			Turn both off delayed 10 minutes
	ELSE
		Turn light off delayed 5 mins

I made two attempts in rule machine and the motion lighting app, but I got closer in the rule machine. I selected fan or light is changed in triggers, but when I try to use that trigger in the actions, it only checks if the fan or light is on. Image below, the red circle is my problem.
Rule

I don't know if the motion light is powerful enough to do what I want. I could only make it disable turning the light off when the fan turns on.

Triggers are events: a switch turning on or switch turning off, for example. "Changed" is a catch-all trigger that includes a change to either of those states. An event matching a trigger will cause your rule actions to run.

Rule actions can optionally use conditionals. These reflect states: a switch being on, for example. "Changed" would not make sense here because that is an event. Events do not have truth values and cannot be evaluated in an IF (which must ultimately be true or false); states do. States are also not events, though a resulting state may be caused by an event. Your rule triggers (or specific actions like "Wait for condition/event" in your rule) are the only things that will create "subscriptions" to device events; a condition on its own will not. Perhaps this will help explain why you see what you do.

Additionally, an IF ... THEN requires a matching END-IF to "close out" the block. I'm not sure that's actually a problem for you above, but it would be if you had additional actions pertaining to the "outer" conditional after your "inner" conditional. It's good practice, regardless.

That being said, I'm not sure RM is the best tool for this job. Motion Lighting, which it sounds like you were using, has two options that may help: "Buttons to turn off lights" (you said "button" but it's not clear to me if you actually get button events from whatever devices you're using; this will work if you do, as you might from Z-Wave Central Scene switches/dimmers) and "Switches to turn off lights" (it's a bit odd but would probably work if you added the fan and light here so that either turning off would trigger the whole app to turn "both" off). Alternatively, complementing your Motion Lighting app with a Simple Automation Rule "triggered" from whatever you want to make both turn off may also work. Exactly how you implement this would depend on the specific "button" device you have, so feel free to ask more if you're not sure.

Thank you for the detailed information. My apologies for the incorrect terminology, they are in wall switches, not buttons. I will explore the simple automation rules. I have a few already for turning lights on and off at specific times, so I may be able to make the two work.

I didn't mean to disappoint--you actually might still have some luck there. :slight_smile: Many of these nowadays send Z-Wave Central Scene events for taps/multi-taps, presses, and holds, which the hub can interpret as button events. Inovelli, Zooz (with recent firmware), HomeSeer, and some GE models (I think just the newer ones, and they don't really document this feature) are ones I know of that do. I'm not aware of any current Zigbee switches/dimmers (that look like traditional ones, anyway) that do, and the older GE/Jasco Z-Wave ones are a popular device that doesn't. If they do, I'd check out that option in Motion Lighting!

For reasons I can't explain, it appears to do what I want only when I have BOTH Additional and Switches to turn off. The 10 minute timeout may not be capable here, but a added a simple automation rule to turn the light/fan off 10 minutes after motion stops. If only the light turns on then the hubitat will send a turn off command to an already off light. I don't think that will be an issue. Thanks for guiding me in the right direction.

You shouldn't need "Powder Room Light" under "Additional switches to turn off when turned off"--that's for devices that the app doesn't turn on that you still want to turn off when motion stops (you're turning this light on, so it already "knows" about it; "Powder Room Fan" seems appropriate to keep here). If it only works for you that way, I can't explain why, and it theoretically shouldn't hurt (an extra "off" command to the device at most, I suppose?), but the setting I was talking about was "Switches to turn off lights," which it looks like is set up the way I'd expect. (It does seem a bit odd to put the same switch that's already getting turned off here, but that seems like the only way to make it turn off both when you turn off either. You shouldn't need an SAR to complement this in that case.)

But if you've found something that works, I'm not sure I'd recommend changing it. :slight_smile: Happy you got something figured out!

Ah the benefits of home automation! I did both the light and fan for two reasons:
First, we're conditioned to turning the fan off manually and letting the light turn itself off. This way if conditioning takes over we'll be covered.
Second is because of the way my house is laid out. When you leave the powder room, you generally turn 180* to the right to get to the living room/kitchen area. We've found that when we leave the powder room, our arm kind of lags behind pressing the switch while our body starts making the turn, so occasionally the fan switch gets clicked instead.
It's a use case for what works circumstantially.