node-red-contrib-mobius-flow-thingsboard
Version:
Node-RED nodes to work with MOBiUSFlow and ThingsBoard.io
32 lines (31 loc) • 1.43 kB
TypeScript
/// <reference types="node" />
import { EventEmitter } from 'events';
export interface IThingsboardMqttClient {
on(type: 'connecting', callback: () => void): any;
on(type: 'disconnected', callback: () => void): any;
on(type: 'connected', callback: () => void): any;
connect(): Promise<any>;
disconnect(): Promise<any>;
/**
* Update device client attributes on Thingsboard
* @param deviceName The device name
* @param attributes Attributes as an object of key value pairs
* Resolves if attributes are updated, else rejects
*/
updateClientAttributes(deviceName: string, attributes: any): Promise<any>;
/**
* Update device telemetry on Thingsboard
* @param deviceName The device name
* @param telemetry Telemetry as an object of key value pairs
* Resolves if telemetry is updated, else rejects
*/
updateDeviceTelemetry(deviceName: string, timestamp: number, telemetry: any): Promise<any>;
}
export declare class ThingsboardMqttClient extends EventEmitter implements IThingsboardMqttClient {
private mqttGateway;
constructor(siteURL: string, gatewayId: string, accessToken: string, isLocal: boolean);
connect(): Promise<any>;
disconnect(): Promise<any>;
updateClientAttributes(deviceName: string, attributes: any): Promise<any>;
updateDeviceTelemetry(deviceName: string, timestamp: number, telemetry: any): Promise<any>;
}