Revert "Add presence DB schema; fix BLE passive scan mode (bleak #1440)"
This reverts commit 2499db6147be65c76e7e202190b81855ba7b9100.
This commit is contained in:
@@ -274,8 +274,8 @@ async def scan_loop():
|
|||||||
|
|
||||||
await on_arrival(name, mac, rssi)
|
await on_arrival(name, mac, rssi)
|
||||||
|
|
||||||
# Passive scanner — required to avoid corrupting BLE 0x004C manufacturer_data (bleak #1440)
|
# Active scanner — explicitly required; bleak 0.20 BlueZ backend defaults to passive
|
||||||
async with BleakScanner(detection_callback=detection_callback, scanning_mode="passive") as scanner:
|
async with BleakScanner(detection_callback=detection_callback, scanning_mode="active") as scanner:
|
||||||
try:
|
try:
|
||||||
while not shutdown_event.is_set():
|
while not shutdown_event.is_set():
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
-- Presence intelligence schema — Phase 1 (WiFi-only)
|
|
||||||
-- Load with: sqlite3 presence.db < presence_schema.sql
|
|
||||||
|
|
||||||
PRAGMA journal_mode=WAL;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS persons (
|
|
||||||
mac TEXT PRIMARY KEY,
|
|
||||||
hostname TEXT,
|
|
||||||
vendor TEXT,
|
|
||||||
first_seen REAL NOT NULL,
|
|
||||||
last_seen REAL NOT NULL,
|
|
||||||
state TEXT NOT NULL DEFAULT 'ABSENT',
|
|
||||||
certainty REAL NOT NULL DEFAULT 0.0,
|
|
||||||
session_count INTEGER NOT NULL DEFAULT 1,
|
|
||||||
total_minutes REAL NOT NULL DEFAULT 0.0
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS signals (
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
mac TEXT NOT NULL,
|
|
||||||
signal_type TEXT NOT NULL, -- mdns | arp
|
|
||||||
certainty REAL NOT NULL,
|
|
||||||
observed_at REAL NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS events (
|
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
||||||
mac TEXT NOT NULL,
|
|
||||||
hostname TEXT,
|
|
||||||
event_type TEXT NOT NULL, -- arrived | departed | updated
|
|
||||||
certainty REAL NOT NULL,
|
|
||||||
timestamp REAL NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_signals_mac ON signals(mac);
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_signals_mac_time ON signals(mac, observed_at);
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_events_mac ON events(mac);
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_events_timestamp ON events(timestamp);
|
|
||||||
Reference in New Issue
Block a user