New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💥 Support for general motion sensor #248
💥 Support for general motion sensor #248
Conversation
We'll be forever stuck in motion vs occupancy pain unless we bite the bullet here. Maybe better to get that over with? Don't really fancy being stuck with a new set of suboptimal names forever. Option 1: Abandon old name
Consequences:
Option 2: Re-use old name
Consequences:
Option 3: Stick with poor naming, at least for now
Consequences:
I favor option 1, along with a major version number bump (v3): lets get the change over with. Either way it's a breaking change, so @blakeblackshear for opinions or alternatives. |
@dermotduffy I agree, and am onboard with option 1. I'll outline some of my thoughts:
Separately, do you have any thoughts on the delayed motion sensor issue? |
Good point! That means there's an option 4 (current sensor
I think that's slightly nicer naming than Option 1, and still doesn't re-use the entity name.
We should not implement a timer that "latches" motion for some period of time and then resets it -- we want to avoid creating/pretending state in HA if at all possible, if that state is not "real" as per the backend. So either, we should use an entity (like the PR currently does) if Frigate can detect both motion and "end of motion" (regardless of how frequently that fires), or (if Frigate cannot actually detect end of motion) we shouldn't use an entity at all and should instead generate an event (example) that can be used as an automation trigger. Users can generate their own latching sensors if they absolutely need them with something like this. |
We can definitely determine the end of motion in frigate. You can wait until x frames or an amount of time before clearing the sensor. That could also be configurable. |
Interesting, how would the I think I'm still leaning towards option 1 just so it isn't too cluttered and the behavior fits the name as expected, but perhaps I am not 100% understanding how option 4 would work. Either way sounds like we're in favor of 1 or 4.
Is that something that should be configured / implemented in this integration or on the Frigate side? |
On the frigate side, I think. Not all users of frigate use home assistant. |
There would be no Option 1:
Option 4:
(Only difference is whether
Agree. As mentioned above, it's also better to avoid Home Assistant from 'inventing' state that may not be real, i.e. it's better for Frigate to decide what constitutes "a camera with motion" and have the integration just faithfully use that state for the entity. |
Ah I see, then I think option 4 makes more sense from a naming perspective. If we're good with that I can start updating this PR. I already updated the frigate PR to include configurable off delay 👍 |
A nit: I was expecting these would be |
Gotcha yeah that makes sense, I was stuck between the two, will update |
@dermotduffy Do you have any experience testing the entity which is disabled by default? Struggling to see how I could do both, but probably needs to be disabled by default unless we wait to release 3.0.0 to full release until frigate 0.11 is full release I think in the long term this new motion sensor is definitely going to be wanted enabled by default |
Parent PR has been merged |
@dermotduffy I think I need help with this. Followed the reference but that only checked for the icon. To meet coverage I need to test that the mqtt message was received, but it seems despite the async_fire_mqtt_message(hass, mqtt_topic, "ON")
await hass.async_block_till_done() it is still unavailable |
Ohhhh interesting, that makes sense |
Codecov Report
@@ Coverage Diff @@
## master #248 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 12
Lines 1390 1431 +41
=========================================
+ Hits 1390 1431 +41
Continue to review full report at Codecov.
|
Hi @NickM-27 , this is looking great! Very excited about this change (and have a usecase in mind in the card, too). One thing this PR is currently missing is cleanup: We need to remove the old "motion" entity, otherwise it'll hang on forever, confuse people and cause support load. Here is an example of how to do this. You'll also obviously need to add a test to ensure the cleanup works -- here's an example you can probably extend. |
Oh cool I didn't realize integrations could do that, I'll work on that 👍 |
Not sure why that test is making other tests fail? |
Oh wow, thanks for fixing that. Is this ready to merge? |
Thanks @NickM-27 ! |
Sorry for resurfacing this already merged PR; I'm one of the folks that had misinterpreted the old "motion" sensors. Now that they're correctly named "occupancy" sensors, what's the difference between
|
Technically the occupancy sensor could be replaced by just the count sensor but I don't really see the problem. It can easily be disabled and especially as we just had a breaking change here I don't think it would be good to have another breaking change to remove this and force people to rewrite the automations yet again. Also that the behavior of these could be adjusted to be different from each other in the future.
We already have a |
Agreed, that's a very good callout.
Challenge accepted, I have my new lead to follow. 😎 |
To be clear it's on purpose that this isn't the case. Motion is much more arbitrary than objects. Especially since it's the bottom center of object bounding boxes that are considered for object presence in zone, and motion typically isn't going to fit in in the same way. |
💥 BREAKING CHANGE 💥
binary_sensor.kitchen_person_motion
tobinary_sensor.kitchen_person_occupancy
. The old name was a misnomer. All automations and templates that used the old entity_id must be updated manually.binary_sensor.kitchen_motion
. This entity is disabled by default.Motion Sensor
Parent frigate PR: blakeblackshear/frigate#3152
This adds support for a true motion sensor.
Open Questions