UNPKG

node-red-contrib-smartnora

Version:

Google Smart Home integration via Smart Nora https://smart-nora.eu/

39 lines (38 loc) 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("./util"); module.exports = function (RED) { RED.nodes.registerType('noraf-camera', function (config) { var _a; RED.nodes.createNode(this, config); const protocols = (_a = config.protocols) !== null && _a !== void 0 ? _a : []; if (!protocols) { return; } (0, util_1.registerNoraDevice)(this, RED, config, { deviceConfig: { type: 'action.devices.types.CAMERA', traits: ['action.devices.traits.CameraStream'], name: { name: config.devicename, }, roomHint: config.roomhint, willReportState: true, attributes: { cameraStreamNeedAuthToken: !!config.cameraStreamNeedAuthToken, cameraStreamSupportedProtocols: protocols.map(p => p.cameraStreamProtocol), }, noraSpecific: { asyncCommandExecution: config.asyncCmd, cameraStreamProtocols: protocols, }, state: { online: true, }, }, handleNodeInput: async ({ msg, updateState }) => { await updateState(msg === null || msg === void 0 ? void 0 : msg.payload); }, }); }); };