Definition: save(name) — Allowed: identifier or string literal name; Not allowed: expression name.
Writes the current value of name to non-volatile storage. Use after intentional updates so values persist across reboots.
Note: ESP32 NVS has a finite write endurance, so avoid calling save in fast loops; guard it so it only runs when needed or infrequently.
onmqtt("plc/sp") {
if (msg_is_number) {
setpoint = msg_value;
save(setpoint);
}
}