Skip to content

Commit

Permalink
Alexa: add option to not auto enable devices (#1615)
Browse files Browse the repository at this point in the history
Co-authored-by: Gianluca Ruocco <[email protected]>
  • Loading branch information
apocaliss92 and Gianluca Ruocco authored Oct 19, 2024
1 parent 531a9d2 commit 2905969
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 2 additions & 3 deletions plugins/alexa/package-lock.json

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

2 changes: 1 addition & 1 deletion plugins/alexa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/alexa",
"version": "0.3.3",
"version": "0.3.4",
"scripts": {
"scrypted-setup-project": "scrypted-setup-project",
"prescrypted-setup-project": "scrypted-package-json",
Expand Down
13 changes: 12 additions & 1 deletion plugins/alexa/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class AlexaPlugin extends ScryptedDeviceBase implements HttpRequestHandler, Mixi
title: "Pairing Key",
description: "The pairing key used to validate requests from Alexa. Clear this key or delete the plugin to allow pairing with a different Alexa login.",
},
disableAutoAdd: {
title: "Disable auto add",
description: "Disable automatic enablement of devices.",
type: 'boolean',
defaultValue: false,
},
});

accessToken: Promise<string>;
Expand Down Expand Up @@ -116,6 +122,10 @@ class AlexaPlugin extends ScryptedDeviceBase implements HttpRequestHandler, Mixi
if (!supportedTypes.has(device.type))
return DeviceMixinStatus.NotSupported;

if (this.storageSettings.values.disableAutoAdd) {
return DeviceMixinStatus.Skip;
}

mixins.push(this.id);

const plugins = await systemManager.getComponent('plugins');
Expand Down Expand Up @@ -671,7 +681,8 @@ class AlexaPlugin extends ScryptedDeviceBase implements HttpRequestHandler, Mixi
enum DeviceMixinStatus {
NotSupported = 0,
Setup = 1,
AlreadySetup = 2
AlreadySetup = 2,
Skip = 3,
}

class HttpResponseLoggingImpl implements AlexaHttpResponse {
Expand Down

0 comments on commit 2905969

Please sign in to comment.