vitas/beaconloc

Add MQTT support

marksev1 opened this issue ยท 11 comments

MQTT is an industry standard for home automation and machine 2 machine communication so it would be nice to have that implemented in your app to directly interface with home automation software.

vitas commented

Hi, Could you provide more details about use cases, thanks

For example beacons would be placed in different parts of the house, when your app would detect one it would publish a MQTT message with a certain topic (for example /home/rooms/bedroom/) indicating in which room the app has detected that we are present. If needed/as an option, it could also send rssi values etc. in json format since I believe MQTT can also transfer that.

vitas commented

so basically you need MQTT server to receive those messages, right? i do not think we will have enough customers/users using this feature, but i leave it as an enhancement request for the future. thanks

No your app can serve as a mqtt client...the server is the app doing homeautomation (for example HASS running on RPi)...so your app would just need to be the client, I believe there are a lot of libs available for that so you could code it fast.

vitas commented

I understand that the app will be a client, just worry about size of the app, it will much bigger and only few users will use the feature

+1 on this

MQTT is heavily used for home automation and DIY tinkering and I believe it would be more convenient to a bunch of people.

vitas commented

i can implement it, could someone tell me what we need to send to server? what data ist needed?

Just identifier of beacon region and for example 1 or 0 depending on if we are entering a region or leaving it? Perhaps there could be a separate option to send rssi of beacon also...Renekliment do you have some other ideas.

I think that a few information should be sent.

  1. RSSI - for estaimating distance from the beacon to the device with app on server side.
  2. Beacon mac adress/ID (for knowing is it "our" beacon and what kind
  3. Payload if there is some on beacon.

MQTT can work on separate topics, and publish the data to particular topic.

so in app there should be:

  1. a place in configuration that you can input
  • a MQTT server IP
  • port if different than standard mqtt , 1883 for standard TCP/IP, and 8883 for SSL TCP/IP
  1. A place to define topic name for particular data
  • topic name for RSSI
  • topic name for MAC
  • Topic name for Payload

That should be just fine to automate forwarding of the beacon stuff to some server side software using MQTT

Second thing (if we consider two way communication with backend (mqtt server and mainframe) we can add "listen" function as subscribing to additional "BACKlink" topic, that could be communication channel to the user interface.

So those functions together will grant You ability to locate beacons, transfer scanning results to backend and show backend response (of your choice) as result of being in range of particular beacon.

That is really Huge functionality, that can open a way to simple in house navigation, or smart actions with backend support.

I would love this

I was just about to ask about this.

There is another app: BeaconMQTT that seems to be an Alpha stage app. However, it did work with combining MQTT and iBeacons. The problem was the MQTT did not have the ability to add a Username or Password. I wrote to the developer and he replied:

"Unfortunately I don't really have the time for that right now. However, since the project is fully open source you can implement it yourself if you want :)

If you choose to implement it and create a PR I can see if I can push it to the play store as well.

https://github.com/bjaanes/BeaconMqtt

Good luck!"

Prehaps you could look at his code to integrate into your app?