[RELEASE] BLE (Beacon) Gateway Manager


this?

See the settings icon in the upper right? Can you click that and send a screenshot of that? Thanks.


is this right?

Yes, perfect, thank you. Give me some time to research and get back to you.

2 Likes

I think this will be helpful to you, so I leave you a comment about ST SmartApp I used.

This allowed me to use a virtual ibeacon made by Android on ST(smartthings).

1 Like

I figured out the problem. The Android simulation app is not broadcasting the bluetooth data according to the bluetooth specification. This is why the BLE Gateway App is not detecting this as a valid beacon (and therefore not allowing you to select it). Here's why.

Take a look at this document: Understanding the different types of BLE Beacons | Mbed

A valid iBeacon broadcast has a total of 30 bytes. Your iBeacon data only has 27. It is missing the first 3 bytes. Here is the data your Android simulation beacon app is broadcasting:

1AFF4C0002156E70A1C329A742EBA2AA30E3B57CFCCC00000000BF

But here is an example of a valid iBeacon broadcast (using RadBeacon Locate simulation app on iPhone):

02011A1AFF4C0002155A4BCFCE174E4BACA814092E77F6B7E500000000C5

Notice how your beacon data is missing the first 3 bytes (02-01-1A). This is why the BLE Gateway Manager App is able to detect your iBeacon from your iPhone simulator, but not from your Android simulator.

You can find more information about the correct formatting of iBeacon data from here: iBeacon - Apple Developer. Go to this site and click the Artwork and Specifications link. Then download and unzip the file, and take a look at the Proximity Beacon Specification document.

Now that I've identified the problem, please let me know your thoughts and how you'd like to proceed. One approach would be to modify the device code to insert the missing data bytes. I can provide you with the code to do that, and you can create a customized version of the device driver for the gateway (which is relatively simple code). I don't know if I like making this change to the published app, since it is technically not compliant with the Bluetooth specification.

1 Like

First of all, I would like to thank you for your efforts to help me.

If you don't want to make any changes to the official app, I'd be very grateful if you could just give me a custom version.

Recently, there are many users in Korea who migrated to HE because ST stopped using dth.

If you make a custom version, can I share it with people who need a custom version of your app in the Korean web community?

1 Like

Interesting notes about ST, did not know that.

For now, how about you test it out by manually manipulating the code? Then if it works, I can consider adding an option to turn this feature on/off?

To test, edit the Driver code for the BLE gateway. Find lines 32-36:

        b.mac = device[1]
        b.rssi = device[2]
        b.data = device[3]
        obj.beacons.push(b)

change it to this:

        b.type = "auto"
        b.mac = device[1]
        b.rssi = device[2]
        b.data = device[3]
        if(b.data.length() == 54) b.data = "02011A" + b.data
        obj.beacons.push(b)

You'll see here that I am checking to see if the data length is 54 (54/2 = 27 bytes), and then prepending it with the missing data. See if that works. I tested it on my end and it appears to allow the beacon to show up in the "Add New Beacon" list.

Then if this works, I can see about adding an option to the driver to enable this feature (that will take more time).

4 Likes

It works really well. thank you so much for your help.

2 Likes

Great! I’ll think about the best way to build this as an option in the app. Once I have a newer version, I’ll let you know.

I’m curious, would you mind sharing your use case and how you are using the simulated beacon app with your android device with your hubitat hub? What types of automations do you have using this technology? Does using the simulator app drain your battery? Do you always leave the simulator app running? Please share if you don’t mind. :slight_smile:

3 Likes

I'd like to say thank you again for your help.
I use my Android smartphone as an presence sensor with life360 presence sensor.
This distinguishes whether I went out near to home or far from home.
In automation, when I arrive at the front door of the house, if my status changes to present, the door lock is automatically opened.
The simulated beacon app on the smartphone is set to run in the background, which does not drain the smartphone battery too much. (In my experience, the battery lasts more than a day.)

3 Likes

Can you do me a favor? Please simulate an AltBeacon and an Eddystone-UID beacon (if possible) from your android app, and then reply with the "POST received from gateway" from the logs with the device data (containing the UUID, and bold the UUID like you did for the iBeacon). I would like to see if the other simulated beacon types are also missing broadcast data. Then, I can add an option in the app that you can turn on, e.g. "Enable Compatibility for Android Simulator Beacon App", and can make sure it works for all 3 beacon types. Thank you.

