Skip to content

Conversation

@mrbungle64
Copy link
Contributor

♻️ Current situation

This pull request relates to issue #71

The current situation is that SwitchBot "Contact" and "Motion" are not working with this module.

These models are already handled, however I have found 2 problems which prevent them from being discovered:

  1. Both models are not discovered by the Service UUID cba20d00224d11e69fb80002a5d5c51b because for both models peripheral.advertisement.serviceUuids is an empty array.

  2. For both models peripheral.advertisement.serviceData is no array unlike the other models.

💡 Proposed solution

  1. I changed _PRIMARY_SERVICE_UUID_LIST to an empty array (=> any service UUID)
    this._PRIMARY_SERVICE_UUID_LIST = [];
  1. I added serviceData as default value if serviceData[0] is undefined.
    let serviceData = ad.serviceData[0] || ad.serviceData;

⚙️ Release Notes

  • Added support for SwitchBot "Contact" and "Motion"

➕ Additional Information

I also corrected some typos.

Testing

I tested the advertising data with 6 devices (1 Contact, 1 Motion, 2 Meter and 2 Bot) on the terminal.

@donavanbecker donavanbecker changed the base branch from latest to beta February 22, 2022 04:49
@donavanbecker donavanbecker merged commit 3750749 into OpenWonderLabs:beta Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants