I am very new to Node-red. I am using node-red version v1.3.5 and Influxdb 1.8.10
I am trying to get data into node red from Influx. I am able to run the following query in node-red function node and it works well:
msg.query='select * from em001'
my measurement name in influx is em001.
now if I want to add WHERE clause, it gets bit complicated.
I tried the following command at influx CLI and it works perfectly fine:
<select * from em001 where type='para1'>
it shows me all the data with tag type of para1.
I added this query to node red function node but it does not work:
msg.query='select * from em001 where type='paral1''
its not possible to use single quotes at 'para1' in the function node. I can use double quotes but these are not accepted by Influxdb and I always get error / empty query.
My flow is as below:
[
{
"id": "614a6e42.9a771",
"type": "influxdb in",
"z": "5e1050a9.7d05e",
"influxdb": "f0eb6285.91715",
"name": "",
"query": "",
"rawOutput": false,
"precision": "",
"retentionPolicy": "",
"org": "organisation",
"x": 620,
"y": 160,
"wires": [
[
"24212ff0.b802b"
]
]
},
{
"id": "1cd9712c.5bba8f",
"type": "inject",
"z": "5e1050a9.7d05e",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 210,
"y": 180,
"wires": [
[
"2c72f17c.662ffe"
]
]
},
{
"id": "2c72f17c.662ffe",
"type": "function",
"z": "5e1050a9.7d05e",
"name": "",
"func": "msg.query = 'select * from em001 where type=para1';\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 380,
"y": 180,
"wires": [
[
"614a6e42.9a771"
]
]
},
{
"id": "24212ff0.b802b",
"type": "debug",
"z": "5e1050a9.7d05e",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 880,
"y": 180,
"wires":
},
{
"id": "f0eb6285.91715",
"type": "influxdb",
"hostname": "127.0.0.1",
"port": "8086",
"protocol": "http",
"database": "EMS",
"name": "",
"usetls": false,
"tls": "",
"influxdbVersion": "1.x",
"url": "http://localhost:8086",
"rejectUnauthorized": true
}
]
Kindly help me to resolve this issue. Thanks in advance.