Skip to content

Commit

Permalink
try to fix leak
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed May 2, 2024
1 parent 6fbaf28 commit cf31e2b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/connection/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export default class {
'User-Agent': this.userAgent,
},
data: {
device: deviceId,
device: deviceId.replaceAll(':', ''),
limit: 50,
sku: deviceSku,
},
Expand Down
6 changes: 6 additions & 0 deletions lib/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,12 @@ export default class {
.filter((device) => [...platformConsts.models.sensorLeak, ...platformConsts.models.sensorThermo].includes(device.sku))
.forEach(async (device) => {
try {
// Reformat the device id
if (!device.device.includes(':')) {
// Eg converts abcd1234abcd1234 to AB:CD:12:34:AB:CD:12:34
device.device = device.device.replace(/..\B/g, '$&:').toUpperCase();
}

// Generate the UIID from which we can match our Homebridge accessory
const uiid = this.api.hap.uuid.generate(device.device);

Expand Down
31 changes: 21 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf31e2b

Please sign in to comment.