Skip to content

Commit

Permalink
Merge branch 'main' of github.com:koush/scrypted
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Feb 1, 2025
2 parents fa8a756 + 73b85e1 commit ce5fd2d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/homekit/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export class HomeKitPlugin extends ScryptedDeviceBase implements MixinProvider,
throw Error(`error in device reordering, expected ${uniqueDeviceIds.size} unique devices but only got ${uniqueReorderedIds.size} entries!`);
}

const autoAdd = this.storageSettings.values.autoAdd ?? true;
for (const id of reorderedDeviceIds) {
const device = systemManager.getDeviceById<Online>(id);
const supportedType = supportedTypes[device.type];
Expand All @@ -224,8 +225,7 @@ export class HomeKitPlugin extends ScryptedDeviceBase implements MixinProvider,

try {
const mixins = (device.mixins || []).slice();
const autoAdd = this.storageSettings.values.autoAdd ?? true;
if (!mixins.includes(this.id) && autoAdd) {
if (!mixins.includes(this.id)) {
// don't sync this by default, as it's solely for automations
if (device.type === ScryptedDeviceType.Notifier)
continue;
Expand All @@ -235,6 +235,8 @@ export class HomeKitPlugin extends ScryptedDeviceBase implements MixinProvider,
continue;
if (defaultIncluded[device.id] === includeToken)
continue;
if (!autoAdd)
continue;
mixins.push(this.id);
await device.setMixins(mixins);
defaultIncluded[device.id] = includeToken;
Expand Down

0 comments on commit ce5fd2d

Please sign in to comment.