mirror of
https://github.com/bemble/node-red-contrib-mi-devices.git
synced 2026-03-18 07:49:07 +01:00
24 lines
820 B
JavaScript
24 lines
820 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const constants_1 = require("../constants");
|
|
exports.default = (RED, type) => {
|
|
class WriteAction {
|
|
constructor(props) {
|
|
RED.nodes.createNode(this, props);
|
|
this.on('input', (msg) => {
|
|
if (msg.sid) {
|
|
msg.payload = {
|
|
cmd: "write",
|
|
data: {
|
|
status: this.type.replace(`${constants_1.Constants.NODES_PREFIX}-actions `, ''),
|
|
sid: msg.sid
|
|
}
|
|
};
|
|
this.send(msg);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
RED.nodes.registerType(`${constants_1.Constants.NODES_PREFIX}-actions ${type}`, WriteAction);
|
|
};
|