turbo-lab / android-beacon-mqtt

Simple android application for notifying MQTT server when iBeacon is in range or lost
GNU General Public License v3.0
27 stars 7 forks source link

Nothing is published to master topic unless beacons have a group #27

Closed dermotduffy closed 5 years ago

dermotduffy commented 5 years ago

Version: 0.3

Hello,

Nice new version of Beacon MQTT! The master topic functionality was exactly what I was looking for -- but it took me a while to figure out why nothing was being published to it (despite things being successfully published to the track topic).

It seems that unless beacons have a defined group, the master topic does not get published to. As beacons do not have a default group, this is a little counter-intuitive and doesn't work out of the box.

I imagine there's some logic that is comparing the group of the current closest beacon, with the last reported master, and if they are the same -- nothing is published to the master topic. As the default for group is empty, this means nothing will be published as the mastership changes by default.

turbulator commented 5 years ago

Hi! Thanks for your feedback!

It is not a bug. It is by design. I call this feature the grouping of beacons. In general you have to assign the group for you beacons. If you don't do that - you have one default null-named group. The app checks the group while new beacon getting master role. If group changes - will send MQTT message. If not - wouldn't send. This logic was implemented for such usecases where you have several beacons with overlapped areas in one location (big house, +garage, etc). The app doesn't need to resend the message in the same location.

I've got lots of personal troubles with last weekend and didn't finish update the documentation for a project. You did'n have an possibility learn how new features work. I'm sorry about that.

But you are right. Default null-named group - is counter-intuitive. I'll change behaviour for null-named group. The app will send messages certainly. Make sense?

dermotduffy commented 5 years ago

Yes absolutely, I assumed this was the intention once I figured it out -- and the grouping is a very useful feature to have. It's just the counter-intuitive nature of it, when you're a new user, that this bug relates to. Your fix sounds great to me. Thanks!

turbulator commented 5 years ago

Done in e6ce9e0f1d7834a6725f0146219d74421090e95e

turbulator commented 5 years ago

My personal setup is simple: (group) work: work-ble beacon + work-wifi beacon home: home-ble beacon + home-wifi beacon car: car-ble beacon

Master topic: location/%mac% Master enter message: %group% Master exit message: not_home

turbulator commented 5 years ago

I've just pushed fixed version to Google Play. Have a nice day! Or night :))))))))))))))

dermotduffy commented 5 years ago

Just downloaded the latest version -- thanks for the quick release. Weird, now if there is a group set at all I don't seem to be able to get mqtt messages on the master topic -- but if there's no group set, then I do get messages/ Sample configuration I would expect to work:

Beacon 1:

Beacon 2:

Now, with the group entries results in no message being delivered, and without the group entries works fine ...

turbulator commented 5 years ago

Please check update again. First I pushed incorrect apk. Sorry.

dermotduffy commented 5 years ago

Works, thanks!