SgtBatten / HA_blueprints

Somewhere to store automation blueprints
151 stars 55 forks source link

Enforce zone order #222

Open djak250 opened 1 month ago

SgtBatten commented 1 month ago

This looks really nice. The cleanup is appreciated and the comments make it clear.

Hows it testing on your end?

djak250 commented 1 month ago

The zones seem to be triggering correctly. I didn't get notified when my wife left for work, but I did when Amazon showed up, which was the goal. Lol. However, my automation only uses the device specific config, so I didn't do any real testing for tv and group notifications. I believe the zone logic is generalized across them though, so if one worked, the other two should as well.

JonGilmore commented 1 month ago

Thanks for putting up this PR! Just testing it out now, the wording isn't totally clear to me - do I need to enable Multi-Zone in order to get Zone Order Enforced to work? The wording seems to suggest so, but when I do this, I do not receive notifications. Also, just so that I'm clear, my use case is exactly the same as yours, I want notifications when an object first hits driveway_far and then hits driveway_near, is this setup correctly as shown below?

image
djak250 commented 1 month ago

You need all 3 zone toggles flipped. Zone Only, Multi-Zone, and Enforce Zone Order. In your picture you don't have Multi-Zone flipped. Was that on purpose? Also, you can flip debug mode on, and it should say at which point failed.

JonGilmore commented 1 month ago

Right on, thank you. I didn't even see the toggle for Zone Filter on/off and had goofed around with Multi-Zone, I'll test this out

image
JonGilmore commented 1 month ago

any chance you can show me what your near/far zones look like for your camera? are they overlapping in any way? mine is failing on TEST: FAIL (Multi) (Order-Enforced). my zones are a bit hard to see at night, but this is what my zones look like

image
djak250 commented 1 month ago

It's possible that you're zones are too small. My driveway is pretty long (about 250ft) so my zones are quite large, and it gives Frigate time to track the object in both spots. You should be able to tell from the debug logs if you're getting the necessary messages from MQTT. Specifically, you can check the Step Details on the "Wait for Trigger" step in the repeat flow. This one (circled in blue):

image

It should list the paylods for each iteration. You'd want to see your required zones in the after.entered_zones property, in the correct order. Frigate might not be keeping up with the vehicle transitioning between zones, so you're only getting the first or last, but not both. If this seems like the issue to you, take a look at Zone Inertia in the frigate docs. I have both of my zones set to inertia: 1 and they're limited to just car objects (not sure if that helps reduce processing by ignoring non-car motions.) And finally, see if you can configure frigate to require both zones for it's event tracking. That's a good way to somewhat narrow down if it's the automation or frigate itself that's causing issue. If you get the events correctly alerted in frigate but not through Home Assistant, then let me know, because that indicates it's probably something in the automation blueprint...

JonGilmore commented 2 weeks ago

Just wanted to check back in, after re-creating all zones/filters/masks in 0.14.0, this feature is working as expected for me.