Add the meter
- Create the file first, so you can pick it:
echo 0 > ~/.meters/inbox(make the folder withmkdir -p ~/.meters). - Choose Add Meter…, pick File and choose the file.
- Add a key path if it’s JSON.
How it watches
- Multimeter is told by macOS when the file is written, so updates are immediate. It also re-reads every 30 seconds.
- Editors and scripts that replace the file (write a new one, then rename) are followed to the new file.
- Up to 256 KB is read.
What the file can contain
Web addresses, files and scripts all read the same two formats.
A plain number, or any text with a number in it. Multimeter takes the first number it finds, and drops thousands separators between digits, so 1,284 stars reads as 1284.
JSON. Either a bare number, or an object with value and any of these extras:
{
"value": 38,
"min": 0,
"max": 50,
"label": "DEPLOY",
"unit": "today",
"formatted": "38 of 50"
}Pointing at bigger JSON you don’t control, like an API response? Give the meter a key path. Dots walk into objects and numbers pick array items: data.items.0.count. Numbers inside strings work too ("67012.45"), and true/false count as 1 and 0.
Without min and max the range is 0 to 100, so for bigger numbers set a range in Customize This Meter… or send max.
Examples
Write it from anything:
echo 12 > ~/.meters/inboxWrite it safely from a job that might be read mid-write (write a temp file, then move it into place):
echo '{"value": 12, "label": "INBOX"}' > ~/.meters/inbox.tmp && mv ~/.meters/inbox.tmp ~/.meters/inboxFrom Python:
from pathlib import Path
Path.home().joinpath(".meters/queue").write_text('{"value": 17, "max": 100}')Check it worked
Change the number in the file. The meter should change within a second.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Can’t read the file | It was deleted or moved, or the folder isn’t readable. | Check the path, then pick the file again in Customize This Meter…. |
| No number found in the file | The file is empty or the key path doesn’t match. | Look at it with cat; make sure your writer doesn’t leave it empty between writes (use the temp-file-then-move pattern). |