Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mnazirp opened this issue Dec 7, 2023 · 1 comment
Open

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

mnazirp opened this issue Dec 7, 2023 · 1 comment

Comments

@mnazirp
Copy link

mnazirp commented Dec 7, 2023

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

[
    {
        "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
Copy link
Contributor

golfvert commented Dec 9, 2023

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

  • you have to repeat the key for each pair of timestamp and value
  • it looks like (I have not tested it though) that you have to create the key before using TS.MADD

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants