reelyActive Smart Spaces Revisited

OK, that is interesting. Mosquitto makes it sound like there is a networking problem but reelyActive is saying it is an authentication problem. I’m not sure what the problem can be.

I’ve always left the allow_anonymous true as the default in the mosquitto config so I can’t say for sure whether that is why I’ve never seen a problem. It seems like since you are supplying a user and password in reelyActive you should be able to connect. You might want to raise this as an issue or at least a conversation on the reelyActive repos.

Beyond setting reelyActive up and running it, which I managed to do without any errors, I know very little of how it actually works internally. The MQTT config should not make any difference to whether the Bluetooth events are detected or not. So again, you might need to move over to the reelyActive support community to solve this issue. I’m fresh out of ideas.

1 Like

Yea, thank you for your help!

I don’t think I want to keep the anonymous option on, because my OwnTrack on my Android device sends messages to that MQTT (via a dyndns). So I do need authentification, otherwise everyone could just connect to that server.

Somehow my reelyActive dashboard did show events after a while. It somehow looks like my Android smartphone doesn’t really gets noticed, but when I started up my iPad and activated bluetooth, I got hundreds of events over time. When I then started my AppleTV in the evening, it looked like there were even more messages (I don’t even know if the AppleTV has bluetooth?!). So it might be a “problem” with my Android device. Might be designed to save battery and not use its bluetooth whenever possible.

Rokus I think have BT too. Chromcasts definitely do. I was actually mislead when I first set reelyActive up because I keep seeing all these Google detects (I was looking at raw messages, not the web page) and it took a few minutes to realize that it was coming from the Chromcasts.

That’s a possibility or it might go to sleep like iPhone networking does when it isn’t actively in use.

There is a reelyActive app you can install that will add a unique identifier to the packets reelyActive receives which will help you identify your specific device and perhaps it will keep the BT active on the Android.

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.