Write Data Points
Data point names, types, and ranges must match the Gizwits product definition. Values may be boolean, number, string, or Array<number>.
Select a transport automatically
GizDevice.sendDataPoints() selects the first ONLINE_CONTROLLABLE transport in BLE, LAN, MQTT order.
import { GizDataPointMap, GizDataPointValue } from '@gizwits/smart-sdk';
const dataPoints: GizDataPointMap = new Map<string, GizDataPointValue>();
dataPoints.set('power', true);
dataPoints.set('temperature', 26);
await device.sendDataPoints(dataPoints);Select a specific transport
Call the corresponding capability when the application must fix the transport:
await device.bleCapability.sendDataPoints(device, dataPoints);
await device.lanCapability.sendDataPoints(device, dataPoints);
await device.mqttCapability.sendDataPoints(device, dataPoints);MQTT also provides an equivalent manager entry point:
await GizMqttManager.sendDeviceDataPoints(device, dataPoints);Only use a transport that is installed, initialized, and controllable. Every asynchronous call can throw when the device is offline, authentication fails, the network changes, or an operation times out.