How to test is msg.payload is a number or not?

I have a flow that reads a temperature sensor in Home Assistant and puts the numeric value in a flow variable. Works fine. However, if something happens to the sensor, the reading becomes "unavailable".

How can I detect that? Basically, if msg.payload is "unavailable", I want to stop the flow.

You can use a Switch node to only pass messages of type Number

image

If, however, even when it contains a number it is actually a string containing a number then you could configure the node to send messages with payload containing unavailable to one output and otherwise to the second output, and only use the messages on second output.

Thanks. That fixed it.

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