"Call-service error. extra keys not allowed" Help

Hi guys,

Im trying to setup a flow that will pull down the version number of the installed Node-Red package and store the information within an Input_text helper within Home Assistant.

The command I am running seems to gather the information I need however when it attempts to update the input_text entity I get the following error:

Call-service error. extra keys not allowed @ data['0']

The error seems to suggest that there is a character this is not allowed however I can't see what that might be.


[{"id":"79c50acbb8a31ea1","type":"inject","z":"8685480636500a34","name":"Test Automation","props":[],"repeat":"","crontab":"00 12 * * *","once":false,"onceDelay":0.1,"topic":"","x":432,"y":846,"wires":[["9d05800c3e545546"]]},{"id":"9d05800c3e545546","type":"exec","z":"8685480636500a34","command":"npm -g info node-red version","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"Check Installed Version","x":668,"y":846,"wires":[["c1b0021ca796317f","6e2af9a3ffd03e6f"],[],[]]},{"id":"c1b0021ca796317f","type":"debug","z":"8685480636500a34","name":"Payload Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":908,"y":774,"wires":[]},{"id":"6e2af9a3ffd03e6f","type":"api-call-service","z":"8685480636500a34","name":"Log Version","server":"83ec8e72.cb41c","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.nodered_installed_version"],"data":"{\"value\":\"{{ payload }}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":934,"y":846,"wires":[[]]},{"id":"83ec8e72.cb41c","type":"server","name":"Home Assistant","version":5,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

Does it make a difference if you strip the carriage return off the end of the version string?

Thank you for reply, I was wondering about that but I wasn't sure how I could do that? Any ideas?

This is the command I am running:

npm -g info node-red version

The low code way would be to add -json to your command and then add a json node directly after the exec node.
Or use a function node and add

msg.payload = msg.payload.trim()
return msg;
1 Like

You could use npm -g info node-red version | tr -d '\n'

Or a change node in NR

[
    {
        "id": "0afc0aec5e666a4a",
        "type": "change",
        "z": "5541fa9c09b4fce3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$substringBefore($$.payload, \"\\n\")",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 609.2000122070312,
        "y": 332.20001220703125,
        "wires": [
            [
                "c1b0021ca796317f"
            ]
        ]
    }
]

JSONata has a $trim() function that will remove whitespace before and after

This worked perfectly, thank you!

npm -g info node-red version | tr -d '\n'

Thanks. I'm not waving but drowning in JSONata

1 Like

Generally drowning people can not wave.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.