Triggering based on another app

After finally having time to trial Smart Humidity Fan (thank you @neonturbo), and finding it performing as I needed, I wanted to know if there is some way to trigger a rule based on it being active – perhaps using the log entries that state when the fan was turned on and off?

Since that app is open-source, you could technically modify it to do whatever you want, including using the Rule Machine API to trigger a rule or run its actions. However, that might be a bit more of an undertaking than you want (unless you already are familiar with Hubitat development).

To directly answer your question, with rare exceptions, what triggers rules are events--generally state changes from devices (the exceptions are things like that API, specific trigger types you can add like local or cloud HTTP endpoints, time-based triggers, and whatever I might be missing off the top of my head). App events technically exist but seem seldom used and are not available as rule triggers regardless. Combing the logs, while probably not impossible, is also generally a bad idea when you could just look at the events that caused the app or driver to write them in the first place.

So: maybe it would make sense to trigger the rule (and check a condition in the actions) based on a combination of the on/off state of your fan and the humidity reported by your sensor? That seems like a way you could trigger a rule based on what you want without needing to modify the app or otherwise delve too far into custom territory. Jus tan idea!

I did start to look at the driver app (just because I like to tinker), but had no idea it could be modified to push out a trigger to the RM API. While I know your latter option is less involved (I probably could just find some other trigger that puts a window of time around the event when I could check for both the humidity and the fan running), the former is intriguing. How can I learn more about that API and developing drivers apps (or at least adjusting one)?

Edited - (see message 6)

Wait, is it a driver? I do not believe the RM API is accessible from one, only apps. I wasn't familiar with "Smart Humidity Fan," and all I found was an app when I searched for it. If it is that app, then it would work; however, the only docs I'm familiar with are the ones I linked to above, and I can't name any community apps that use it off the top of my head that you could use as a real-world example (it doesn't seem very commonly used).

I misspoke. Typed that as news was breaking that the President has COVID (don't want to get any more political on here than that). You're correct - I meant app. And I must have missed the linked docs for the same reason. My apologies.

Even easier...just use the fan switch as your trigger. If FAN = ON. Would that not work?

Or as jrfarrar said but taken a tad further make a virtual switch that rule A sets and then rule B can trigger on that virtual switch.

@tivomaniac and @jrfarrar

This was kind of what I was going for already. I wanted the other half of this to relate to the Motion Lighting option to not turn off if a sensor is active. So, I had made a virtual sensor and was using RM to activate and inactivate the sensor.

The reason I wanted to go beyond just the fan switch being on, which I also considered, was to not "latch" the light on if the fan was turned on manually. So, I thought I could do it off only whether the app automatically turned it on.

Surely the switch is probably a direct option in Motion Lighting, but that would mean it's not based on the exhausting of the humidity. Then, I want to "unlatch" once the Smart Humidity Fan app knows the humidity is dropping (but before the timeout finishes and the switch turns off). This way, when the bathroom is already vacant, the fan stays on, but the light goes off when its delay is up.

This might be easier if you tell us the results you want. Not sure what you are trying to do here but you might be complicating it.

1 Like

I ended up doing my own as I wanted it to work in a way I didn't see possible with the Humidity Fan app.

I have a group of rules to do this in RM the problem here is my household humidity varies pretty widely even when the shower is not on so I setup:

  1. Rule to capture the bathroom humidity into a global variable when the light is turned on and the fan is off.
  2. Rule to turn the fan on when the humidity rises more than 3% above what was captured in 1 and capture a new value at turn on time.
  3. Rule to turn the fan off once the humidity falls below the value captured in rule 2.

I also have rule 2 pause another rule that turns the fan off after 25 min in case it was set manually as the 25 min might not be appropriate when getting rid of the shower humidity. And then rule 3 unpauses that rule when the fan is turned off.

I have probably over thought it but it works for me. :crazy_face:

Would not surprise me in the least if I am :blush:.

Bathroom lights and fan are the targets (we're lucky to have toilet in it's own little WC type "closet", and it has its own fan, so no need to really address the additional need for a fan in the main bathroom area). Thus, primary need is just showering.

Also, @tivomaniac, I haven't given up on a full RM solution, but my family has been getting upset at my trial and error, and never knowing whether to use the switches or not. So, the apps seemed to provide a way to a quicker solution.

Back to intent:

  • Walk in :arrow_right: lights turn on (I will work on mode-based dimming values once I decide on mode settings)
  • No fan on :arrow_right: lights turn off after inactive motion + 3 minute delay (ideally manually turned on fan would do the same, but can sacrifice this for the next parts).
  • Take a shower :arrow_right: humidity sensor senses rise (I just began using a 2nd Zooz 4-in-1 with the motion sensor covered, so that the motion doesn't delay the humidity readings - something I observed and others in the community have noted also) :arrow_right: fan goes on
  • Fan being on :arrow_right: stops lights from going off (it's not a problem for me, but the shorter inhabitants of the home can't be seen over the shower door, and the PIR doesn't see through – or eventually when I try the kids' bathroom where the shower curtain blocks the motion sensor) otherwise the lights would turn off automatically.
  • After shower as humidity drops :arrow_right: keep fan on for approx 15 minutes after the drop is identified (I used some settings I found of @neonturbo from another thread in Smart Humidity Fan)
  • ...but allow the light to go back to turning off 3 minutes after no more motion is detected. That way the light isn't held on until 3 minutes after the fan finishes running its 15 minutes, but instead back to 3 minutes after the occupant exits.

So this sounds like the real problem. If you had a proper motion sensor there you would not need to deal with humidity and the fan for the lights. I see where you are going...

So, I have two. I can't tell if you mean proper, as in you're not in favor of the Zooz, or if I wasn't clear enough that there's one for the motion (where I'm now ignoring the other values because they only update when there's no motion), and now I added the second with the motion effectively disabled by covering the sensor, so that the humidity readings are consistently taken as they change instead of waiting for the motion to stop?

Adding to this, once I get this proof of concept working, I was going to look into a different motion sensor that was strictly motion only.

Maybe a 2nd motion sensor over the shower? I had to move mine a couple times to get good coverage in the shower as well as seeing someone come in but not trip if you were just outside the door. I finally found that spot but I know others just installed a 2nd sensor to do the trick.

I've thought of this too, and I have a little bit of worry of damage to the sensor due to it being right above the shower, but also it would still see enough of the room to turn on the fan with nobody in the shower (could definitely work regarding limited view in the kids' bathroom, though). I guess I could bring it down to a height that's less likely to see the rest of the room or a direction away from the rest of the room, but I'd be worried about it being too close to the water.

Not to post and run, but I've gotta hop on a meeting for work, so I may not be able to reply back to you all until this evening. Thanks for the troubleshooting, so far.

What I'm saying is a motion sensor/s the ONLY control the lights. Let your humidity sensor control the fan. Two different things that don't need to be tied together. So can your motion sensor sense while someone is in the shower? If not, that's where I'd adjust first. Then leave your humidity sensor(dedicated) and app run as is. Then only run your lights off of motion.

(stopped for lunch)

Yes. That's what I realized, and did before posting this. It's just I wasn't finding humidity-only sensors that people were entirely happy with on here. So, instead I took one of the additional 4-in-1 that I had and eliminated the motion sensor capability of it. I have that one for the humidity, and the original one that was in the bathroom for the motion (but open to other motion-only device suggestions too).

The trouble is my wife's shorter than shower door, so when it doesn't see her the light turns off (even though the fan is fine). I guess that's okay in the morning, but bound to get me in a lot of trouble if she's shaving, and it's not light outside.

Acknowledging your motion sensing comment - I could try to see if moving it closer to the shower would allow the visibility into it, and still be able to see the rest of the room. My hunch is that the bathtub, which is behind the shower stall, will then not be visible (young son still takes baths in there). I didn't mention but probably should have, I hate the layout of my bathroom.

couple of those will fix you up. I have the v2 version literally IN my shower stall. taped to the tile up high in a shelf. Been fine for years. The v3 version has humidity too, no idea if it's appropriate for what you are doing though. I specifically went with an in ceiling mount for mine Aeotec 6 because I had a lot of control over the humidity reporting. It also serves as an overall motion sensor in the bathroom. My Iris V2 ONLY sees you if you are actually in the shower stall.

Why can't you just pick the fan switch in Motion Lighting app, and use that to disable turning lights off? This is in the Options for Turn-on, Disable, and Enable Lights-On section.