41 lines
1.0 KiB
Markdown
41 lines
1.0 KiB
Markdown
# Desk Presence Detection (Snapshot-Based, Home Assistant)
|
|
|
|
This project provides a low-CPU desk presence detection system using a webcam and snapshot-based computer vision. It is designed to work reliably on weak hardware without running continuous video inference.
|
|
|
|
Presence is detected using:
|
|
|
|
- Face detection (Haar cascade)
|
|
- Frame-to-frame motion detection
|
|
- A confidence score with decay
|
|
- A cooldown to prevent feedback loops caused by lights turning on or off
|
|
- The detected presence is published to Home Assistant as a binary_sensor.
|
|
|
|
## Installation
|
|
|
|
### 1. Clone
|
|
|
|
### 2. Build the image
|
|
|
|
```sh
|
|
docker build -t desk-presence .
|
|
```
|
|
|
|
### 3. Home Assistant Setup
|
|
|
|
#### A. Create Long Lived Access Token
|
|
|
|
#### B. Run the container
|
|
|
|
```sh
|
|
docker run -d \
|
|
--name desk-presence \
|
|
--restart unless-stopped \
|
|
--device /dev/video0:/dev/video0 \
|
|
-e HA_URL="http://192.168.0.202:8123" \
|
|
-e HA_ENTITY_ID="binary_sensor.desk_presence_vision" \
|
|
-e HA_TOKEN="YOUR_LONG_LIVED_TOKEN" \
|
|
-e CAMERA="/dev/video0"
|
|
desk-presence
|
|
|
|
```
|