divoom-times-gate-client
v1.0.1
Published
Client library for controlling Divoom devices via divoom-times-gate-server, divoom-times-gate-5g-server, or divoom-ble-server
Maintainers
Readme
divoom-times-gate-client
Client library for controlling any Divoom device from any Node.js application.
Works with all three server daemons — connect it to whichever matches your device:
| Server | Device |
|--------|--------|
| divoom-times-gate-server | Times Gate (standard, MQTT) |
| divoom-times-gate-5g-server | Times Gate 5G (HTTP) |
| divoom-ble-server | Pixoo, Pixoo64, Timebox, Ditoo (BLE) |
Installation
npm install divoom-times-gate-clientQuick start
const DivoomClient = require('divoom-times-gate-client');
const device = new DivoomClient({
host: '192.168.1.50', // IP of the machine running divoom-times-gate-server
});
await device.connect();
console.log('Connected. Device ID:', device.deviceId);
await device.setBrightness(80);
await device.sendText('Hello!');
await device.setScoreboard(3, 1);
const timer = await device.getTimer();
console.log('Timer:', timer);Constructor options
new DivoomClient({
host: '127.0.0.1', // server host
port: 3000, // server WebSocket port
responseTimeout: 5000, // ms to wait for device replies
})Events
device.on('heartbeat', msg => console.log('Signal:', msg.WifiSingal));
device.on('deviceConnected', msg => console.log('Device came online'));
device.on('deviceDisconnected', msg => console.log('Device went offline'));
device.on('message', msg => console.log('Response:', msg));
device.on('disconnected', () => console.log('Lost connection to server'));API reference
Connection
await device.connect() // connect to server, resolves when ready
device.disconnect() // close connection
device.deviceId // device ID (available after connect)
device.userId // user ID (available after connect)Screen
device.setScreen(true) // turn on
device.setScreen(false) // turn off
device.setBrightness(80) // 0–100
await device.getScreenState() // → { OnOff, ... }
device.setProduceTime(60) // seconds per itemClock faces & channels
device.setClockFace(clockId, lcdIndex?)
device.set5LcdChannelType(channelType, lcdIndependence?)
device.set5LcdWholeClockId(clockId)Equalizer
await device.getEqPosition()
device.setEqPosition(position)RGB & Ambient light
await device.getRGBInfo()
device.setRGBInfo({ Brightness: 100, Color: '#ff0000', ColorCycle: 0, OnOff: 1 })
await device.getAmbientLight()
device.setAmbientLight({ Brightness: 100, Color: '#ffffff', SelectEffect: 0 })Night preview
device.setNightPreview(30)
device.exitNightPreview()Drawing / Pixel art
device.sendDrawInfo(opts)
device.exitDraw()
device.setDrawSpeedMode(mode)
device.sendDrawByLcdIndex(lcdIndex, opts)Voice / Text
device.sendText('Hello world!')
device.setVoicePixel(opts)Danmaku
device.sendDanmaku('Hi!')
device.sendRandomFace()Tools
await device.getTimer()
device.setTimer({ Minute: 5, Second: 0, Status: 1 }) // Status: 0=stop 1=start
await device.getStopwatch()
device.setStopwatch(1) // 0=stop 1=start 2=reset
await device.getScoreboard()
device.setScoreboard(3, 1) // blue, red
await device.getNoiseStatus()
device.setNoiseStatus(true)Tomato timer
device.startTomato(opts)
device.listenTomato(opts)
device.setTomatoVolume(80)
device.deleteTomato(id)Alarms
device.listenAlarm(opts)
device.setAlarmVolume(80)Photos & Albums
device.playAlbum(albumId)
device.setAlbumCover(albumId, fileId)
device.deletePhoto(fileId)
device.removePhotoFromAlbum(albumId, fileId)
device.sendPhotoToAlbum(albumId, fileId)Playlist
device.sendPlaylist(opts)Calendar
device.enterGoogleCalendar(opts)
device.enterOutlookCalendar(opts)Related
divoom-times-gate-server— server for Times Gate (MQTT)divoom-times-gate-5g-server— server for Times Gate 5G (HTTP)divoom-ble-server— server for BLE devices (Pixoo, Timebox, Ditoo)
License
MIT
