SDK Tools
Smart SCADA ships several Software Development Kits that let you extend the platform with new collectors, plugins, and integrations while reusing shared types and utilities.
1. SDK Packages
| Package | Purpose |
|---|---|
@ss-node/ss-sdk |
Shared DTOs, types, and utilities for backend & frontend |
@ss-node/ss-collector-sdk |
Collector development SDK (extends BaseCollectorService) |
@scada-editor/plugin-sdk |
Frontend plugin development SDK for editor widgets |
@scada-editor/create-plugin |
Scaffolding tool to bootstrap a new plugin package |
2. ss-sdk (Shared SDK)
The @ss-node/ss-sdk package is the canonical source for:
- DTOs — request/response shapes used by controllers and clients (
CreateDeviceDto,LoginDto,AlarmQueryDto, ...) - Types — domain interfaces (
IDeviceContext,ITagContext,IAlarm,IProtocolAdapter) - Utilities — value transforms, validation helpers, enums
Because both the backend and the frontend import from ss-sdk, the API contract stays in sync. When a DTO changes, typecheck errors surface on both sides immediately.
Usage:
import { CreateDeviceDto, IDeviceContext } from '@ss-node/ss-sdk'
3. ss-collector-sdk
The collector SDK provides everything needed to implement a new protocol collector:
3.1 BaseCollectorService
The abstract base class handles connection pooling, scheduling, retries, and lifecycle. Subclasses implement four methods:
import { BaseCollectorService, IDeviceContext, ITagContext } from '@ss-node/ss-collector-sdk'
export class MyCollectorService extends BaseCollectorService {
async connect(device: IDeviceContext) { /* ... */ }
protected async doReadTag(client, tag: ITagContext) { /* ... */ }
protected async doWriteTag(client, tag: ITagContext, value: any) { /* ... */ }
protected async doDisconnect(client) { /* ... */ }
}
3.2 Utilities
config-validator.util.ts— validate device connection configvalue-transform.util.ts— apply scale/offset/byte-order transformsplugin-test-harness.ts— unit-test a collector against mock contextsplugin-dev-server.ts— standalone dev server for iterative collector development
3.3 Scaffold
cd ss-services\ss-node\packages\ss-collector\ss-collector-sdk
node bin/create-plugin.js my-protocol
This generates a new package skeleton under ss-collector/my-protocol/ with the boilerplate already wired up.
4. Plugin Development SDK (Frontend)
The @scada-editor/plugin-sdk package lets you build custom graphical elements for the SCADA editor. A plugin is an ES module that exports a render function and a manifest:
// my-plugin/index.mjs
export default {
render(ctx) {
// draw on the Konva stage using ctx
},
// manifest metadata
}
Plugins are loaded at runtime via an import map (ss-run/ss/web/plugins/plugin-manifest.json). The SDK provides:
- A typed
PluginContextwith access to bound data, properties, and the canvas - Property panel schema definition
- Lifecycle hooks (
onMount,onUpdate,onDestroy) - Event binding to tags and scripts
5. create-plugin Scaffolding
The @scada-editor/create-plugin tool scaffolds a new frontend plugin package:
cd ss-editor
pnpm create-plugin my-widget
It generates:
package.jsonwith the correct dependenciessrc/index.tswith a starter render function- A property panel schema
- A README and example test
After scaffolding, run the dev server and your plugin appears in the editor's widget palette.
6. Developing a New Collector (End-to-End)
- Scaffold the package:
node bin/create-plugin.js my-protocol - Implement the four abstract methods using the protocol library
- Register the module in
apps/ss-data-server/src/app.module.ts(orss-node/src/app.module.ts) - Add the protocol code to
data/dicts/.../protocol-types.json - Write unit tests with
plugin-test-harness.ts - Build:
pnpm --filter @ss-node/ss-collector-my-protocol build - Restart the backend and create a device with the new protocol
7. FAQ
Q: Changes to my collector are not picked up.
A: Workspace packages must be rebuilt before dependents see the change. Run pnpm --filter @ss-node/ss-collector-my-protocol build, then restart the backend.
Q: The frontend plugin does not render.
A: Confirm the plugin is listed in plugin-manifest.json and the import map points to the correct URL. Open the browser console — a failed import will show the module path. Verify the manifest's name matches the widget type used in the scene.
Q: Can I share types between a custom collector and the frontend?
A: Yes. Put shared types in @ss-node/ss-sdk and import from both sides. Rebuild ss-sdk after changes.
Q: How do I test a collector without real hardware?
A: Use plugin-test-harness.ts to feed mock IDeviceContext and ITagContext objects and assert on read results. For end-to-end testing, point the collector at the Virtual simulator or a software emulator of the protocol.
8. Related Links
../../05-collector/README.md../../08-protocol/README.md../../11-api/README.md- BaseCollectorService Source
- Plugin SDK Source