UNPKG

node-red-contrib-home-assistant-websocket

Version:
28 lines (27 loc) 1.29 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const BidrectionalIntegration_1 = __importDefault(require("../../common/integration/BidrectionalIntegration")); const Integration_1 = require("../../common/integration/Integration"); class SentenceIntegration extends BidrectionalIntegration_1.default { getDiscoveryPayload() { var _a; const response = this.node.config.triggerResponse === '' ? undefined : this.node.config.triggerResponse; // set the timeout to 1000 milliseconds if not set and convert to seconds const timeout = ((_a = this.node.config.responseTimeout) !== null && _a !== void 0 ? _a : 1000) / 1000; return { type: Integration_1.MessageType.SentenceTrigger, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion server_id: this.node.config.server, sentences: this.node.config.sentences, response, response_type: this.node.config.triggerResponseType, response_timeout: timeout, }; } } exports.default = SentenceIntegration;