UNPKG

node-red-contrib-home-assistant-websocket

Version:
21 lines (20 loc) 827 B
"use strict"; 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;