index.ts 1.61 KB
import { ExternalCategoryComponentEnum } from '../../../enum/category';
import { useCreateNodeKey } from '../../../hook/useCreateNodeKey';
import type { NodeItemConfigType } from '../../../types/node';
import { RuleNodeTypeEnum } from '../../index.type';

const keys = useCreateNodeKey(ExternalCategoryComponentEnum.AZURE_IOT_HUB);

export interface AzureIotHubDataType {
  someConfiguration?: Recordable;
}

export const AzureIotHubConfig: NodeItemConfigType = {
  ...keys,
  clazz: 'org.thingsboard.rule.engine.mqtt.azure.TbAzureIotHubNode',
  categoryType: RuleNodeTypeEnum.EXTERNAL,
  name: 'azure iot hub',
  configurationDescriptor: {
    nodeDefinition: {
      details: 'Will publish message payload to the Azure IoT Hub with QoS <b>AT_LEAST_ONCE</b>.',
      description: 'Publish messages to the Azure IoT Hub',
      inEnabled: true,
      outEnabled: true,
      relationTypes: ['Success', 'Failure'],
      customRelations: false,
      ruleChainNode: false,
      defaultConfiguration: {
        topicPattern: 'devices/<device_id>/messages/events/',
        host: '<iot-hub-name>.azure-devices.net',
        port: 8883,
        connectTimeoutSec: 10,
        clientId: null,
        appendClientIdSuffix: false,
        cleanSession: true,
        ssl: true,
        credentials: {
          type: 'sas',
          caCert: null,
          cert: null,
          privateKey: null,
          password: null,
          sasKey: null,
        },
      },
      uiResources: ['static/rulenode/rulenode-core-config.js'],
      configDirective: 'tbActionNodeAzureIotHubConfig',
      icon: '',
      iconUrl: '',
      docUrl: '',
    },
  },
};