Raspberry Pi / Bluetooth - Working but not fully working?

Thank you for your quick reply.

My ini file:

[Sensor1]
Class: bluetoothScanner.btSensor
Address: 12:34:56:78:90:12
Connection: MQTT
Destination: presence/johannes/topic
Poll: 25
Mode: LOOKUP


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


[Connection1]
Class: mqttConn.mqttConnection
Name: MQTT
User = xxx
Password = xxx
Host = localhost
Port = 1883
Keepalive = 60
; Topic to listen on, when any message is received, the current state of all
; are published to their respective topics.
Topic = sensors/getUpdate
; The MQTT broker will publish the following message on the following topic 
; when the client disconnects (cleanly or crashes)
LWT-Topic = status/sensor-reporters
LWT-Msg = mqttReporter is dead
; If TLS is yes the connection will be encrypted, the Certificate is expected to be in
; ./certs/ca.crt"
TLS = NO

sudo python sensorReporter.py sensorReporter.ini answers with:

Starting...
Loading sensorReporter.ini
Traceback (most recent call last):
  File "sensorReporter.py", line 199, in <module>
    main()
  File "sensorReporter.py", line 71, in main
    loadConfig(sys.argv[1])
  File "sensorReporter.py", line 181, in loadConfig
    config.get("Logging", "Syslog"))
  File "/usr/lib/python2.7/ConfigParser.py", line 618, in get
    raise NoOptionError(option, section)
ConfigParser.NoOptionError: No option 'syslog' in section: 'Logging'

Is there a parameter syslog available for the logging section?

Added the line:

Syslog: disabled

under [logging]. I don’t know if it is right, but the program starts and works like a charm. Thank you Rich!!!

Yep. I need to make that parameter optional AND I need to update the default.ini too.

Glad you got it working!

Hi Rich,

it’s me again. The sensorReporter is running well on my pi 3, but I have one problem:

I am using an iPhone 6s with no problems (using Lookup mode bluetooth). My wife has the same model (iPhone 6s) but the phone is not reachable (Lookup and RSSI mode), only when I open the bluetooth menu inside the setting section of the iphone, the status changes to ON. Turning the iPhone in standby (pressing power switch) or leaving the bluetooth menu change the state to OFF and the phone is no more accessible. Do you have an idea? Is there something I have to consider oder to change a setting?
Is it also possible to use iBeacons (Bluetooth LE) with sensorReporter?

Thanks for your help!

IPhones are notoriously difficult to detect reliably. I’ve tried a number of things and find the best I can do is about 80% on the iPhone with a combination of sensorReporter with RSSI, Network Binding, reelyActive, and IFTTT location.

Luckily my wife has other BTLE devices that are always detectable so I just felt on those instead.

If you search the forum for “going” you will find some postings that work better for iPhine.

It should work with beacons assuming the BT on the server supports BTLE.

Going?

Sorry, early morning typing on my phone with a for year old demanding attention.

hping is what you should search for.

Ahhh, sounds like a keyword! Thank you!

Good morning (at least in Europe) Rich,

Is it not possible to integrate hping as Sensor Module in sensorReporter? I am no programmer but I found some pythons programms with hping and think this would be awesome.

Greetings Johannes

It would totally be possible and I would welcome the PR. I don’t really have time to build something myself right now. You can open an issue on the GitHub page and when the time pressure eases up at home I’ll implement it.

Thank you. I opened the issue.

For the lines:

self.bt_sock.connect_ex((self.addr, 1)) # PSM 1 - Service Discovery
self.connected = True

Is there any way to make it run “faster” it takes too long to set the addresses not in range to false.

That wasn’t code written by me. My original was based on a simple lookup rather than the RSSI strength.

That being said, it is all handled by the Python Bluez library so I suspect the answer will be no.

However, the way the detector works is it keeps a running tally of detects. If it detects the device below a certain signal strength it adds one and if it is above it subtracts one. When the count gets below a certain threshold it will mark the device as present.

So, if you change the Poll to 5 and near to 2 then the minimum amount of time it will take to detect the device is near will be 10 seconds.

If that is the time you are really referring to, you can play around with the Poll, Max, Near, and Far parameters in the .ini file to see if you can speed up the detect. However, you will be trading speed of detects for increases in false positives and a decrease in the amount of time it takes for the device to no longer be seen as present.

I would first start with the Poll parameter which is the number of seconds between checks. But be aware that the check itself takes a number of seconds so setting it too low will not increase the speed of detects at all.

At the end of the day, if you want instantaneous detection of BT devices, you will need to use something other than sensorReporter. I think reelyActive does some smart things to detect devices a little sooner.