nberktumer / ha-bambu-lab-p1-spaghetti-detection

Bambu Lab P1 Home Assistant Spaghetti Detection Integration.
GNU General Public License v3.0
92 stars 6 forks source link

Missing docs: how to modify warning and failure thresholds #2

Open andreipopovici opened 4 months ago

andreipopovici commented 4 months ago

Hi there,

I'm trying to fine-tune and make the detection less sensitive. I see there's a THRESH constant of 0.08 in the Obico ML server.py, then there are a couple threshold-related number inputs in the HA integration, but those get set to something by the blueprint. I was under the mistaken assumption that we could set those inputs to our preferred values.

Is there a combination of changes I could make to achieve my goal?

Could you elaborate on how the server's THRESH constant relates to the return values from the ML server? Thank you!

nberktumer commented 4 months ago

Unfortunately I've hardcoded the failure thresholds in the automation calculations. It is possible to replace the hardcoded values with an input but need to go over the whole calculation functions.

I ported the following calculation functions to the HA blueprint. You can go over these functions and update the blueprint: https://github.com/TheSpaghettiDetective/obico-server/blob/496605a62fcb790097c510c151994e9b2bf020c1/backend/lib/prediction.py

https://github.com/TheSpaghettiDetective/obico-server/blob/496605a62fcb790097c510c151994e9b2bf020c1/backend/app/models.py#L410

andreipopovici commented 4 months ago

Thank you! I'll observe the normalized p values for a while to get a sense of why it's so sensitive.

To that end, I've added a warn mode that bypasses the pause/stop button presses: https://github.com/andreipopovici/ha-bambu-lab-p1-spaghetti-detection/blob/main/blueprints/spaghetti_detection.yaml#L50

ForceConstant commented 4 months ago

@andreipopovici thanks, the warn feature is useful for me.