toFixed: so Ubuntu = no error - so Raspberry = error

Hi,
I have one pc with ubuntu to test my code
and one Raspberry (so raspberry) for my home automation.

Why this simple function

const pay = Number(msg.payload.toFixed(1));

in Ubuntu is ok and in Raspeberry show this error ?

TypeError: msg.payload.toFixed is not a function

Because the payload is NOT a number on your PI flows.
Simple to verify with a debug node BEFORE the function.

2 Likes

It's a temperature value, I thought it was a numeric value, not string ....
Thank you very much (and thanks for your patience) ....

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