Level 5 workers are concrete implementations that handle actual device communication for specific hardware brands or models.
B.1. Repository Naming Convention
Level 4 repositories follow strict naming patterns (see Naming Conventions).
miningos-wrk-{devicetype}-{brand}
Examples:
For complete specifications of all supported devices, see Supported Devices.
Note: No tpl in the name — Level 5 workers are concrete, not templates.
B.2. Worker File Naming Convention
Worker files follow a reverse naming pattern based on wtype:
Resolution Example:
For brands with multiple models requiring separate workers:
Example (Schneider with multiple models):
B.3. Directory Structure
A Level 5 implementation repository follows this structure:
B.4. Package.json Structure
To create a package.json for a Level 5 worker:
Open a text editor and create the following structure:
Replace {devicetype} and {brand} with your specific values.
Update the author and maintainers fields.
Save the file as package.json.
Note: The dependency is the Level 4 template (miningos-tpl-wrk-{devicetype}), not the Level 3 thing worker.
B.5. Main Worker Implementation
To create the main worker file:
Create workers/{brand}.rack.{devicetype}.wrk.js.
Add the following implementation, replacing placeholders:
B.6. Device Library Class
Create a device library class that handles protocol communication (workers/lib/{brand}.js):
B.7. Protocol Facilities
Level 5 workers typically require protocol-specific facilities. Add them in init():
Modbus TCP (Industrial Devices)
In your worker's init() method:
In your worker's init() method:
In your worker's init() method:
B.8. Configuration Templates
base.thing.json.example
Create or edit config/base.thing.json.example:
facs/modbus.config.json.example (if using Modbus)
Create config/facs/modbus.config.json.example:
B.9. Testing Infrastructure
Level 5 tests inherit from Level 4 and add brand-specific cases:
Level 5 tests inherit from Level 4 and add brand-specific cases. For complete testing guidelines, see Testing & Linting Guidelines.
To extend the parent test utilities:
tests/{brand}.spec.js
To create the main test file:
Create tests/{brand}.spec.js:
tests/executors.js
To extend parent executors:
Create tests/executors.js:
tests/cases/{feature}.js
To add a test case:
Create tests/cases/{feature}.js:
B.10. Worker Entry Point
Create the worker.js entry point:
For multimodel repositories, create separate entry points:
worker-pm5340.js
Create a model-specific entry point:
B.11. Implementation Requirements Summary
Each Level 5 implementation must:
Requirement
Method or Location
Purpose
init() with setInitFacs()
Enable device communication
Return super.getThingType() + '-{brand}'
Create device controller, assign to thg.ctrl
Implement data collection
Return { success, stats, config }
Return connection or device metadata
Return brand-specific tags
B.12. Level 5 Checklist