{"_id":"@alikh/dwarflab-sdk","_rev":"2-2ccdedc18f9136a0d0c6a233401aacae","name":"@alikh/dwarflab-sdk","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@alikh/dwarflab-sdk","version":"0.1.0","keywords":["dwarflab","dwarf","dwarf3","telescope","astronomy","astrophotography","smart-telescope","sdk"],"author":{"name":"alikh31"},"license":"MIT","_id":"@alikh/dwarflab-sdk@0.1.0","maintainers":[{"name":"alikh","email":"al_kh31@hotmail.com"}],"homepage":"https://github.com/alikh31/dwarflab-sdk/tree/main/packages/sdk#readme","bugs":{"url":"https://github.com/alikh31/dwarflab-sdk/issues"},"dist":{"shasum":"036ffda3bc7ebd41480d1104f89813e2f4d98873","tarball":"https://registry.npmjs.org/@alikh/dwarflab-sdk/-/dwarflab-sdk-0.1.0.tgz","fileCount":9,"integrity":"sha512-RfjdgddZ/kduUmTOCE4+Z/nUYaIRyvqq15utaJVCyKyjctRwmSAdyrQpxW0loTlG70zVxWSFVJa5RoIlRPEjXQ==","signatures":[{"sig":"MEYCIQCAHu4HNduJ6V21GnWmGUtzneKwbZ4yHuybsQanHuFTOgIhALOSuW4iiNDfk5H9e/jnBWyZeUvdWiqVTja79JTqkuZy","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19482706},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"482daf3f5fddeee75e6e59c790ec47311b9acf7f","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit","test:watch":"vitest"},"_npmUser":{"name":"alikh","email":"al_kh31@hotmail.com"},"repository":{"url":"git+https://github.com/alikh31/dwarflab-sdk.git","type":"git","directory":"packages/sdk"},"_npmVersion":"10.8.2","description":"Unofficial TypeScript SDK for controlling DWARFLAB DWARF telescopes over WebSocket and HTTP (browser + Node.js)","directories":{},"sideEffects":["./dist/index.mjs","./dist/index.cjs"],"_nodeVersion":"20.19.0","dependencies":{"long":"^5.3.2","protobufjs":"^7.4.0"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"peerDependencies":{"ws":"^8.18.0"},"peerDependenciesMeta":{"ws":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/dwarflab-sdk_0.1.0_1780225732455_0.03844755460849081","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@alikh/dwarflab-sdk","version":"0.1.1","description":"Unofficial TypeScript SDK for controlling DWARFLAB DWARF telescopes over WebSocket and HTTP (browser + Node.js)","type":"module","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","sideEffects":["./dist/index.mjs","./dist/index.cjs"],"scripts":{"build":"tsup","test":"vitest run","test:watch":"vitest","typecheck":"tsc --noEmit"},"dependencies":{"long":"^5.3.2","protobufjs":"^7.4.0"},"peerDependencies":{"ws":"^8.18.0"},"peerDependenciesMeta":{"ws":{"optional":true}},"keywords":["dwarflab","dwarf","dwarf3","telescope","astronomy","astrophotography","smart-telescope","sdk"],"license":"MIT","author":{"name":"alikh31"},"homepage":"https://github.com/alikh31/dwarflab-sdk/tree/main/packages/sdk#readme","repository":{"type":"git","url":"git+https://github.com/alikh31/dwarflab-sdk.git","directory":"packages/sdk"},"bugs":{"url":"https://github.com/alikh31/dwarflab-sdk/issues"},"engines":{"node":">=18"},"publishConfig":{"access":"public","provenance":true},"gitHead":"2ccc3db83f4fb0ffa0df1f33f7765aa66a7628ad","_id":"@alikh/dwarflab-sdk@0.1.1","_nodeVersion":"20.20.2","_npmVersion":"11.16.0","dist":{"integrity":"sha512-XVp6RyfOn/Od66Htt4CfdczOGMmajTAHVPKYFQRBfilZpFMB3vmiBYKR+uq55pBaGN8WARH3QlmaDC7lDWpbdQ==","shasum":"923e2840dc8f6d99a7457550a6244f408444dbd3","tarball":"https://registry.npmjs.org/@alikh/dwarflab-sdk/-/dwarflab-sdk-0.1.1.tgz","fileCount":9,"unpackedSize":19482706,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alikh%2fdwarflab-sdk@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHWquEg1PY5j0t6YkdumPQk5+hsHx+vHkFRuSoB6eRTkAiAq4TDZ5PZY5ABIq7G5UP4XBk9P0CbRhvSTUOGvGBOv9g=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:909a97e8-932f-4a3b-9f8e-7a700680e3a6"}},"directories":{},"maintainers":[{"name":"alikh","email":"al_kh31@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dwarflab-sdk_0.1.1_1780226801731_0.6767912654524706"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-31T11:08:52.250Z","modified":"2026-05-31T11:26:42.238Z","0.1.0":"2026-05-31T11:08:52.629Z","0.1.1":"2026-05-31T11:26:41.918Z"},"bugs":{"url":"https://github.com/alikh31/dwarflab-sdk/issues"},"author":{"name":"alikh31"},"license":"MIT","homepage":"https://github.com/alikh31/dwarflab-sdk/tree/main/packages/sdk#readme","keywords":["dwarflab","dwarf","dwarf3","telescope","astronomy","astrophotography","smart-telescope","sdk"],"repository":{"type":"git","url":"git+https://github.com/alikh31/dwarflab-sdk.git","directory":"packages/sdk"},"description":"Unofficial TypeScript SDK for controlling DWARFLAB DWARF telescopes over WebSocket and HTTP (browser + Node.js)","maintainers":[{"name":"alikh","email":"al_kh31@hotmail.com"}],"readme":"# @alikh/dwarflab-sdk\n\nTypeScript SDK for controlling DWARFLAB DWARF smart telescopes over WebSocket and HTTP. Works in both browser and Node.js environments.\n\n> **Unofficial / independent project.** Not affiliated with, authorized, or\n> endorsed by DWARFLAB. \"DWARF\" and \"DWARFLAB\" are trademarks of their respective\n> owner and are used only to describe the hardware this SDK talks to. The protocol\n> was derived by observing a telescope's own network traffic and may be incomplete\n> or change between firmware versions. Use at your own risk.\n\n## Installation\n\n```bash\nnpm install @alikh/dwarflab-sdk\n\n# Node.js also needs a WebSocket implementation\nnpm install ws\n```\n\n## Quick Start\n\n```typescript\nimport { DwarfClient, DeviceType, Command } from '@alikh/dwarflab-sdk';\nimport WebSocket from 'ws'; // Only needed in Node.js\n\nconst dwarf = new DwarfClient({\n  host: '192.168.88.1',\n  deviceType: DeviceType.DWARF3,\n  WebSocket, // Omit in browser\n});\n\nawait dwarf.connect();\n\n// Take a photo with the telephoto camera\nawait dwarf.cameraTele.openCamera();\nawait dwarf.cameraTele.setExposure(5);\nawait dwarf.cameraTele.takePhoto();\n\n// Astrophotography workflow — set location first, then calibrate\nawait dwarf.system.setLocation(-122.4, 37.7); // lon, lat — required before astro ops\nawait dwarf.astro.startCalibration(-122.4, 37.7);\nawait dwarf.astro.gotoDSO(83.822, -5.391, 'M42');\nawait dwarf.astro.startLiveStacking();\n\n// Listen for notifications (battery level updates)\nconst unsubscribe = dwarf.on(Command.NOTIFY_ELE, (packet, decoded) => {\n  console.log('Battery level:', decoded.level); // percent, 0–100\n});\n\n// HTTP API\nconst deviceInfo = await dwarf.device.getDeviceInfo();\nconst media = await dwarf.album.getMediaList(0, 0, 20);\n\n// Cleanup\nunsubscribe();\ndwarf.disconnect();\n```\n\n## Device support\n\nThe SDK speaks the DWARF WebSocket/HTTP protocol, which is shared across the DWARF\nfamily. The device IDs the SDK actually recognizes are:\n\n| Device | `DeviceType` | Status |\n|--------|--------------|--------|\n| DWARF 3 | `DeviceType.DWARF3` | ✅ **Verified** on real hardware |\n| DWARF 2 | `DeviceType.DWARF2` | ⚠️ Protocol-compatible, **untested** |\n| DWARF 3 Plus | `DeviceType.DWARF3B` | ⚠️ Protocol-compatible, **untested** |\n| DWARF Mini | `DeviceType.DWARF_MINI` | ⚠️ Protocol-compatible, **untested** |\n\nOnly the DWARF 3 has been validated against physical hardware. The other models\nshare the same command surface and are expected to work, but are unverified. There\nis no DWARF 3 Pro, Bilbo, DWARF 4, or Dragon — those were entries in older builds\nand are not real devices.\n\n## Client Options\n\n```typescript\ninterface DwarfClientOptions {\n  host: string;           // Telescope IP (default WiFi: '192.168.88.1')\n  port?: number;          // WebSocket port (default: 9900)\n  httpPort?: number;      // HTTP API port (default: 8082)\n  deviceType?: DeviceType; // Device model (default: DWARF3)\n  WebSocket?: unknown;    // WebSocket constructor for Node.js (pass `ws`)\n  reconnect?: boolean;    // Auto-reconnect on disconnect (default: true)\n  reconnectDelay?: number; // Initial reconnect delay ms (default: 1000)\n  maxReconnectDelay?: number; // Max backoff delay ms (default: 30000)\n  requestTimeout?: number; // Command timeout ms (default: 10000)\n  logLevel?: LogLevel;    // 'debug' | 'info' | 'warn' | 'error' (default: 'warn')\n}\n```\n\n## WebSocket Modules\n\nAll modules are accessed as properties on the `DwarfClient` instance. Together they\nexpose 310+ telescope commands:\n\n| Property | Module | Methods | Description |\n|----------|--------|---------|-------------|\n| `cameraTele` | CameraTeleModule | 47 | Telephoto camera control |\n| `cameraWide` | CameraWideModule | 36 | Wide-angle camera control |\n| `astro` | AstroModule | 33 | Astrophotography workflows |\n| `system` | SystemModule | 7 | Time, location, CPU mode |\n| `power` | PowerModule | 6 | RGB LED, power, reboot |\n| `motor` | MotorModule | 6 | Joystick, slew, dual-camera |\n| `tracking` | TrackingModule | 13 | Object tracking, sentry mode |\n| `focus` | FocusModule | 8 | Auto/manual focus |\n| `panorama` | PanoramaModule | 12 | Panorama capture |\n| `schedule` | ScheduleModule | 8 | Shooting schedules |\n| `taskCenter` | TaskCenterModule | 8 | Task management |\n| `params` | ParamsModule | 7 | Cross-camera parameter control |\n\n## HTTP API\n\n| Property | API | Description |\n|----------|-----|-------------|\n| `device` | DeviceHttpApi | Device info, factory reset, logs |\n| `album` | AlbumHttpApi | Media listing, deletion, FITS files |\n| `firmware` | FirmwareHttpApi | Firmware updates, camera config |\n\n## Notifications\n\nThe telescope pushes real-time notifications over WebSocket. Listen for them with `dwarf.on()`:\n\n```typescript\nimport { Command } from '@alikh/dwarflab-sdk';\n\n// Battery updates — decoded.level is the charge percentage (0–100)\ndwarf.on(Command.NOTIFY_ELE, (packet, decoded) => {\n  console.log('Battery level:', decoded.level);\n});\n\n// Live stacking progress\ndwarf.on(Command.NOTIFY_PROGRASS_CAPTURE_RAW_LIVE_STACKING, (packet, decoded) => {\n  console.log('Stacking progress:', decoded);\n});\n\n// Goto state changes\ndwarf.on(Command.NOTIFY_STATE_ASTRO_GOTO, (packet, decoded) => {\n  console.log('Goto state:', decoded);\n});\n```\n\n38 notification event types are available. See the [notifications docs](../../docs/notifications.md) for the full list.\n\n## Advanced: Raw Protocol Access\n\nFor commands not covered by the high-level module APIs:\n\n```typescript\nimport { Command, encodePayload, decodeResponse, proto } from '@alikh/dwarflab-sdk';\n\n// Send any command with raw params\nconst result = await dwarf.sendCommand(Command.ASTRO_START_CALIBRATION, {\n  lon: -122.4,\n  lat: 37.7,\n});\n\n// Direct protobuf encoding\nconst payload = encodePayload(Command.CAMERA_TELE_SET_EXP, { value: 5 });\n\n// Access raw protobuf types\nconst msg = proto.camera.ReqOpenCamera.create({ binning: 0 });\nconst bytes = proto.camera.ReqOpenCamera.encode(msg).finish();\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}