Join node throwing Unexpected end of JSON error

I just started working with Rhasspy and using Node-Red to handle the intents from Rhasspy.
I am getting the ' Unexpected end of JSON input error' on a join node when I try to combine 2 payloads into one.

I'm still learning NR and I'm sure I've mucked something up somewhere. I've tested and everything works up until the Join.

So in a netshell, the intent triggers 2 nodes to grab data from Home Assistant, then I use funtion nodes to give some words to the data, then change nodes to set different msg.topic values, followed by a join to combine them, except the join doesn't.

[{"id":"5754556a.c9ebbc","type":"api-current-state","z":"c9c0d07b.2751c","name":"House Temperature","server":"890f6b21.aaf278","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is_not","override_topic":false,"entity_id":"sensor.house_temperature","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":430,"y":380,"wires":[["16a3a357.5bb1cd"]]},{"id":"af88e8c3.01eda8","type":"api-current-state","z":"c9c0d07b.2751c","name":"Outside Temperature","server":"890f6b21.aaf278","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is_not","override_topic":false,"entity_id":"sensor.temperature","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":260,"y":480,"wires":[["8cc48f57.6aaf7"]]},{"id":"8cc48f57.6aaf7","type":"function","z":"c9c0d07b.2751c","name":"Outside Temp prefix","func":"msg.payload = \"It is\" + msg.payload + \"degrees outside\";\nreturn msg;","outputs":1,"noerr":0,"x":480,"y":480,"wires":[["c2e216ec.273778","6e846956.116f08"]]},{"id":"16a3a357.5bb1cd","type":"function","z":"c9c0d07b.2751c","name":"House Temp prefix","func":"msg.payload = \"and\" + msg.payload + \"degrees inside\";\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":380,"wires":[["4539666.d209598","6e846956.116f08"]]},{"id":"c2e216ec.273778","type":"change","z":"c9c0d07b.2751c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":480,"wires":[["a8511133.286cb"]]},{"id":"4539666.d209598","type":"change","z":"c9c0d07b.2751c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":380,"wires":[["a8511133.286cb"]]},{"id":"a8511133.286cb","type":"join","z":"c9c0d07b.2751c","name":"Output Test","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"bin","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":930,"y":440,"wires":[["812b9af3.882998","6e846956.116f08"]]},{"id":"6e846956.116f08","type":"debug","z":"c9c0d07b.2751c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":660,"wires":[]},{"id":"890f6b21.aaf278","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Appraciate any assist on this

I have taken out the HA nodes and replaced them with Inject nodes so that it can be tested without the HA nodes and it works ok for me.
Which version of node-red are you using? Edit: Also tell us the nodejs version, the command node -v will tell you that.
Are you sure it is the Join node that is showing the error? Can you do a screenshot of the error?

For the future please see this post for how to share flows here, it makes it easier to copy them if you do that. How to share code or flow json

Here is my flow, does it fail for you?

[{"id":"8cc48f57.6aaf7","type":"function","z":"84405ff5.25fa6","name":"Outside Temp prefix","func":"msg.payload = \"It is\" + msg.payload + \"degrees outside\";\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":2140,"wires":[["c2e216ec.273778","6e846956.116f08"]]},{"id":"16a3a357.5bb1cd","type":"function","z":"84405ff5.25fa6","name":"House Temp prefix","func":"msg.payload = \"and\" + msg.payload + \"degrees inside\";\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":2040,"wires":[["4539666.d209598","6e846956.116f08"]]},{"id":"c2e216ec.273778","type":"change","z":"84405ff5.25fa6","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":2140,"wires":[["a8511133.286cb"]]},{"id":"4539666.d209598","type":"change","z":"84405ff5.25fa6","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":2040,"wires":[["a8511133.286cb"]]},{"id":"a8511133.286cb","type":"join","z":"84405ff5.25fa6","name":"Output Test","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"bin","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":850,"y":2100,"wires":[["6e846956.116f08"]]},{"id":"6e846956.116f08","type":"debug","z":"84405ff5.25fa6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":690,"y":2320,"wires":[]},{"id":"0cc9d49e1b988ba6","type":"inject","z":"84405ff5.25fa6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":210,"y":2040,"wires":[["16a3a357.5bb1cd"]]},{"id":"ba4f029073cd74ba","type":"inject","z":"84405ff5.25fa6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":2140,"wires":[["8cc48f57.6aaf7"]]}]

@Colin Your flow fails with the same error.

It appears I'm a bit behind on my Node-Red, I'm running 1.0.2
nodejs is 10.16.3

I can confirm that the flow I posted fails on 1.0.4 so it must be a bug that has been fixed since then. The solution appears to be to upgrade node-red.

[Edit] It works on 1.3.3. Both use nodejs 10.x so it probably is the node-red version not nodejs.

1 Like

@Colin I upgraded to 2.1.3 and your test flow doesn't fail.

Presumably your real flow is ok too.

@Colin

It's not actually, well sort of.
It's grabbing the correct data but the entire template code is being passed as the text to speak.

So when I ask for the temperature Rhasspy speaks the following;
{"1":"It is6.1degrees outside","2":"and21.0degrees inside"}

Is this happening because my join is set to create 'a key/value object'?

Is this the same question as your other thread?

@Colin
Similar issue, thinking the other thread is a better location for this.

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