Gateway on raspberry pi for presence detection

Still up as fireworks are still a thing :slight_smile:

I’ve figured at least one thing out… The address in the identities list needs to be all capital letters (no lower case at all) for things to say it’s good. Fixing that even removed the hex errors.

That said, the bluetooth address from settings/about never shows up in MQTT Explorer - even though the UUID for the phone does.

Ok - off to bed

Yes, I was expecting that as well.

ESPresence must have also stored the Identity MAC when getting the IRK during enrolment.

Did you see it there, and is it the same?

There’s no mention of an “identity MAC” when doing the enrollment. Here’s a link describing the process I used to find the IRK: Reliable iOS Presence Detection with ESPresense v3 Enroll Flow and IRK - James Ridgway . I did check the espresense/setting/irk thread, but it only refers to the name one provided it when doing the enroll process.

I would have assumed that the Identity MAC will need to be stored by ESPresence as well, as otherwise how could the resolving of a received random MAC be verified to be the correct device and not from some other random MAC device.

Two last things to possibly try out.
• If you are using a white-list, clear it out completely and see if it makes any difference.
• Test my above suggested solution with the Android app
Beacon Scope
and create a broadcasting iBeacon in it. For a phone with confirmed random MAC the UUID needs to be
54686565-6E67-732D-6942-6561636F6E32
and with the Identity MAC and IRK in identities of course.

Other than that, I’m afraid I don’t have any more suggestions, and this will need looking into by someone with an Android phone, to see why it is not working as smoothly as with an iPhone. At least you have clearly laid out all the instructions on how to recreate this scenario :+1:

All the best.

So,

Have we hit a hard wall? Just not sure where else to look for the “identity MAC”. And, if I may ask, why does MAC = ID? Looking at the description of the message, that doesn’t seem to be an absolute (IBeacon makes that UUID-Major-Minor in some cases).

We were typing at about the same time (what are the chances of that?) will look at your suggestion - and do appreciate all the support.

I’m a bit confused with the Beacon Scope app - it’s downloaded and added to my phone. Under the “transmit” tab - I went in and created an IBeacon with the UUID you posted - the the resultant beam shows “off” in the app, and nothing obvious to turn it on. And would I be using the bluetooth address / IRK combo to try and decode the newly created IBeacon?

Did you enter some arbitrary, not important to the functionality, major and minor values? Does it allow you to turn on the beacon then? Do you see anything in MQTT Explorer?

And yes, the random MAC resolving identities entry would still be required to resolve the resulting Theengs iBeacon to its static MAC address.

Yes, I used a minor of 10 and a minor of 5… Figured it out - had to do a long press to turn it on.

However, it’s not presently showing up in MQTT Explorer. I’ll play with it for a bit and see what I can make happen.

Ok, long press :wink: again, no practical experience with the Android app here.

What can you monitor in MQTT Explorer now, if anything at all?

I don’t see that UUID at all, nor do I see the name I gave it. There is a lot of noise - so hopefully I’m not missing it.

Oh - and I did turn of the HA Companion senor to see if that helped, but it didn’t.

There’s a sample ibeacon configuration in the app – which shows up in mqtt explorer, so I must have screwed something up.

And I assume that sample iBeacon has randomly changing MAC addresses every 15 minutes or so.

Then you could change the iBeacon UUID to the one I initially gave, with the difference just being the last digit being a 1 instead of a 2, i. e.
54686565-6E67-732D-6942-6561636F6E31

This should then show up in MQTT Explorer just the same, albeit also with randomly changing MAC address, but it would confirm that the problem definitely lies with the Identity MAC, IRK and/or the correct resolving of them.

You are correct - the MAC was changing every 15 minutes or so.

Changing the UUID to end with a “1” vs the original “2” still doesn’t show up in MQTT explorer

Which versions of Theemgs Gateway and Theengs Decoder are you using?

| Theengs Gateway    | 1.5.0  |
| Theengs Decoder    | 1.7.8  |

so the UUID
54686565-6E67-732D-6942-6561636F6E31
should definitely work, and has been confirmed to, especially useful for older Android phones with static Bluetooth MAC addresses, and should show up in MQTT Explorer decoded with

{"brand":"Theengs","model":"iBeacon Tracker","model_id":"TheengsIB01","device":"Theengs iBeacon Tracker"}

So… what have I screwed up? I’ve attached a picture of the configuration page for the ibeam I created with the beam app you suggested.

Wonder if my 50+ year old eyes aren’t working like they are supposed to :thinking:

Again, without any experience with the Android app myself, everything sensible to me.

I presume you turned off the sample iBeacon in the app, as otherwise the different messages of the sample iBeacon and the decoded Theengs iBeacon will appear under the same MQTT Explorer MAC/id entry - have a look in its message history in MQTT Explorer on the right hand side.

Ok,

Found it - I was trying to find it using the UUID… But it’s not included in MQTT thread. Wouldn’t have found it if you hadn’t mentioned what it decoded to and to make sure both other beacons were turned off. No to try your next step.

Things are/were happening…

Under MQTT I have a list of new devices with titles of IBeacon-Tracker-XXXXXX (where the XXXXXX changes). While not absolutely sure, I believe these were created when the last digit of the UUID wasn’t “2”. Since I changed it to “2”, I don’t see it listed in the MQTT-explorer App. The last part, I am sure of (tried it multiple times - ending in 1 shows up ending in 2 it doesn’t.

As UUIDs are often identical, especially with hardware iBeacons from the same manufacturer, we do not use them for publishing differentiation, but always the unique (Identity) MAC addresses.

The current UUID is only for static MAC addresses though, and we only tested this now to see that at least the iBeacon set up in the Beacon Scope app is working fine and is being recognised and decoded properly.

For a phone with random MAC addresses it would need to have the ending 2 again for a correct resolving of the random MAC addresses in Theengs Gateway, but only if the Identity MAC and IRk entered are correct.

Two silly questions, so please don’t be offended
• Is the Identity MAC you found in the Android setting really the Identity Bluetooth MAC address, or possibly the WiFi MAC address? At least on my iPhone they are closely adjacent to each other and also very similar, apart from slight differences in the last two octets.
• Is the IRK you retrieved from the ESPresence enrolment really the IRK, or possibly some other key usually exchanged during pairing/connecting, like the STK or LTK?

Correct, as I just posted in my last reply, the ending 1 is really only for phones with static MACs, we only used it to test the correct reception and decoding of your phone with random MACs, as it would not be very useful to have such phones published with ever changing random MACs.

For random MAC phones the ending 2 is required, but then something will only show up on MQTT Explorer if the random MAC addresses can be correctly resolved with correct Identity MAC and IRK (in any of the four possible formats previously mentioned)

If nothing still shows up it definitely now means that there is something wrong with either the Identity MAC, the IRK or the resolving in Theengs Gateway, although I can confirm the Identity MACs and base64 IRKs for the iPhone, iPad and Apple Watch do resolve the random MACs fine.

Regarding wifi vs bluetooth - yes, my phone reports both… And yes, I would get crossed eyed looking at the both (wifi is right above bluetooth). I think I have paid close enough attention to copy the right string down (took a couple of tries though).

For those who may wonder where it’s at – Settings, then about (using towards the bottom of the settings page), then about the bottom of the about page with headings of “wifi mac address” and “bluetooth address”