Koyle Coil ebb6fca22c added a script for detecting when rd200.py is failing преди 1 година
..
52-usb.rules 7412a53571 dialout users can reset usb port преди 2 години
README.md f8b60fc920 adds some notes to help troubleshoot issues, also attempt to fix the error recovery process in `bluetoothctl` преди 2 години
blocker.py 983c2ee501 after a power failure found no default bluetooth controller, fixed in blocker.py преди 2 години
bt-snuggler.service 47d58179e9 service and process to guarentee a bluetooth controller for radon-eye service преди 2 години
db-check-last-update.sh ebb6fca22c added a script for detecting when rd200.py is failing преди 1 година
radon-eye.service ea457b6c8f still having problems with bt no default controller преди 2 години
radon-eye@.service 37c5279905 requires bt-snuggler.service instead of .target преди 2 години
rd200.py 179e6306e0 merge преди 2 години

README.md

install notes

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

pitfall and troubleshooting

in case you are having problems, check these common pitfalls:

  1. pyrhon3 sqlite3 wrapper requires that user owns directory as well for no reason

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

extras

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

prerequisites

apt packages - python3, bluetooth, bluez

python3 modules - BLE_GATT

locations

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'))"