@brightsign/actions-cdk
v4.3.2
Published
BrightSign Actions CDK
Maintainers
Keywords
Readme
BrightSign Actions CDK
The BrightSign Actions Cloud Development Kit (CDK) is a powerful toolkit that enables seamless interaction with BrightSign digital signage players through both local and remote interfaces. It provides a unified API for device management, content deployment, and monitoring capabilities.
Features
- Local Diagnostics Web Server (DWS) interaction
- Remote device management through BSN.cloud
- File management operations
- Device monitoring and control
- Registry management
- Power management
- Screenshot capabilities
- Logging functionality
Getting Started
Follow these simple steps to start using the BrightSign Actions CDK in your project:
Installation
npm install @brightsign/actions-cdkEnvironment Variables
Set up your environment variables in a .env file:
BRIGHTSIGN_CLIENT_ID=your-client-id
BRIGHTSIGN_CLIENT_SECRET=your-client-secret
BRIGHTSIGN_NETWORK_NAME=your-network-name # Optional, for remote managementNote: You must obtain a BrightSign client ID and client secret to use this application. These credentials can be generated at https://adminpanel.bsn.cloud/.
Note: The environment variable names must match those above for the examples to work as shown.
Usage Examples
Remote Device Management
import BrightsignActions from '@brightsign/actions-cdk';
const actions = new BrightsignActions({
clientId: process.env.BRIGHTSIGN_CLIENT_ID!,
clientSecret: process.env.BRIGHTSIGN_CLIENT_SECRET!,
network: { name: process.env.BRIGHTSIGN_NETWORK_NAME },
});
const { Players } = actions;
const remoteDeviceInfo = await Players.get({
deviceSerial: 'SERIAL1234',
});Local Device Management
import BrightsignActions from '@brightsign/actions-cdk';
const actions = new BrightsignActions({
clientId: process.env.BRIGHTSIGN_CLIENT_ID!,
clientSecret: process.env.BRIGHTSIGN_CLIENT_SECRET!,
});
const { Players } = actions;
const localDeviceInfo = await Players.get({
connectionType: 'local',
ipAddress: '192.168.1.100',
username: 'admin',
password: 'password',
});Upload and Reboot All Players
import BrightsignActions from '@brightsign/actions-cdk';
const actions = new BrightsignActions({
clientId: process.env.BRIGHTSIGN_CLIENT_ID!,
clientSecret: process.env.BRIGHTSIGN_CLIENT_SECRET!,
network: { name: process.env.BRIGHTSIGN_NETWORK_NAME },
});
const { Players } = actions;
async function uploadAndRebootAllPlayers(
localFilePath: string,
destinationPath: string,
) {
const players = await Players.list();
await Promise.all(
players.map(async (player) => {
await player.upload(localFilePath, destinationPath);
await player.reboot();
console.log(`Uploaded and rebooted player: ${player.serial}`);
}),
);
}
uploadAndRebootAllPlayers('./autorun.brs', 'sd').catch(console.error);API Documentation
Key Classes
BrightsignActions: The main entry point for interacting with both local and remote devices.Players: For device management (local and remote), accessible via thePlayersproperty ofBrightsignActions.Networks: For network management, accessible via theNetworksproperty ofBrightsignActions.
Each class provides methods for:
- Device information retrieval
- File management
- Registry operations
- Power management
- System controls
- Monitoring capabilities
Troubleshooting
Common Issues
Connection Failures
- Verify network connectivity.
- Check device IP address.
- Ensure correct credentials.
Authentication Errors
- Validate credentials.
- Check token expiration.
- Verify API permissions.
File Operations Issues
- Confirm file paths.
- Check storage permissions.
- Verify file size limits.
Logging
The CDK includes a built-in logging system with multiple levels:
- DEBUG (2)
- INFO (3)
- WARN (4)
- ERROR (5)
- FATAL (6)
Contributing
We welcome contributions! Please see the CONTRIBUTING.md file for guidelines on how to get started.
License
ISC License - See LICENSE file for details.
