MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _rusense_notify_loop

Function _rusense_notify_loop

webapp_modern.py:1200–1215  ·  view source on GitHub ↗

Background poller for RuSense sensing. Runs for the life of the process; records the sighting history whenever the sensing backend is reachable and additionally sends Pushover alerts when those are enabled.

()

Source from the content-addressed store, hash-verified

1198_RUSENSE_PRES_ON = 0.18 # duty ≥ this → PRESENT (clears empty, catches sitting)
1199_RUSENSE_PRES_OFF = 0.08 # duty ≤ this → EMPTY (hysteresis)
1200# With an ADAPTIVE model loaded the picture shifts: the model emits present_still
1201# classifications, so an EMPTY room's presence-duty rises from ~2% (model-less)
1202# to ~15% overall with 12s-window peaks ~23% (live: 2-class present_still/absent
1203# model). The model-less 18% gate then false-fires on an empty room. Raise the
1204# gates when a model is active — a real sitter reads well above these (confirmed
1205# by the user), an empty room stays below. Model-less keeps the low gates so a
1206# still sitter (~27-40% duty) is never missed. See [[rusense-presence-hold]].
1207_RUSENSE_PRES_ON_MODEL = 0.35 # empty peaks ~23% with a model → clear margin above
1208_RUSENSE_PRES_OFF_MODEL = 0.18 # empty averages ~15% → clears; holds a real sitter
1209# Grace window that bridges a brief presence fall (perimeter excursion / duty dip)
1210# back to a rise, so one continuous occupancy is ONE sighting instead of several
1211# fragments. Backend analog of the frontend presence-hold's lingerMs. Live tests
1212# showed real re-entry gaps of ~9-19s during in/out movement → 20s covers them.
1213_RUSENSE_SIGHTING_MERGE_S = 20.0
1214
1215
1216def _rusense_model_active():
1217 """Whether a trained model is active on the sensing-server (cached ~30s).
1218 Confidence is only calibrated/trustworthy with a model loaded; model-less it

Callers

nothing calls this directly

Calls 3

_rusense_check_onceFunction · 0.85
debugMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected