node-red

How Can I parse out JSON in a Node-RED Function

一笑奈何 提交于 2019-12-10 22:21:03
问题 I am working with Node-RED in Bluemix for IoT. How can I parse out the individual pieces of information (like the cmdmsg and the tempr) in a function node so I can use it in other nodes in the flow? I'm getting an error when I try (see below) I am receiving the JSON complete message object (from an IoT in Node) that I see in my "debug" node when I set it to look at the complete message object. see the object below. It appears to me that the JSON is formatted correctly. I tried putting the

Nodejs seems to be not working; npm do work, however

不问归期 提交于 2019-12-10 15:52:44
问题 I was running Node.js and Node-RED (depends on Node.js) normally one week ago. My system is Windows 8.1 64 bits. Nevertheless, today I am having a issue: As normally, I go to the node-red folder, and run node red.js. Then, surprisingly I got the following message from the prompt: Node Commands Syntax: node {operator} [options] [arguments] Parameters: /? or /help - Display this help message. list - List nodes or node history or the cluster listcores - List cores on the cluster view - View

Send data on configuration

狂风中的少年 提交于 2019-12-09 23:47:37
问题 I want to send asynchronous data to the node on configuration. I want to perform a SQL request to list some data in a . On node creation, a server side function is performed When it's done, a callback send data to the node configuration On node configuration, when data is received, the list is created Alternatively, the binary can request database each x minutes and create a cache that each node will use on creation, this will remove the asynchronous part of code, even if it's no longer "live

HTTP POST in node-red js

微笑、不失礼 提交于 2019-12-09 13:36:43
问题 I want to know how to do a http POST request with a JSON data into some server with API key. I searched in http://nodered.org/docs/ But they haven't written anything clearly. The documentation is very messy and not even good to understand. However, I have tried to POST a JSON data which is stringified: {"version":"1.0.1","sensors":[{"sensor":"accel","output":[{"name":"accelert","type":"dcmotion"}]}]} I have written the API in function node as (API is arbitary here, not original) var msg = {

Handling MQTT communication inside HTTP request in Node-Red

心不动则不痛 提交于 2019-12-08 14:07:25
In Node-Red, I would like to be able to send a message and wait for its response using MQTT, in between an HTTP input node and a response one. I think a picture is more relevant to explain this: The problem is an HTTP response node has to be directly linked to an input one somehow, so I thought of saving the whole message in context after receiving an HTTP input, then restore it before sending the response. The problem is that apparently, the structure of the message is circular, hence I can't directly convert it to a string, to store it in context. I've tried different things to solve this

node-red - Node Credentials

女生的网名这么多〃 提交于 2019-12-07 09:04:22
问题 Within a node-red flow I have a CassandraDatabase node with a user and pass. When I export the flow these credentials are not contained in the json, instead a flows_cred.json file appears with an encrypted string: {"$": "df28....... ... however if I copy this file out and try to bring up my node-red instance elsewhere I get the following at startup: [warn] Error loading credentials: SyntaxError: Unexpected token � in JSON at position 0 ... followed by a repeating "AuthenticationError:

Send data on configuration

為{幸葍}努か 提交于 2019-12-04 19:43:41
I want to send asynchronous data to the node on configuration. I want to perform a SQL request to list some data in a . On node creation, a server side function is performed When it's done, a callback send data to the node configuration On node configuration, when data is received, the list is created Alternatively, the binary can request database each x minutes and create a cache that each node will use on creation, this will remove the asynchronous part of code, even if it's no longer "live updated". In fact, i'm stuck because i created the query and added it as below : module.exports =

How to embed multiple instances of node-red in node app

浪子不回头ぞ 提交于 2019-12-04 12:11:07
Node-red documentation here gives info on how to embed a single node-red app inside a nodejs app - http://nodered.org/docs/embedding We wanted our site's users to have their own node-red's on different ports for some custom programming. Is it possible to embed multiple node-red apps in a nodejs applicaiton? I tried repeating same steps for embedding by changing settings of each call with different port but only one time it is created. First time, a node-red instance is created based on settings. Next time we call, we get port in use. I assume this has something to do with node require doing

Node-RED, IOT Foundation Out Node Not Sending Commands

扶醉桌前 提交于 2019-12-04 12:06:40
I have a Node-RED application that is bound to an IOT Foundation (iotf) service. I can receive events from devices and handle them appropriately. However, I am now interested in sending commands back to my devices and am having some problems. Nothing is showing up at the device, but by creating an IOTF in node, I can confirm that the command is passing through iotf. I can definitely get commands to pass through iotf using pure python, as the follow code works well: Client code: #!/usr/bin/python import ibmiotf.device from time import sleep options = { "org": "cgmncc", "type": "table", "id":

how to import printed C console to node red

戏子无情 提交于 2019-12-04 06:46:25
问题 i'm using Dragino rpi Lora transceiver C code on the pi to send and receive packets to the Arduino . the C code is working perfectly where it prints the received packets and the Signal to noise ratio and the timestamp , but i want to use it in node red . how can i import the received packet from the C console to node red ? 回答1: You need to use the node-red-node-daemon for long running processes that run until stopped and receive input via standard in and send results by standard out. 来源: