I’ve created a virtual switch that I want to turn ON if any door is open, and turn OFF if all doors are closed.
The ON part is easy because the dialog states the triggers are OR’d.
How would I implement the OFF part? There must be a way to AND conditions. Right?
See screenshots below. You can add each door’s both open and close event as trigger, so this rule will be kicked off when any of the door status changes. In the example below, I had two doors but you can add as many as you want.
Then in the flow, add first IF_Condition - when all doors’ status are ‘closed’, then set the switch to Off; otherwise, add the second IF_Condition - when any door’s status is open, then set the switch to On.
Since IF_Conditions can be nested and can be quite flexible in the case like this. Let me know if this helps.
Thanks, James. Works perfectly! (I’m sure you’re not surprised at that…)
James - I have another Rule Engine question. I’ve been able to get everything off IFTTT and over to Rule Engine - except for one thing. I have a switch I want to turn ON if the outside temperature falls below 40, and turn OFF when the outside temperature rises above 30. IFTTT makes this easy as they have triggers “If Current temperature drops below … Then …” and for “If Current temperature rises above…”. I haven’t found equivalent triggers in Rule Engine. Am I missing something? (I usually am…)
Hi Stan, are the 40 and 30 thresholds a typo or you meant it to be in this way? Wondering if you meant to keep the switch on when temp falls from 45 to 35, but never falls below 30. (So it will never “rises above” 30 and meet the 2nd trigger’s condition.)
Oh eventually it will rise above 30!
The applets are enabled only in the winter. A garage heater is on the switch. The way things are around here, if the temperature heads down at night it will keep going for at least another 10 degrees. If not tonight, next night for sure. In the meantime the garage will be warm.
I used this scheme last winter, and I think the year before too. It’s not perfect but its fail-safe operation keeps pipes from freezing!
I don’t know an alternate way to accomplish this feat. I’ll bet you do!
Does Rule Engine have triggers equivalent to “falls below” and “rises above”?
“falls below” and “rises above” is not currently supported in Rule Engine, but it’s in my list, and we had some internal discussion about it previously. The workaround would be using another two virtual switches to track the last temperature reading, and conditionally turn on/off the heater based on the new temperature value and these virtual switches’ status. See below for example:
Trigger: when temp changes and is greater than 0 (so every time when temp changes this rule will get executed)
- If VS1 is On and temp is less than 40, then turn on heater. (VS1 on means last temp reading was >=40)
- If VS2 is On and temp is greater than and equal to 30, then turn off heater. (VS2 on means last temp reading was <30)
- If temp is greater than and equal to 40, then turn VS1 on; else turn VS1 off. (update VS1 status)
- If temp is less than 30, then turn VS2 on; else turn VS2 off. (update VS2 status)
Not as clean as I wanted, but this should provide the same functionality.
James, thanks for the workaround!
I think I’ll stick with IFTTT for now until Rule Engine supports “falls below” and “rises above”. Due to the wisdom of your earlier comments, I’ve added an applet to IFTTT that will turn off the heater switch if the temperature rises above 45. Should take care of any possibility of the heater switch being on for an extended time.
Thanks again for your help.
James, IFTTT has is giving me some wrong advice these days; triggering when temperature is far from the correct value even though I’ve accurately set my location.
I’m going to implement the workaround you’ve outline above. However in looking at it, shouldn’t Flow 3 read, “… ; else turn VS1 off”?
Yes, you are right, I had a typo in Flow 3, and I just corrected it.
Out of my curiosity, have you checked the temperature log if it did somehow report the wrong value that triggered IFTTT?
Temperature log? Temperature log? The only temperature logs we know around here are the ones you throw on the fireplace!
James - I don’t even know where to find the temperature log. Nothing about temperature shows in the Hubitat logs. Sorry for the perpetual newbie status.
I’m using Open Weather (Wx). I recall that WU was retiring their API and wondered if that had something to do with the situation, however IFTTT seems to use WU exclusively.
I used IFTTT last fall/winter and it worked well. When I first started getting bad data this year I went into the applets and saw that they showed my location as being in the arctic circle! Appears to be something that the applets did on their own. I corrected the location and for a couple of days thought I was getting good info. When funny stuff started again I went into the applets to confirm that the location was correct. That’s when I decided to disconnect the applets.
I guess we didn’t have to use any “temperature log” here in Texas. You can find the device’s event history by going to Devices from the left menu-> Select the device you want, and click on the “Events” at top to see the history events.
I look at the events for the switch(Garage) that the IFTTT applets control, and all I see is pages like this:
I see that it is turned off and on, but I don’t know what the temperature was that caused the event. Am I missing something (as usual)?
Sorry @Stan_Silverman, I meant to ask you to check the temperature reading history, not the heater. Was curious what data really triggered the applets.
James, when I display the Rule Engine list, two of the rules show colorful spinning circles. “Syncing”. I’ve checked them for an hour or so and they’re persistent. The rules are associated with the workaround for “rises above” and “falls below”. The rules have been working correctly as best I can tell.
Do you have insight into what’s happening?:
@Stan_Silverman, thanks for reporting. I looked into this and found a potential timing bug when updating the sync flag. I’ve corrected your rules’ sync flag, and implemented the fix in my dev environment to prevent this from happening in the future. There is no action needed from your end and both your rules should function as configured.
James - I’m trying to create a new rule and getting the perpetual syncing circle again.
@Stan_Silverman can you pm me the rule? And I can manually sync for you. I will also make sure the fix is included in the coming release. Thanks for reporting and sorry for the inconvenience.
hi @James is there any update on implementing falls below and rises above? thank you!