obycode / smartthings-smartapps

A collection of SmartApps I have written to perform various tasks at my house.
20 stars 19 forks source link

BeaconThings: Support for multiple mobile devices / accounts #2

Open rjmurillo opened 8 years ago

rjmurillo commented 8 years ago

When registering the iBeacons with SmartThings through BeaconThings, the beacons are always registered as BeaconThings-<MAJOR>-<MINOR>.

    def beaconId = "BeaconThings"
    if (beacon.major) {
      beaconId = "$beaconId-${beacon.major}"
      if (beacon.minor) {
        beaconId = "$beaconId-${beacon.minor}"
      }

https://github.com/obycode/smartthings-smartapps/blob/master/BeaconThings/BeaconThingsManager.groovy#L70-L75

The native BeaconThings iOS application allows multiple devices to pick up iBeacons; however, due to the registration limitation described above, the having multiple devices causes duplicate registrations in SmartThings and/or devices with the same device network id (e.g. BeaconThings-1-1), even with multiple accounts.

Suggestion: Include more information within the device network id to better identify multiple devices and/or accounts.

For example: if each device had its own SmartThings account, the account plus the Major/Minor could be used to identify the specific account (e.g. user@domain.com|BeaconThings-1-1). This could be further improved by further identifying a specific device, similar to the mobile device presence device in SmartThings itself. This would allow devices to be distinguished for rules (e.g. iPhone, iPad, etc.) and accounts.

obycode commented 8 years ago

Thanks for the suggestion @rjmurillo. Yes, you're right that its usefulness is currently limited to one user/device. We have plans to add something like what you're describing to support multiple devices. We won't have access to the SmartThings account username, but we planned on having the user give the device a name. We'll get back to work on this update after our SmartRules and obything updates are complete.

bachter commented 8 years ago

So if I'm understanding this correctly, if I have everything working the way I need via BeaconThings on my iPhone and attempt to install BeaconThings on my wife's iPhone, it will not work on her phone because it's recognizing the iBeacons as duplicates. Can you confirm, Obycode?

obycode commented 8 years ago

Yes, I can't recommend using BeaconThings with multiple devices yet. We have plans for resolving this, but have not implemented them yet.