BlueZ fills Device1.RSSI only while scanning; sensors connect to us, so the field stayed empty. MGMT_OP_GET_CONN_INFO (like btmgmt conn-info) returns the link RSSI; polled per connected sensor and after each write. Needs CAP_NET_ADMIN (AmbientCapabilities in the collector unit). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
990 B
Desktop File
31 lines
990 B
Desktop File
[Unit]
|
|
Description=ButtonTask BLE Sensor Collector
|
|
After=bluetooth.service dbus.service
|
|
Wants=bluetooth.service
|
|
# Never give up restarting: the collector exits on purpose whenever
|
|
# bluetoothd restarts or hangs, to re-register GATT/advertising from scratch.
|
|
StartLimitIntervalSec=0
|
|
|
|
[Service]
|
|
# Type=notify + watchdog: the collector sends READY=1 after GATT start and
|
|
# WATCHDOG=1 every loop tick; a stuck event loop gets killed and restarted.
|
|
Type=notify
|
|
NotifyAccess=main
|
|
WatchdogSec=60
|
|
TimeoutStartSec=90
|
|
User=buttontask
|
|
Group=buttontask
|
|
SupplementaryGroups=bluetooth
|
|
# Link RSSI of connected sensors via the kernel Bluetooth mgmt API
|
|
# (collector/mgmt.py): that command needs CAP_NET_ADMIN.
|
|
AmbientCapabilities=CAP_NET_ADMIN
|
|
WorkingDirectory=/opt/buttontask/current/collector
|
|
Environment=BUTTONTASK_ROOT=/opt/buttontask
|
|
Environment=PYTHONUNBUFFERED=1
|
|
ExecStart=/usr/bin/python3 /opt/buttontask/current/collector/main.py
|
|
Restart=always
|
|
RestartSec=3
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|