Lyr3x / Roode

A reliable smart home people counter based on VL53L1X and ESPHome
The Unlicense
149 stars 41 forks source link

Preserve last calibration results between reboots #91

Open gorbunovav opened 2 years ago

gorbunovav commented 2 years ago

Is your feature request related to a problem? Please describe.

The calibration process requires some stable and predictable conditions. The auto-calibration feature is useful since it allows to simplify the sensor setup. Periodical re-calibration makes sense to adjust expectations to the changing environment. Automatic re-calibration on boot is unpredictable.

Describe the solution you'd like

Preserve calibration results in some way. And don't perform automatic calibration on boot if data already present. Re-calibration can be performed on schedule via the exposed service.

Describe alternatives you've considered

Use manual calibration (e.g. turn-on automatic method, grab values, fill into config). Downsides:

CarsonF commented 2 years ago

I'll work on this. It goes hand in hand with the sensors refactor I'm about to start.

Lyr3x commented 2 years ago

@CarsonF This should be an optional configuration option.

CarsonF commented 2 years ago

This should be an optional configuration option.

As in not the default functionality?

Lyr3x commented 2 years ago

Yes the default should be false because i know that it can cause problems. Thresholds change by a lot depending on the sunlight and temperature. If you dont recalibrate for quite some time you getting worse results.

CarsonF commented 2 years ago

That makes this the opposite of #58 then. Maybe we should discuss more.

Lyr3x commented 2 years ago

I have #58 in mind and really want to implement that soon because this eliminates the frequent recalibration issue.

If #58 is done we this feature here can be default: true

gorbunovav commented 2 years ago

@Lyr3x but this feature only prevents the re-calibration on boot. So in the described scenario disabling it will only help if you are rebooting the device regularly. Although I agree that it can be configurable.

Lyr3x commented 2 years ago

I think most of the users do reboot frequently to update the firmware and use the chance to get fresh thresholds in. I do understand why some don't want to do that always though 👍