Koyle Coil ebb6fca22c added a script for detecting when rd200.py is failing | 2 năm trước cách đây | |
---|---|---|
.. | ||
52-usb.rules | 3 năm trước cách đây | |
README.md | 2 năm trước cách đây | |
blocker.py | 2 năm trước cách đây | |
bt-snuggler.service | 3 năm trước cách đây | |
db-check-last-update.sh | 2 năm trước cách đây | |
radon-eye.service | 3 năm trước cách đây | |
radon-eye@.service | 2 năm trước cách đây | |
rd200.py | 2 năm trước cách đây |
add a unprivilleged system user and copy the progam files to it's home directory
sudo useradd --create-home --shell /bin/false --system radon
sudo chown radon rd200.py
sudo chown radon ../backend
sudo ln -sf /home/jb6113/radon-ble-rd200/backend/rd200.py /home/radon/.
run on boot
# second is 'S' C2:58:00:9A:26:29
# first purchased 'R' CF:CD:27:79:55:6B
# rd200.py takes a command line argument, the bluetooth address of the sensor
systemctl enable radon-eye@CF:CD:27:79:55:6B
systemd status info
sudo systemctl status radon-eye@CF:CD:27:79:55:6B
systemd status stop
sudo systemctl stop radon-eye@C2:58:00:9A:26:29
in case you are having problems, check these common pitfalls:
install a systemd service
#systemd-analyze verify radon-eye.service
sudo cp radon-eye.service /etc/systemd/system/.
sudo chmod +x /etc/systemd/system/radon-eye.service
sudo systemctl enable radon-eye.service
raspberry pi has some problems, but edit /etc/watchdog.conf
set timeout to 10
and interval to 2
and things should work out, I needed to install watchdog apt package first even though watchdog module and hardware were ready
apt packages - python3, bluetooth, bluez
python3 modules - BLE_GATT
the rd200 sensor is expensive and we purchased a single unit with the intent to move the sensor around for samples that are spread accross a larger area
store the changes of location in a database
-- initialize database
sqlite3 locations.db "CREATE TABLE locations (description TEXT, room INTEGER DEFAULT 0, time INTEGER NOT NULL DEFAULT (strftime('%s', 'now')))"
-- example location update
sqlite3 locations.db "INSERT INTO locations (description) VALUES ('pink room, on a branch of the bonsai tree')"
-- if you need to add a location at a different time other than now
sqlite3 locations.db "INSERT INTO locations (description, room, time) VALUES ('main level livingroom, halfway up shared kitchen wall', 0, strftime('%s', 'now', '-7 days'))"