UNPKG

node-red-contrib-nanoleaf

Version:

[![platform](https://img.shields.io/badge/platform-Node--RED-red?logo=nodered)](https://nodered.org) [![Min Node Version](https://img.shields.io/node/v/node-red-contrib-nanoleaf.svg)](https://nodejs.org/en/) [![GitHub version](https://img.shields.io/githu

25 lines (21 loc) 778 B
module.exports = function (RED) { 'use strict' function Information(config) { RED.nodes.createNode(this, config) var node = this var installationObj = RED.nodes.getNode(config.installation) this.on('input', (msg) => { installationObj.info() .then((info) => { msg.payload = info node.status({fill: 'green', shape: 'ring', text: 'ok'}); node.send(msg) }) .catch((err) => { node.status({fill: 'red', shape: 'dot', text: err.code}); node.error(err.message, err) }) }) } RED.nodes.registerType('information', Information) }