reelyActive Smart Spaces Revisited

Oh, cool, I just installed that app, and the server “went crazy”, with events every second or so. So it’s basically working. Now I just have to try to get my Android to at least “show itself” so I can use it for presence detection. Thanks again!

I now have bluetooth beacons that seem to be working well so far. One on my key chain, one on my wifes keys. Only downside is that they advertise “like crazy”. My events.log is full of changes for the vReelyActive item. Is there any way to not track every such change?

Also, I’m seeing a lot of the following errors in openhab.log:

2017-11-05 10:31:42.355 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Received a reelyActive event': An error occurred during the script execution: Unhandled parameter types: [null, org.eclipse.xtext.xbase.interpreter.impl.DefaultEvaluationContext@be20e, org.eclipse.xtext.util.CancelIndicator$1@a4db48]

It seems to the following lines of code, and I haven’t been able to fix it:

val swName = deviceName + "_reelyActive"
	val sw = gPresent.members.filter[s|s.name == swName].head
	sw?.sendCommand(ON)

I’ve tried the folling, but that doesn’t work either, still getting those error messages. I do get the switches to turn off/on correctly, but something still isn’t correct completely.

        val swName = deviceName + "_reelyActive"

        val sw = gPresent.members.filter[s|s.name == swName].head

        if (sw != null && sw.state != ON)
                sw.sendCommand(ON)

Any ideas regarding those two issues?

Thanks in advance!

The tl;Dr is no. You can either turn events.log completely off or you can use grep to filter out the parts you don’t care about.

I’ve never seen that error and it doesn’t make much sense in the context of that code. I’m not sure what the problem is.

@sirpreis Did you get it working with authentication? I’m having the same issue as you, where I know my credentials are right but I’m getting connection refused errors.

Unfortunately, no. I haven’t put any work into trying to fix it lately though. Let me know if you find the solution, please :slight_smile:

I’m using the following config for the events.log:

log4j2.appender.event.type = RollingRandomAccessFile
log4j2.appender.event.name = EVENT
log4j2.appender.event.fileName = /var/log/openhab2/events.log
log4j2.appender.event.filePattern = /var/log/openhab2/events.log.%i
log4j2.appender.event.immediateFlush = true
log4j2.appender.event.append = true
log4j2.appender.event.layout.type = PatternLayout
log4j2.appender.event.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%-50.50c] - %m%n
log4j2.appender.event.filter.regex.type = RegexFilter
log4j2.appender.event.filter.regex.regex = .*eely.*
log4j2.appender.event.filter.regex.onMatch = DENY
log4j2.appender.event.filter.regex.onMisMatch = ACCEPT
log4j2.appender.event.policies.type = Policies
log4j2.appender.event.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.event.policies.size.size = 5MB
log4j2.appender.event.strategy.type = DefaultRolloverStrategy
log4j2.appender.event.strategy.max = 2

This filters out the events matching the regex.

HI, very nice job, but as you said, ios devices are always changing the Device ID,
is there a way to work with the bluetooth mac address?

The Device ID is the MAC address. iOS devices and some Androids generate random MACs for their broadcasts so there is not much you can do short of running the reelyActive app on the phone which will cause your phone to broadcast packets with a special ID field (NOTE, I’ve never done this and cannot say for sure it will work).

1 Like

The app it’s a good idea, but after some minutes, the app stops sending packages, I also tried iBeacon Scanner, but only works for some hours, then stops, but there is another option, home assistant uses bluetooth tracker, but i’m not sure how it works, it scans for devices, then it detects each device without pairing or having the iphone sending packages, any idea how it works?

It probably actively scans for nearby BT devices rather than laying for BTLE broadcasts. See https://github.com/rkoshak/sensorReporter for an example for how to do that using. Python program that reports to oh using mqtt.

Personally I don’t use either of these for BT detection any more. The arping feature of the Network binding is more than adequate to detect when all our phones are present it not with no false positives.

ios phone are a pain, cant be detected, the got in sleep mode and disconnect from the wifi bluetooth is a better option for me, thanks for the link, I will try https://github.com/rkoshak/sensorReporter

The point of arping is it sends a carful crafted packet that forces they iphone to wake up and respond with an arp request. This weekend even when they go to sleep. Works like a charm once tuned. Search the forum for arping. It works way better than any BT detection I’ve used so far.

ohhh I didn’t know about arp request, does it work directly from the NETWORK binding? or should is use a script?
ohh I see, i have to enable binding.network:arpPingToolPath=arping
thanks no much for your help

Does reelyActive also report BlueTooth presence as well as BLE? I’m not seeing my phone with reelyActive, but I do see it when I run hcitool scan.

I’m not absolutely certain but I’m pretty sure it is only listening for BTLE broadcasts.

I emailed them, and they confirmed that standard BT is not supported. I think it’s a strange decision. Most of the piping is there. It sounded like more of a philosophical decision than a technical one.

They are concerned with privacy given their target audience is installation in public spaces. I’ve also found hci scans to be far less accurate with tons of both false positives and false negatives so I bet there are technical reasons as well.

You could couple the two though in your own code. When reelyActive detects a device run an hcl scan to see if it’s a device you know about, since modern phones spoof their bt MAC in BTLE broadcasts.

I’ve been sampling a lot of bluetooth scanners, and haven’t found one that does what I’m looking for, and I’m sure I’m not the only one.
I am looking for a scanner that will scan for old bluetooth, and bluetoothLE broadcasts, and send that data via MQTT.
It doesn’t look particularly difficult to do with hcitool and mosquitto_pub. I want to log the presence of any device that passes by or through the property. The bluetooth binding sort of does what I want, but I don’t want to manually throw out all of those devices that show up in my OpenHab inbox.
So, I want to track anonymous BT MAC addresses, and stuff them into a database. The table would have MAC, RSSI and timestamp. Is anyone aware of anything like this? I checked the ReelyActive products, and they do not do legacy bluetooth.

This is what I originally wrote sensorReporter to do. Someone recently contributed the ability to scan for BTLE. It might be a place to start.

I don’t think you will find any products that will do this for you. You will have to code up something yourself.

I know you wrote that, which is why I took a long hard look at it. I did cobble up a POC last night using btmgmt, and it mostly works for what I need. It’s kind of curious to me that almost all of these trackers push the whitelisted MACS down to the sensor level, because it’s much easier to scan for everything and report them at the top level, then do a lookup from there.
I’m new to this, so there may be something I’m missing, like a performance issue where a ping is a lot quicker than a scan.