Docs
Rules
The Rules widget holds if-then logic. The server watches the pins and acts when a condition is met.
Use it for: turn the fan on above 28 degrees, send a notification when the tank drops below 20 per cent, close the valve if the flow meter stops.
| Setting | What it does |
|---|---|
| Rules | the list of conditions and actions |
| Condition | a pin compared against a value |
| Action | write a pin, send a notification, send an email |
| Enabled | switch a rule off without deleting it |
Open these from the canvas: tap Edit, then long press the widget and choose Configure.
Why put logic here
The rule lives on the server, not in the sketch. Changing a threshold from 28 to 26 degrees takes a tap, with no recompiling and no cable.
Your board keeps doing one job: report readings and act on pins.
Writing a rule
A rule needs a pin to watch, a comparison, and something to do.
V2 > 28 then write V1 to 1 turns the fan on when the temperature passes
28 degrees. Add the opposite rule, V2 < 26 writes V1 to 0, and the fan
switches off two degrees lower.
Those two degrees are the point. A single threshold makes the fan chatter on and off around 28.
What runs where
Rules need the pin values to reach the server, so they work on virtual pins
your sketch writes with Plynx.virtualWrite().
Rules fire while your phone is closed. The app only edits them.
Troubleshooting
| Problem | Check |
|---|---|
| Rule never fires | the pin has no incoming values; check virtualWrite() |
| Output chatters on and off | one threshold for both directions; use two rules with a gap |
| Rule fires but the board ignores it | the target pin has no handler in the sketch |
| Rule fires late | the value reaches the server on your interval, not instantly |