UNPKG

@smj0x/homebridge-shortcuts-buttons

Version:

Run any Apple Shortcut with just the tap of a button, and execute a custom unix command (or another shortcut!) after completion to handle its success/failure, using x-callback-url.

170 lines (169 loc) 8.27 kB
{ "pluginAlias": "HomebridgeShortcutsButtons", "pluginType": "platform", "singular": true, "headerDisplay": "Please refer to the <a target=\"_README\" rel=\"noreferrer\" rel=\"noopener\" href=\"https://github.com/smj0x/homebridge-shortcuts-buttons#readme\">plugin documentation</a> for a more comprehensive explanation on this configuration.", "footerDisplay": "Please refer to the <a target=\"_README\" rel=\"noreferrer\" rel=\"noopener\" href=\"https://github.com/smj0x/homebridge-shortcuts-buttons#readme\">plugin documentation</a> for a more comprehensive explanation on this configuration.", "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "Display name of the platform bridge.", "default": "ShortcutsButtons" }, "accessoryName": { "type": "string", "description": "Display name of the platform accessory.", "default": "Shortcuts" }, "serviceType": { "type": "string", "title": "Display buttons as", "enum": ["Outlet", "Switch"], "description": "Display the shortcuts buttons as Outlets or as Switches. See the <a target=\"_README\" rel=\"noreferrer\" rel=\"noopener\" href=\"https://github.com/smj0x/homebridge-shortcuts-buttons/tree/latest?tab=readme-ov-file#how-does-it-look-like\">related documentation</a> for a visual preview of the two options in the Apple Home app.", "default": "Outlet" }, "services": { "type": "array", "title": "Shortcuts buttons", "description": "Add a new item to this list for every Apple Shortcut you want to be able to launch.<br>\nThe machine running Homebridge must have access to every shortcut listed here (i.e. the macOS user must be logged into the iCloud account where the shortcuts are stored). If you change the name of a shortcut from the Shortcuts app remember to update it here too.", "uniqueItems": true, "minItems": 1, "items": { "type": "object", "properties": { "serviceName": { "type": "string", "title": "Button title", "description": "A title to display for this button." }, "shortcutName": { "type": "string", "title": "Shortcut name", "description": "The name of the Apple Shortcut to launch, as displayed in your Shortcuts app." } }, "required": ["serviceName", "shortcutName"] } }, "callbackServerEnabled": { "type": "boolean", "title": "Enable Callback", "description": "The plugin will wait for the shortcut to complete its run, and will execute a callback action of your choice.", "default": true }, "callbackCommandType": { "type": "string", "title": "Callback Type", "enum": ["Default (display notification)", "Custom unix command", "Shortcut name"], "description": "With the default option, after the shortcut completion, a notification with the outcome of the shortcut run is displayed on the host running Homebrige.<br>\nIf you choose to customize the callback behaviour, you have two choices: use any unix command that your host is able to execute, or just use another shortcut to handle the callback if you like. Depending on your choice, you must complete the next field accordingly.<br>\nPlease see the <a target=\"_README\" rel=\"noreferrer\" rel=\"noopener\" href=\"https://github.com/smj0x/homebridge-shortcuts-buttons/tree/latest?tab=readme-ov-file#callback-command\">related documentation</a> for more detail.", "default": "Default (display notification)", "condition": { "functionBody": "return model.callbackServerEnabled === true;" } }, "callbackCustomCommand": { "type": "string", "title": "Custom callback command / callback shortcut name", "description": "Either a unix command or the name of a shortcut to run, depending on the value selected in the previous field. In the former case, all the content of the field will be treated as a command and executed: in the latter, this field expects just the plain name of the shortcut as displayed in the Shortcuts app. If you left the previous field on the default value, any text inserted here will be ignored.<br>\nYou can also read input parameters from your custom command/shortcut. Please see the <a target=\"_README\" rel=\"noreferrer\" rel=\"noopener\" href=\"https://github.com/smj0x/homebridge-shortcuts-buttons/tree/latest?tab=readme-ov-file#custom-unix-command\">related documentation</a> for more detail.", "condition": { "functionBody": "return model.callbackServerEnabled === true && model.callbackCommandType !== 'Default (display notification)';" } }, "callbackCommandTimeout": { "type": "number", "title": "Custom callback command timeout", "description": "The time in milliseconds that the x-callback-url server should wait for the callback command execution to complete before timing out.", "default": 5000, "condition": { "functionBody": "return model.callbackServerEnabled === true && model.callbackCommandType === 'Custom unix command';" } }, "callbackServerHostname": { "type": "string", "description": "IPv4 address or hostname to expose the internal x-callback-url http server (must be accessible from a browser on the machine running Homebridge).", "default": "127.0.0.1", "condition": { "functionBody": "return model.callbackServerEnabled === true;" } }, "callbackServerPort": { "type": "number", "description": "A free port number for the internal x-callback-url HTTP server.", "default": 63963, "condition": { "functionBody": "return model.callbackServerEnabled === true;" } }, "callbackServerProtocol": { "type": "string", "enum": ["http", "https"], "description": "If you access other Homebridge services (e.g. UI) behind a reverse proxy with TLS certificate installed, you may want to access the x-callback-url server via https as well.", "default": "http", "condition": { "functionBody": "return model.callbackServerEnabled === true;" } }, "sshEnabled": { "title": "Execute shortcuts via SSH", "description": "Enable this to run shortcuts on a remote macOS machine via SSH", "type": "boolean", "default": false }, "sshHost": { "title": "SSH Host", "description": "Hostname or IP address of the remote macOS machine", "type": "string", "condition": { "functionBody": "return model.sshEnabled === true;" } }, "sshPort": { "title": "SSH Port", "description": "SSH port (default: 22)", "type": "number", "default": 22, "condition": { "functionBody": "return model.sshEnabled === true;" } }, "sshUsername": { "title": "SSH Username", "description": "Username for SSH authentication", "type": "string", "condition": { "functionBody": "return model.sshEnabled === true;" } }, "sshPrivateKeyPath": { "title": "SSH Private Key Path", "description": "Path to the SSH private key file", "type": "string", "condition": { "functionBody": "return model.sshEnabled === true;" } }, "sshPassphrase": { "title": "SSH Private Key Passphrase", "description": "Passphrase for the SSH private key (if required)", "type": "string", "condition": { "functionBody": "return model.sshEnabled === true;" } } }, "required": [ "name", "accessoryName", "serviceType", "services", "callbackServerEnabled", "callbackCommandType", "callbackCommandTimeout", "callbackServerHostname", "callbackServerPort", "callbackServerProtocol" ] } }