altbeacon

dev:272 2023-01-29 11:00:03.128 PMdebug[type:auto, mac:************ , rssi:-76, data:1BFFFFFFBEAC1B4CD87EF9BC4FA4855FCFD5EB5E15D700000000BB00]

app:89 2023-01-29 11:00:03.095 PMdebugSending payload to device: BLE Gateway, payload: {"v":1,"mid":4394,"time":24226,"ip":"192.168.86.49","mac":"************ ","rssi":-70,"devices":
[[2,"4E02198DA251",-76,"1BFFFFFFBEAC1B4CD87EF9BC4FA4855FCFD5EB5E15D700000000BB00"]]}

eddystone uid

dev:272 2023-01-29 11:03:56.299 PMdebug[type:auto, mac:************ , rssi:-61, data:0303AAFE1516AAFE00BFE579AEAA0446A96FB76C000000000000]

app:89 2023-01-29 11:03:45.137 PMdebugPOST received from Gateway: {"v":1,"mid":4434,"time":24448,"ip":"192.168.86.49","mac":"************ ","rssi":-72,"devices":
[[3,"EC6426EF155D",-38,"07FF4C0012020000"],[2,"518F7ECEB790",-56,"0303AAFE1516AAFE00BFE579AEAA0446A96FB76C000000000000"]]}

altbeacon and eddystone uid do not appear in the list.

2 Likes

I released a new version 1.4.0, which should be available later today within the Hubitat Package Manager. This new version adds an option that you can turn on called "Enable non-compliant device support". When enabled, it allow the app to detect iBeacon, altBeacon, and eddystone-UID beacons broadcasted using the Android Simulator Beacon app. I tested with the beacon data you provided and they now show up. If you install this new version, you can revert the changes you made to the gateway driver (although if you leave them, it will still work, since the data is already augmented correctly). Updating from the package manager should also revert the changes you made for the device.

2 Likes

Great teamwork and sleuthing, @ajardolino3 & @user3644 (잘 했어요!). Very nicely done!

This updated version will be very useful for some users.

1 Like

@ajardolino3 Does the app support multiple (2) of the AB gateways? I’m considering purchasing these, along with moving some functions of my automation setup to Hubitat. Reliable vehicle detection is something that I’ve lost with the shuttering of iAutomate RFID and lack of updates for their Homeseer plug-in. When I had it, it as ROCK solid and I’m looking to replicate the solution.

I’ve used GeoFency and iBeacons for years now for presence detection for my phone to tell the house I’m home. This along with my now failed RFID setup afforded me a near perfect system to arm and disarm the alarm, open and close the garage, and place the house in Home or Away mode. My most likely scenario is placing a pair of beacons in each vehicle (one car powered and one passively battery powered), along with a beacon key fob for person presence detection. This along with a pair of gateways would mirror my previous setup.

So no pressure at all in supplying a rock solid app and solution for my years long search.

I’ve only ever tried it with one gateway. However, the app is just receiving API requests from the gateway and processing them, so I cannot think of a reason why it would not work with two gateways. The app isn’t going to see any difference. The only thing is that you won’t know which gateway is picking up your beacon, but either gateway will detect it and send that info to the hub to be processed. If you try this, let us know how it works.

Are there any use cases where you would need to know which gateway picked up which beacon? Or are you just using two gateways to give you better coverage for detecting beacons?

Hi @ajardolino3

I applied this to HE, and it works very well. Thank you.
By the way, there seems to be one problem.
The problem of sending too much data to the HE hub is actually difficult to use in HE.


I think it would be good to receive only connected and non-connected data like contact sensors in HE.
Is this possible?

The link below is the user I set up using your Apps & driver. It's in Korean, so you'll have to see it after you translate it.

https://blog.naver.com/ispark0114/223016056289

All of that data comes from the gateway. You can adjust your gateway settings to control what data is sent to the hub. You can also control how frequently the gateway sends data to the hub.

1 Like

Not sure what you mean by difficult to use. The app will track when the beacon arrives and departs. If you trigger your home automation on either the arrival or departure of your beacon, that should be pretty easy to configure. If you can explain what you are trying to do, perhaps I can suggest a way to setup your home automation rules.

Here is a simple example of how to setup a rule upon arrival of a beacon:

1 Like