Creates a new PluginSDK instance with the specified configuration options.
Initializes the WebSocket client for communication with the Logi Plugin Service, sets up the message dispatcher for handling incoming messages, configures the logger with the specified log level, and establishes connection event handlers.
Configuration options for the SDK. If not provided, defaults to WARN log level.
import { PluginSDK, LoggerLevel } from '@logitech/plugin-sdk';
// Create SDK with default options (WARN log level)
const sdk = new PluginSDK();
// Create SDK with custom log level
const debugSdk = new PluginSDK({ logLevel: LoggerLevel.DEBUG });
// Create SDK with minimal logging
const quietSdk = new PluginSDK({ logLevel: LoggerLevel.ERROR });
Establishes connection to the Logi Plugin Service.
This method connects the plugin to the Logi Plugin Service via WebSocket, enables communication, and sets up graceful shutdown handling. Must be called after registering all actions.
Promise that resolves when connection is established
Registers an action with the plugin.
Actions must be registered before connecting to the Logi Plugin Service to be available for assignment to controls.
The action instance to register
import { CommandAction } from '@loupedeck/plugin-sdk';
class MyAction extends CommandAction {
readonly name = 'my-action';
displayName = 'My Action';
description = 'Does something useful';
onKeyDown() {
console.log('Action executed!');
}
}
const myAction = new MyAction();
sdk.registerAction(myAction);
The PluginSDK provides the core functionality for building plugins that communicate with the Logi Plugin Service. It handles WebSocket communication, action registration, message dispatching, and connection management.
Example
See