Back to Index

Definition: msg_is_number — Allowed: read-only variable inside onmqtt; Not allowed: assignment.

Helper flag inside onmqtt blocks. Set to 1 when the payload parses as a number (JSON number or numeric text). It is 0 for boolean payloads such as true/false.

Example

onmqtt("plc/sp") {
  if (msg_is_number) {
    setpoint = msg_value;
    save(setpoint);
  }
}