@fabianvolkers/n8n-nodes-modbus-trigger
Version:
n8n node to trigger Modbus Address on change
22 lines • 895 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createClient = void 0;
const modbus_stream_1 = __importDefault(require("modbus-stream"));
const n8n_workflow_1 = require("n8n-workflow");
const createClient = async (credentials) => {
const { host, port, timeout = 5000 } = credentials;
return new Promise((resolve, reject) => {
modbus_stream_1.default.tcp.connect(port, host, { debug: null, connectTimeout: timeout }, (err, client) => {
if (err) {
reject(new n8n_workflow_1.ApplicationError(err.message));
return;
}
resolve(client);
});
});
};
exports.createClient = createClient;
//# sourceMappingURL=GenericFunctions.js.map