chameleonbr / node-red-contrib-redis

Node RED client for Redis with pub/sub, list, lua scripting and other commands support.
MIT License
46 stars 40 forks source link

ERR wrong number of arguments for 'TS.MADD' command #65

Open mnazirp opened 9 months ago

mnazirp commented 9 months ago

when I try to ADD multiple values in redis timeseries, using redis command TS.MADD i got error ReplyError: ERR wrong number of arguments for 'TS.MADD' command I have set the payload with simple array = [key, timestamp1, value1,timestamp2, value2,...] can you help me what Im doing wrong in node-red? here is my flow

Flow Json

```javascript [ { "id": "25fbce0f85732f86", "type": "inject", "z": "b5ec5e315779d1ba", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 220, "y": 460, "wires": [ [ "a8a9a877b0454df2" ] ] }, { "id": "a8a9a877b0454df2", "type": "function", "z": "b5ec5e315779d1ba", "name": "function 72", "func": "msg.payload = [\n \"MJECCB2F1N5001206:engineHours\",\n 1638864000000,\n 25,\n 1638864100000,\n 26,\n 1638864200000,\n 24\n];\nreturn msg;", "outputs": 1, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 430, "y": 460, "wires": [ [ "fe935740fd98ef5b" ] ] }, { "id": "fe935740fd98ef5b", "type": "redis-command", "z": "b5ec5e315779d1ba", "server": "8ca322e6bc2d554c", "command": "TS.MADD", "name": "", "topic": "", "params": "[]", "paramsType": "json", "payloadType": "json", "block": false, "x": 440, "y": 500, "wires": [ [ "00b47a3e04493d53" ] ] }, { "id": "00b47a3e04493d53", "type": "debug", "z": "b5ec5e315779d1ba", "name": "debug 163", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 650, "y": 500, "wires": [] }, { "id": "8ca322e6bc2d554c", "type": "redis-config", "name": "REDIS_TS_URL", "options": "REDIS_TS_URL", "cluster": false, "optionsType": "env" } ] ```

image `

golfvert commented 9 months ago

According to https://redis.io/commands/ts.madd/#examples, two things:

And last but no least, make sure you don't define (even with an empty value) msg.topic It creates problems in some cases. Again, not tested with this particular command.