Move from exec node to daemon node has caused an unusual problem

So I've moved from the exec node to the daemon node for increased reliability of my PHP script which the daemon node is certainly providing. Only problem is for some reason, running the PHP script from the daemon node is resulting in some merged/blended messages which wasn't happening with the exec node. And like all good problems this one's intermittent.

I've attached a screenshot to show what is happening. See that 19:59 final message? That one is a blended message and plays havoc with my system. All the others are nicely split. Any way to deal with this situation. I don't want to miss messages so splitting them up when this happens is probably preferable before feeding them into the switch node? I'm guessing it happens when the messages come very close together in time.

I'd like to be able to use the split node and split on the carriage return but I don't think I can. I attempted to use a function node and

var values = msg.payload.trim().split('\t'); but the messages are still sometimes blended.

Thank you!

you should be able split on a carriage return in a function node with something like this:

if (msg.payload.match(/\r/g)) {
    const msgArr = msg.payload.trim().split('\r');
    msgArr.forEach(item => node.send({payload:item}));
} else {
    return msg;

Not tested so

Edit just tested and should work

1 Like

Seems to work brilliantly! Thank you!

1 Like

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