You have this code in that function
msg.payload = msg.payload[0]/1;
msg.payload = { 'value': msg.payload[0],
The first line sets msg.payload to whatever is in msg.payload[0], though I don't know why you are dividing it by 1. After that line is executed msg.payload is no longer an array. In the second line you are trying to pick up msg.payload[0] again, but it is no longer an array. Perhaps you meant
msg.payload = {value: msg.payload,
If the purpose of dividing by 1 is to convert it from a string to a number then you can remove the first line, and in the second line use
msg.payload = { 'value': Number(msg.payload[0]),