Set 'undefined' to 0

Hi guys,

I just started some days ago with Node-RED.

I have maybe a dummy a question.

I read via http a XML file from a Converter. During daytime it works but if the converter is hybernating the power value is received a 'undefined'.

Could someone give me an hint how I have to setup a function that writes a 0 to the Output if the value is 'undefined' otherwise pass the value to the output.

22.3.2021, 21:32:47node: 31ec5315.f48fbc
msg.payload : undefined
undefined

may I suggest a google search with 'javascript test for undefined'

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