Skip to content

Releases: adix992/ViewAssistCompanionApp

0.9.2face

26 Feb 17:32
347cfa7

Choose a tag to compare

This upgrades the camera's motion detection system by replacing the pixel-based AggregateLumaMotionDetection with Google's ML Kit Face Detection.

The previous implementation relied on pixel changes, which could trigger false positives from shadows or pets, and relied on Home Assistant's 20-second timeout to clear the sensor. This update makes the tablet highly accurate at detecting actual human presence and makes the sensor instantly responsive.

Key Changes:

  • Added Google ML Kit: Integrated com.google.mlkit:face-detection via the version catalog.
  • Refactored CameraBackgroundTask: Swapped the legacy luma detector for ML Kit's FaceDetector, processing the InputImage directly from the camera frames.
  • Instant On / Instant Off: The app now fires a custom faceStateChanged event. It sends true the millisecond a face enters the frame, and explicitly sends false the exact moment the face leaves, bypassing the need to wait for Home Assistant's timeout.
  • Heartbeat Ping: To prevent the Wyoming integration's 20-second auto-clear timer from turning off the sensor while a user is actively looking at the tablet, the camera now sends a true heartbeat ping every 10 seconds (MOTION_INTERVAL) as long as a face remains in the frame.
  • Updated Routing: Added the faceStateChanged payload router in BackgroundTask.kt to seamlessly pass the new boolean states to Home Assistant.

Testing:
Tested locally on physical hardware connected to Home Assistant. The Wyoming sensor instantly triggers when a user approaches the tablet, stays active continuously while the user is present, and immediately clears when the user walks away.