I’m new to IoT too, but we did exactly this for soap dispensers in our buildings last year and fought the same e-mail flood, so here’s what ended up working.
Send a fill level in percent instead of millimetres, it’s easier for the cleaners to understand: fill_pct = (190 - dist) / 150 * 100 on the ESP32. Then add debounce and hysteresis to the rule so one odd reading can’t open it, and a reading hovering at the limit can’t close and reopen it. Ours, adjusted to your numbers:
{
"type": "paper_low",
"title": "{{device.name}}: paper at {{value}} %",
"severities": [
{ "severity": "WARNING", "condition": { "key": "fill_pct", "op": "<", "value": 20 } }
],
"debounce": { "mode": "count", "raise": 4, "clear": 2 },
"hysteresis": 10,
"notify": {
"recipients": [ { "kind": "email", "email": "cleaning-lead@yourcompany.example" } ],
"minSeverity": "WARNING"
},
"enabled": true
}
With readings every 30 s, raise 4 means it has to be low for about 2 minutes in a row, and it only clears once it’s back above 30 % (after a refill). Paste it in the profile’s Alarm rules tab in JSON mode. E-mail only goes to explicit addresses in the notify block, so use the supervisor’s address there, not a role. Name the devices after the restroom („2F Men, towels“) because the title uses the device name. The debounce settings are explained on Debounce, hysteresis and dampening.

