FastAPI Developer for Smart Home Security System

Job ID: 40434463

Budget: €12 – €18 EUR

Python Developer – Smart Home Security & Alarm Logic (FastAPI / asyncio)

We are building CalmOS, a premium local-first smart home system running on FastAPI (Python). We need a developer to implement the full security and alarm logic. All processing is on-device — no images or audio leave the system.
Testable locally with a webcam, no on-site hardware required.

---
ALARM TYPES (5):
- Intrusion: camera + microphone detection, different behavior when resident is home vs. away
- Fire/Smoke: shut down AC + KWL immediately (no oxygen feed), activate escape route lighting
- CO (Carbon Monoxide): separate from CO₂ — ventilation to maximum
- Medical Emergency: person down → voice check → contact person called → auto ambulance

ALARM LEVELS (3):
- Normal: standard sensitivity, 60s cancel window
- Night: higher sensitivity, 30s cancel window
- Holiday: maximum sensitivity, 15s cancel window
---

INTRUSION — Resident NOT home:
Full lights + flashing, siren via all speakers (indoor + outdoor). KI speaks directly to intruder via speakers: "You are being recorded and monitored, police is on the way." Camera records and zooms in on intruder. Push notification with live image to resident. Cancel window active. No cancel within timeout → automatic police call.

INTRUSION — Resident home:
KI asks resident first via speaker: "Movement detected — is everything ok?" No immediate full alarm. No response or confirmation of safety → full escalation as above.

FIRE/SMOKE:
AC + KWL immediately OFF (prevent oxygen feed). Camera zooms to fire location, image to resident app. Escape route floor lighting activated (path to exits). Cancel window → no cancel → auto fire dept. call.

CO (Carbon Monoxide — separate from CO₂):
Immediate resident alert. KWL to maximum (fresh air in). Door/window guidance. No response → auto emergency call.

MEDICAL EMERGENCY:
Camera recognizes person on floor, no movement. KI asks via speaker: "Is everything ok?" Also tries configured contact number. No response within timeout → auto ambulance call with GPS location + live camera image.

---
CANCEL WINDOW:
Via: app button / numeric code / voice codeword / voice recognition (POST /api/alarm/cancel). Time window configurable per alarm level. No cancel → auto escalation to emergency services.

---
FALSE ALARM SUPPRESSION:
- Steam in bathroom: ignore smoke trigger if humidity > 80% + person present
- Pets: YOLO class filter — only humans trigger intrusion alarm
- Battery beeping: audio pattern match, suppress + log for morning report
- Audio classification: glass breaking, water sounds, smoke detector patterns
---

PRIVACY ZONES (must be respected):
- Bathroom: no cameras ever. Radar sensor only (fall detection).
- Bedroom: cameras with physical shutter, default closed. Alert only via opt-in.
- Living areas/kitchen/hallway: cameras active, full detection.
- On-device processing only — no image leaves the room, no cloud, no external logging.

---
INTEGRATION POINTS:

| System | Protocol | Notes |
|-------------------|-----------------------|------------------------------------------|
| Lighting | Art-Net UDP 6454 | Full brightness + escape route on fire |
| Ventilation (KWL) | Shelly HTTP RPC | Off on fire, max on CO |
| Climate (AC) | HTTP RPC | Off immediately on fire |
| Sockets | Shelly HTTP RPC | Off in zone on water leak |
| Audio/Siren | Snapcast JSON-RPC | Alert stream + KI voice to intruder |
| Push | WebSocket /ws | Frontend receives event + camera image |
| Camera input | RTSP stream | Motion/person/fire/water detection |
| CO Sensor | ESPHome native API | Separate from CO₂ sensors |

---

ACCEPTANCE CRITERIA:
- Intrusion (no one home) → lights, siren, KI speaks, push within 2s
- Intrusion (resident home) → KI asks first, no immediate siren
- Cancel works via app, code, voice codeword
- No cancel → escalation fires after configured timeout
- Fire → AC + KWL off within 1s, escape route lighting on
- Water leak → correct sockets disabled, valve command sent
- CO → KWL to max within 1s
- Medical → voice prompt plays, contact number tried, ambulance after timeout
- All 3 alarm levels behave differently (sensitivity + escalation time)
- Steam in bathroom does NOT trigger fire alarm
- Pets do NOT trigger intrusion alarm
- All detection on-device — no external API calls for camera/audio analysis
- Testable end-to-end with webcam (no house hardware required)

---
OPEN ITEMS (placeholders needed in code):
- Push notification to external app (future)
- Auto emergency call integration (API/SIP — to be defined)
- Exact camera RTSP URL (available 22.05.)
- Per-resident emergency contact number (app-configurable)