[SOLVED] 'not in' being ignored latest-22240-3b3254d6
-
toggledbitsreplied to gwp1 on Aug 31, 2022, 1:08 PM last edited by toggledbits Aug 31, 2022, 9:40 AM
@gwp1 Also I will need all of your storage folder, and a complete description of the problem with enough specifics ("it changed" -- what is "it"? And how did it change and why is that not right? And the time of the event to correlate to the logs) and how each of the rules and reactions involved is intended to work. Full logs. No snips. Screenshots as well.
I will PM an upload link here for you shortly.
-
gwp1replied to toggledbits on Aug 31, 2022, 3:23 PM last edited by gwp1 Aug 31, 2022, 11:26 AM
@toggledbits Uploaded.
"It" refers to
Mode
.The ruleset for
AWAY
is based on presence.Day
andEvening
have their rulesets which govern their use and both include the exception ofAway
which was not being honored since I deployed 22240 (but had been previously as these rulesets are older.)I've begun looking at them in earnest to see if there's fat that could be trimmed as they are very restrictive in my attempt to avoid false triggering of presence which opens the garage door.
Day
should be from sunrise and/or alarm clock time to sunset.
Evening
should be from sunset until 0130 ET,Night
mode enablement (manual) or, ifAway
, 2330 ET.
Away
should be any time presence is not detected by Home Assistant plugin iCloud3. -
toggledbitswrote on Aug 31, 2022, 4:46 PM last edited by toggledbits Aug 31, 2022, 1:17 PM
Got your files. I need timestamps for what you want me to look at.
-
toggledbitswrote on Aug 31, 2022, 5:20 PM last edited by toggledbits Aug 31, 2022, 1:26 PM
I went on a quick fishing expedition to see if I could bulk search out anything obvious.
Unfortunately, your storage doesn't completely sync with your logs. There are IDs for rules logged that don't exist in storage. If you've been editing/restructuring rules trying to solve this since the last time you caught the problem, that could cause this. So my comment below may reflect what I'm seeing before those edits, but nonetheless...
Preliminary review of the logs shows that your "Away" logic triggers your "Day" logic and causes a house mode change. At 23:16:30.474Z the system received notification from Hubitat of a house mode change to Away. This appears to be stimulated by a global reaction called "Mode:
Away" a few milliseconds earlier. This causes the evaluation of large number of rules. It is about two seconds before that reaction completes, having set a global variable as its last step at 23:16:32.162. Among the activities in that span of time is that a rule called "Day (from Away if before sunset)" (which I don't have in your storage, so I can't examine it) goes set, and its Set reaction starts the global reaction called "Mode: Day", which then sets the Hubitat mode to Day (and that event makes a round trip back to Reactor at 23:16:32.514 causing other changes). That's a bit suspicious. Shouldn't it stay in Away? It seems like Away would be an overriding mode?Anyway, at the moment, I'm saying that "not in" works fine, and you have a logic error/unexpected interaction. There appear to be a lot of complex interactions between several reactions that are run by the rules, and I suspect you have things stomping on each other. You may also be able to see this in the Rule History and Reaction History widgets in the status view. And of course, you can always confirm the current mode Reactor thinks the system is in by looking at the Mode entity, and comparing that value to the "current value" in the status for various rules.
-
gwp1replied to toggledbits on Aug 31, 2022, 6:38 PM last edited by gwp1 Aug 31, 2022, 2:39 PM
@toggledbits What you described is exactly what I was experiencing - I'm reviewing some rulesets now. I think, over time, I've overcomplicated things due to false positives in presence detection. I miss Lobo lol
What still doesn't make sense is how this was working fine until 22240 dropped in. Unless something way downstream of this was impacted by 22240 and that ran itself back upstream resulting in my experience.
Thanks for looking at this - I'm going to begin a top>down review.
-
@gwp1 Changes in 22240 were really limited, and not related to Engine work at all. I think it's more likely you had a race condition between conflicting rules, and the upgrade changed the timing of the race. That can be complicated by the performance of the hub (i.e. variances in how fast it responds to requests), etc. Keep in mind that when you have a reaction start another reaction, they both run at the same time; the starter doesn't wait for the started to finish. And further, there's no guaranteed order to which resumes if both delay to the same instant in time. Unlike Reactor for Vera, which was pretty single-threaded because of the way the Lua API worked there, MSR is very asynchronous and concurrent.
One structure that can help concentrate logic into more viewable/manageable blocks is something like this:
Here, the only rule condition is that the Mode changes. The set reaction has groups with constraints for each possible mode, and the actions in that group only run if the current mode matches the constraint. But it keeps everything in one place. I don't think a lot of people are using reaction groups with constraints yet, and I'm not saying it's the right answer for you, but it's something to keep in mind.
-
gwp1replied to toggledbits on Aug 31, 2022, 7:09 PM last edited by gwp1 Aug 31, 2022, 3:10 PM
@toggledbits This is very intriguing. I admit to having a ginormous amount of rules and conditions (ie, TV on closes the Living Room curtain upon Evening mode - but what if the TV was already on prior to Evening mode, we don't want the curtain closed during the daytime hours, and what if I ran out to the store and the house switched to Away mode and then back again etc.)
-
gwp1replied to toggledbits on Aug 31, 2022, 7:25 PM last edited by gwp1 Aug 31, 2022, 3:25 PM
@toggledbits So how does this approach account for the breaking out of lighting, HVAC, blinds, etc.? Is it recommended to link out to other rulesets or drive the actions right from here? That could/would result in quite a list of things happening under each of these groups, no?
-
@toggledbits said in 'not in' being ignored latest-22240-3b3254d6:
I don't think a lot of people are using reaction groups with constraints yet
I am and I like it a lot, since you’ll end up with less rule sets and it’s definitely easier to thinker. I’m also using groups with constraints in global reactions.
-
@therealdb I'd like to better understand the grouping you're using with this. Lights vs blinds vs presence vs HVAC, etc.
-
I can confirm that @toggledbits assessment was correct. Closing this up but I'd really like to chat with either @toggledbits or @therealdb about implementation of reaction groups with constraints.
-
@therealdb even I have one!
C
-
@gwp1 I was away from the forum for a few days, but to answer your question, I use the Hubitat app for Android on my phone and my wife's phone to determine presence. Every once in a while they break it with an update and I can use the Google assistant presence instead. I prefer Hubitat because you can set a geofence and I have them set up not to consider us away when walking the dogs in the neighborhood, but to have us away when we're at my parent's house just outside our usual walking route. Google doesn't give me that level of control over what's considered home or away.
-
gwp1replied to toggledbits on Sep 7, 2022, 11:43 AM last edited by gwp1 Sep 7, 2022, 7:48 AM
@toggledbits @toggledbits took your advice above and tried something new with my Living Room blinds and TV watching. The issues are:
-
If watching TV during the daylight hours, light from the windows on either side of the fireplace-mounted TV tend to wash it out a bit, esp during night scenes.
-
If watching TV at night, the neighbors have a pair of floodlights on their patio that, when in use, don't stream into my windows but do sit there in your field of view as these two white orbs. Very distracting.
My "try something new" solution is this:
(I've stricken the
Mode
Constraint from the above - it's redundant and too restrictive - what if I run out to the store real quick and the house flips toAway
?There is no
Reset Reaction
for Evenings because why? Just leave them closed as most likely the next stop is sleepy-time when they'll be closed anyway.Your thoughts?
-
-
Looks good to me!
-
@toggledbits After I saw this post I tested the daytime version and it behaved as intended. Half the battle down, we'll test the other half this evening. Thanks for the guidance here, it's a different approach but I can def see places where it's useful.
-
19/27