node-red-contrib-home-assistant-websocket
Version:
Node-RED integration with Home Assistant through websocket and REST API
21 lines (20 loc) • 827 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const OutputController_1 = __importDefault(require("../../common/controllers/OutputController"));
class ButtonController extends OutputController_1.default {
async onTrigger(data) {
const message = {};
await this.setCustomOutputs(this.node.config.outputProperties, message, {
config: this.node.config,
entity: data.entity,
entityState: data.entity.state,
triggerId: data.entity.entity_id,
});
this.status.setSuccess('home-assistant.status.pressed');
this.node.send(message);
}
}
exports.default = ButtonController;
;