Paper towel level alarms fire every time someone pulls a towel
Backend dev, new to hardware, and I volunteered for this, so be kind.
Our office has 12 restrooms. I built a small ESP32 + VL53L0X time-of-flight sensor that sits on top of each paper towel and toilet roll dispenser and measures the distance down to the paper, every 30 s, sending {"dist_mm": 143}. Full is around 40 mm, empty around 190 mm.
I made an alarm rule on the profile: dist_mm > 160, severity WARNING. The cleaning supervisor got 70 e-mails on the first day. It fires whenever someone pulls a towel (the hand is in the way, or the roll swings) and then clears again 30 s later. It also fires on the toilet rolls when the roll spins. How do I make it only tell her when a dispenser is really running low?
On the device: take 5 readings a second apart and send the median, not one sample. Kills most of the hand-in-the-way readings before they leave the board.
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.
Deployed the median on the boards and this rule on Monday. 3 e-mails all week, each one a dispenser that was actually almost empty. The supervisor asked if she can get the toilet roll ones in the morning only, but that’s a problem for next week.
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.
Mitdiskutieren
Melde dich an, um Fragen zu stellen und zu beantworten, hilfreiche Beiträge mit „Gefällt mir“ zu markieren und die Antwort zu kennzeichnen, die dein Problem gelöst hat. Jeder Beitrag bringt Punkte und Stufen.

