Raspberry Pi / Bluetooth - Working but not fully working?

I already have a working copy of sensorReporter.py. I changed the “Topic” to “Destination” in the config file, and added a new “ReportType” for specifying either REST or MQTT. The new sensorReporter.py now uses that to determine which to use for publishing of each individual sensor. :smiley:

I also tried to make so that if one of the files were missing and couldn’t be loaded, it would just adjust a boolean to say that it’s not supported (and print to the screen of course). This way if they make a new sensor and the ReportType is missing some files, it would just skip loading that sensor.

Sorry, but I just flooded you with a bunch of pull requests. :smiley:

No worries. I probably won’t get to them until this evening so keep firing away and I’ll get them all incorporated and running in my setup for an additional test case.

It also appears that GitHub does indeed handle changing the name of a repo, and it even keeps all the links working afterwards.

I think that’s everything… Please let me know how your testing goes. :stuck_out_tongue:

I see everything has been merged, did you get a chance to test?

Unfortunately not. I got it merged and downloaded to my machine then got preempted by the toddler and didn’t get back to it. I’m hoping to deploy it and test over lunch. I can confirm though that I was getting false positives as well with the old script. I only have two BT devices that I’m tracking from three instances of the script.

I sent up some more pull requests that I think you’ll like as well. Nothing major…

I’ve accepted the pull requests and finally got it deployed on my systems. It was a bit challenging because the name change impacted a whole bunch of stuff. I also corrected a couple of typos and such.

Since I’ve deployed them I’ve not had any false positives. In fact I’ve not had any positives at all. I’ll play with the poll period (currently set to 2) and see what happens.

It has to have 10 readings in a row to change the status. So one reading per poll, one poll every two seconds, means 20 seconds to change status.

I’ve got to do some more playing around with the readings to fine tune it. It’s not perfect for sure.

I had it running for several minutes. I’ll play with it a bit over the weekend.

I’ll double check my local copy and make sure something didn’t get lost in all the pull requests, lol. Mines working great for 4 devices with a two second poll…

Another thing you can do is turn on debug mode in the Bluetooth script. It’ll show you the returned rssi values each poll.

I just cloned your git, added my config file, and I’m getting the same “working” results… How’d the rest of your testing go?

It doesnt find my Moto X PE very often but it does see it occasionally. It has yet to report my wife’s iPhone as present. :frowning: I haven’t really looked into how the script works to experiment with tuning it. Perhaps we need to pass som optional parameters to it besides just polling period if it is sensitive to different systems.

Hmmm… It works fine for two of my Android (Galaxy) tablets, my Galaxy Note 4 phone, and my wife’s iPhone 6…

Just some FYI (not sure if it matters), but I’m using a bluetooth 4.0 USB dongle…
Linked here…

I have the Bluetooth 3 built into my laptop/server, a Bluetooth 3 dongle and a Bluetooth 4 dongle plugged into the raspis.

I don’t know if it matters either, but they are all showing the same behavior.

Are you running all three at one time?

Try running one script with just one Bluetooth device and put it on debug mode. Paste the output somewhere so I can see.

I am running it on all three at one time. My house is too big and/or has too much interference to cover all three floors with one BT sensor running so I have on running on each floor.

I shut all but the one on the ground floor off (BTW this has a BT 3 dongle attached to a Raspberry Pi).

Here is my config:

 [Sensor1]
Type: GPIO
Pin: 7
ReportType: MQTT
Destination: entry_sensors/main/garage/door1
PUD: DOWN
Poll: 0.5

[Sensor2]
Type: GPIO
Pin: 8
ReportType: MQTT
Destination: entry_sensors/main/garage/door2
PUD: DOWN
Poll: 0.5

[Sensor3]
Type: Bluetooth
Address: 84:10:0D:6A:A2:06
ReportType: MQTT
Destination: presence_sensors/bluetooth/garageRich
Poll: 3

[Sensor4]
Type: Bluetooth
Address: 68:DB:CA:A4:4C:99
ReportType: MQTT
Destination: presence_sensors/bluetooth/garageJenn
Poll: 3

[Logging]
File: /var/log/sensorReporter.log
MaxSize: 67108864
NumFiles: 10

[MQTT]
User = some user
Password = open sesame
Host = chimera
Port = 1883
Keepalive = 60
Topic = entry_sensors/getUpdate
LWT-Topic = status/sensor-reporters
LWT-Msg = garage sensorReporter is dead

I’ll let it run for a bit and see if something changes but for now this is what I’m seeing in output (note: I need to change the debug behavior to use the debug severity on the logger and set the log level in the config instead of a flag and print statement because my network is too flakey to maintain an ssh connection to keep up with the logs.).

rich@garage /opt/sensorReporter $ sudo ./sensorReporter.py sensorReporter.ini
REST required files not found. REST not supported in this script.
Dash button detection is not supported on this machine
Loading sensorReporter.ini
Configuring logger: file = /var/log/sensorReporter.log size = 67108864 num = 10
2016-02-13 17:29:20 - sensorReporter - INFO - ---------------Started
2016-02-13 17:29:20 - sensorReporter - INFO - Configuring the MQTT Broker chimera
2016-02-13 17:29:20 - sensorReporter - INFO - Populating the sensor's list...
2016-02-13 17:29:20 - sensorReporter - INFO - Connected with result code 0, subscribing to command topic entry_sensors/getUpdate
2016-02-13 17:29:20 - sensorReporter - INFO - ----------Configuring gpioSensor: pin 7 on destination entry_sensors/main/garage/door1 with PULL DOWN
2016-02-13 17:29:20 - sensorReporter - INFO - Received a request for current state, publishing
2016-02-13 17:29:20 - sensorReporter - INFO - Published message CLOSED to entry_sensors/main/garage/door1
entry_sensors/main/garage/door2 with PULL DOWN
2016-02-13 17:29:20 - sensorReporter - INFO - ----------Configuring gpioSensor: pin 8 on destination entry_sensors/main/garage/door2 with PULL DOWN
2016-02-13 17:29:20 - sensorReporter - INFO - Published message CLOSED to entry_sensors/main/garage/door2
2016-02-13 17:29:20 - sensorReporter - INFO - ----------Configuring BluetoothSensor: Address = 84:10:0D:6A:A2:06 Destination = presence_sensors/bluetooth/garageRich
2016-02-13 17:29:20 - sensorReporter - INFO - Published message OFF to presence_sensors/bluetooth/garageRich
2016-02-13 17:29:20 - sensorReporter - INFO - ----------Configuring BluetoothSensor: Address = 68:DB:CA:A4:4C:99 Destination = presence_sensors/bluetooth/garageJenn
2016-02-13 17:29:20 - sensorReporter - INFO - Published message OFF to presence_sensors/bluetooth/garageJenn
2016-02-13 17:29:20 - sensorReporter - INFO - Kicking off polling threads...
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None
Destination = presence_sensors/bluetooth/garageRich, Current RSSI = None
 Destination = presence_sensors/bluetooth/garageJenn, Current RSSI = None