TillFleisch / ESPHome-HLK-LD2450

ESPHome support for the HI-Link HLK-LD2450 millimeter wave sensor (external component) with support for custom zones using convex polygons.
MIT License
105 stars 19 forks source link

Add tilt max and min angle constraints #13

Closed bsell93 closed 5 months ago

bsell93 commented 5 months ago

This gives the ability to control max/min value of the angles detected - similar to how "Max Distance" works.

Defaults to -60 to 60deg, which I believe is max detection range; controls are optional.

image

TillFleisch commented 5 months ago

Thank you for adding this feature. I only had a quick glance at the PR. Since I currently don't have a lot of free time, a proper review and testing will have to wait (sorry :/).

bsell93 commented 5 months ago

@TillFleisch no worries! I'm happy to make an attempt at contributing 😃

The readme should be updated with the new configuration options

Yep - good call (Edit: Done)

The min/max angle should have a margin (like max distance) to prevent flickering on the edges

I'm actively using this and not seeing any flickering. If we did see a need to add margin I would definitely go the route of making a separate margin for angle rather than re-using distance.

maybe there is some room for consolidation: the min/max distance/angle seem repetitive. Having a single modular number class (and file) would probably be better (I will look into this once I find the time...)

I was literally thinking the same thing when I was writing it, but for the sake of making it work and reducing chance of failure I just duplicated. Very open to this modification though

TillFleisch commented 5 months ago

I look over this and added some things, I felt were necessary:

I will look over this once more later today. Feel free to play around/find bugs/criticize

Edit: the config could also be consolidated further. The max distance and angles could be covered by a single schema, which has a type attribute to determine which action is intended. This would break existing configs though...

TillFleisch commented 5 months ago

Thank you @bsell93 for adding this feature! :)

bsell93 commented 5 months ago

Thank you @bsell93 for adding this feature! :)

Thanks for helping me get it across the finish line ☺️