UP↑SCALE › SCALES & ADAPTERS › TRACKING ON YOUR WEBSITE

Tracking mode on your own website: live chart, data storage, CSV export and e-mail alarms

The tracking mode of UP↑SCALE records a weight point at every interval - from 0.25 seconds to 24 hours - and raises alarms. This guide sends those runs to your own website or server: every point stored, a live chart, a CSV for the export and an e-mail at every alarm. For labs, makers, growers, bakers and everybody who runs a web server and wants the data there - with a ready-made example in one PHP file.

  • Every weight point of a run stored on your server
  • A live chart in the browser and a CSV export
  • An e-mail at every alarm, your own limits, a silent-scale check
  • From the scale over WiFi or from the app over Bluetooth / USB

In short

UP↑SCALE is one scale app for the scale you already have. Its tracking mode records a weight point at every interval, and this guide sends the runs to your own website: every point stored, a live chart, a CSV export and an e-mail at every alarm - with a free PHP example in one file (MIT). The scale sends by itself over WiFi, or the app sends while the scale is on Bluetooth or USB; both need PRO (from 4.43 EUR a month).

What it does

In the tracking mode the scale records one point per interval and watches the run: target reached, constant weight, a jump between two points, a peak, a weight above or below the average band, a fixed LOW or HIGH limit, a restart after a power cut. The example receiver takes these runs on your web server and:

  • stores every point of every run, one folder per scale and run
  • shows a live chart in the browser that follows the run as new points come in
  • gives a CSV export (and JSON) of every run for a spreadsheet or your own programs
  • sends an e-mail at every alarm - through PHP mail() or your own SMTP server
  • adds your own limits and, with a cron job, an e-mail when a recording scale goes silent

Typical uses: a drying or evaporation run in the lab, a silo or tank that must not run empty, a beehive or a plant pot over weeks, dough or a fermentation over night - anything where a weight changes over time and you want the record and the alarm on your own server, not in somebody else's cloud.

The tracking mode: uses, alarms, charts and FREE / PRO →

Two ways to get the data there

The same events reach the receiver in two ways: the scale sends them itself over WiFi, or the app sends them while the scale is connected over Bluetooth or USB. The receiver takes both.

The scale sends itself (WiFi)The app sends (Bluetooth / USB)
ConnectionThe scale in your WiFi network (WiFi session)The scale on Bluetooth or the USB cable of a connected device: a phone, tablet, PC or a small always-on PC or tablet next to the scale
LicencePROPRO
App open?No - it works with the app closedYes - open and connected to the scale
Securityhttps + token, HMAC-signed or sealed envelopehttps + token
What it sendsStart, stop, every alarm and every pointStart, stop, every alarm and every point - while the app is open
After a gapAfter a restart or when the receiver was away, the scale sends the run again from its first point; the receiver drops what it already hasThe scale records on its own; when the app connects again it sends the newest point and the alarms it did not send yet - not every point of the time without the app
Time of the pointsThe time of the scale: automatic in the WiFi network, or from an app connected onceThe time the app gives the scale
Where to set itLINK › 🔗 Webhook & JSON API › 🔗 Webhook exportSettings › 🔗 LIMS / ELN FORWARDING

Only one of the two at a time: while the webhook export of the scale is on, the LIMS / ELN forwarding of the app is off. PRO is a licence level of the app and the UP↑SCALE firmware: prices & versions.

Way 1: the scale sends itself over WiFi PRO

The best way for long runs: the scale posts every event itself while it is in your WiFi network, with no app open. In the app:

  1. Open LINK › 🔗 Webhook & JSON API and the box 🔗 Webhook export.
  2. Type the address of the receiver on your server and choose the security mode: https with a token, HMAC-signed or the sealed envelope - with the secret for the last two (the same secret goes into the settings of the receiver).
  3. Tick 📈 Tracking: start, end and every alarm of a run and 📈 Tracking: every new point of a run. The key 📡 TEST sends a test event.
  4. Start a run in the tracking mode. You can close the app now - the scale sends every point by itself.

The scale sends the start, the stop, every alarm (target, constant weight, jump, restart after a power cut, peak, above or below the average band, LOW and HIGH limits) and the points in batches of up to 16.

Nothing goes missing: after a restart of the scale or an outage of the receiver, the scale sends the run again from its first point; the receiver recognises every point by the run and its time and drops what it already has. The points need the time of the scale - set automatically in the WiFi network, or by an app that connected once; until then the run waits.

Way 2: the app sends (scale on Bluetooth or USB) PRO

For a scale without WiFi, or when a device with the app is next to the scale anyway - a phone, a tablet, a PC, or a small always-on PC or tablet with the app open. In the app:

  1. Open Settings › 🔗 LIMS / ELN FORWARDING.
  2. Type the https address of the receiver and the token.
  3. Tick the same two kinds: 📈 Tracking: start, end and every alarm of a run and 📈 Tracking: every new point of a run.

The app sends while it is open and connected to the scale. When it is closed, the scale goes on recording by itself; when the app connects again, it sends the newest point and the alarms it missed. It does not send every point of the time without the app afterwards - for runs without gaps use the WiFi way.

Browsers post only to https addresses, and the receiver must allow the address of the app, https://up-scales.com (CORS). The example already does both answers for you.

Alarms without any server

You do not need a website for the alarms alone:

  • ESP-NOW: the scale sends the state of the run and every alarm by radio to another UP↑SCALE device or your own microcontroller - for a buzzer, a lamp or a relay (alarms to other devices).
  • The app itself shows every alarm in a red card and, when the page is hidden, as a system notification of your phone or computer (tracking mode).

Setup of the PHP example

You need a web server with PHP 7.4 or newer (PHP 8.1+ recommended; the sealed envelope needs the openssl extension). No database: the runs are plain files, so it runs on almost every host.

  1. Download upscale-tracking-receiver.php. The link shows the file as text: save it as a .php file on your server, e.g. in a folder /upscale/.
  2. Settings: at the top of the file or as environment variables of the web server.
    SettingWhat it is
    UPSCALE_MODESThe security modes the receiver takes, e.g. 1,2,3 or only 3 (1 = https + token, 2 = HMAC-signed, 3 = sealed envelope)
    UPSCALE_TOKENSMode 1 (and the app): the token or tokens, separated by commas
    UPSCALE_SECRETModes 2 and 3: the secret you typed into the webhook box of the scale
    UPSCALE_DATAThe folder for the runs - outside your web root if you can (else the example puts a "deny all" .htaccess into it)
    UPSCALE_VIEW_KEYThe key of the chart, CSV and data pages: a long random text
    UPSCALE_MAIL_TO
    UPSCALE_MAIL_FROM
    Who gets the alarm e-mails (separated by commas; empty = no e-mails) and the sender address (on most hosts an address of your own domain)
    UPSCALE_SMTP_HOST
    UPSCALE_SMTP_PORT
    UPSCALE_SMTP_USER
    UPSCALE_SMTP_PASS
    UPSCALE_SMTP_TLS
    Empty = PHP mail() (the Python twin: the mail server of this computer on localhost:25, else the e-mail is skipped); else your SMTP server with port (587 STARTTLS, 465 TLS), user, password and the encryption: starttls, ssl or none
    UPSCALE_LIMIT_LOW
    UPSCALE_LIMIT_HIGH
    Your own limits in grams (empty = off): an e-mail when a point is at or below LOW (at or above HIGH), again only after it was back inside
    UPSCALE_SILENCE_MINWith the cron job: an e-mail when a recording run has sent no point for this many minutes (0 = off)
  3. The data folder must be writable for the web server. The example creates it if it can; if not, every request answers with what to do. Usually:
    mkdir upscale-tracking-data
    chown www-data upscale-tracking-data
    chmod 770 upscale-tracking-data

    www-data = the user of your web server (the setup page shows its name). On shared hosting the folder is often fine as it is, or set its rights to 755 / 775 in the file manager of your host. Never 777 on a shared server.

  4. Check the setup in the browser or on the command line: it shows PHP, openssl, the folder, the e-mail settings - and what to chmod / chown when something does not work.
    https://example.com/upscale-tracking-receiver.php?view=setup&key=<UPSCALE_VIEW_KEY>
    php upscale-tracking-receiver.php --setup
  5. Connect the scale or the app as described above (way 1 or way 2) and start a run in the tracking mode.
  6. The silence check (optional): a cron job every 5 minutes.
    0-59/5 * * * *  php /path/to/upscale-tracking-receiver.php --check
  7. Look at the data: the addresses below, each with &key= and your view key. The chart page asks for the key once and keeps it in your browser.
    AddressWhat it is
    ?view=chartThe live chart: pick a scale and a run, the weight over time with the alarms
    ?view=csv&device=…&run=…The CSV export of one run
    ?view=runsEvery scale and run as JSON
    ?view=data&device=…&run=…The points and alarms of one run as JSON
    ?view=setupThe setup check

What you get in the data folder

One folder per scale (its Device ID) and run - plain files you can copy, back up or read with any program:

FileWhat it is
runs/<Device ID>/<run id>/points.csvOne line per point - this is the CSV export:
number,epoch_s,time_utc,gross_g,net_g
runs/<Device ID>/<run id>/alarms.jsonlEvery alarm, of the scale and of your own limits, one JSON line each
runs/<Device ID>/<run id>/run.jsonName, state, interval, target, last point of the run
other/<type>-<YYYY-MM-DD>.jsonlEvents of other kinds as they came (for records use the general receiver of the IT examples)
receiver.logRefused requests and e-mail errors

Gross and net: gross is the weight against the zero of the run, net the weight as the display shows it - the two are the same until somebody tares during the run.

The run id is <run>-<epoch of its first point> (e.g. 7-1795852800) - the same from the scale and from the app, so both ways fill the same folder. A gap (the scale restarted) is a line with an empty weight.

The event format

Each event is one JSON POST with the type points or tracking. Both carry the state of the run (run, run_id, state, weight_g, start_g, last_point_g, mean_g, target_g, points, interval_s, unit).

Points

{"schema":"upscale.event/1",
 "id":"a1b2c3d4e5f6:points:7-1795852800:1795853640000+2",
 "type":"points","device":"a1b2c3d4e5f6","scale":"UP↑SCALE 710 #93682",
 "firmware":"1.01312","user":"","sent_at":"2026-11-28T08:15:02Z","src":"scale",
 "data":{"event":"point","run":7,"run_id":"7-1795852800","name":"",
  "state":"recording","time":"2026-11-28T08:15:02Z","weight_g":92.4,
  "start_g":100,"last_point_g":92.4,"mean_g":96.3,"target_g":75,
  "points":16,"interval_s":60,"unit":"g","net":false,
  "list":[[15,1795853640,93.1,93.1],[16,1795853700,92.4,92.4]]}}

Every entry of list is [number, epoch seconds, gross g, net g]; a weight null is a gap (a restart). The id stays the same when the scale sends a point again, and a point is known by run_id + its time - so doubles are easy to drop.

An alarm

{"schema":"upscale.event/1",
 "id":"a1b2c3d4e5f6:tracking:7-1795852800:alarm:target:412",
 "type":"tracking","device":"a1b2c3d4e5f6","scale":"UP↑SCALE 710 #93682",
 "firmware":"1.01312","user":"","sent_at":"2026-11-28T14:51:02Z","src":"scale",
 "data":{"event":"alarm","run":7,"run_id":"7-1795852800","name":"",
  "state":"recording","time":"2026-11-28T14:51:02Z","weight_g":74.9,
  "start_g":100,"last_point_g":74.9,"mean_g":86.1,"target_g":75,
  "points":412,"interval_s":60,"unit":"g","net":false,
  "alarm":"target","text":"target reached","alarm_point":412,
  "alarm_time":1795877460,"alarm_g":74.9}}

alarm is one of target, constant, jump, restart, peak, above, below, low, high, with alarm_point, alarm_time (epoch seconds) and alarm_g of the point that raised it. The other events of the type tracking are "event":"start" and "event":"stop".

The answer of the receiver

{"ack":"a1b2c3d4e5f6:tracking:7-1795852800:alarm:target:412","ref":"R-000123"}

The receiver answers with the id of the event and a receipt of its own. In the modes HMAC-signed and sealed envelope it signs or seals its answer, like the other receivers of the IT examples; the scale counts an event as delivered only with a correct answer.

Make it your own

The example keeps the runs in files, so it works on every host. For real use, change the storage to a database - SQLite, MySQL / MariaDB, PostgreSQL or InfluxDB with Grafana: many scales, long runs at short intervals and several people looking at once are faster and safer there. Only a few functions touch the files (the header of the example names them: run_meta(), run_save(), run_add_points(), run_alarm() and the views runs / data / csv). With a table like this, an INSERT OR IGNORE drops the doubled points by itself:

CREATE TABLE points (device TEXT, run_id TEXT, t INTEGER, n INTEGER,
  gross_g REAL, net_g REAL, PRIMARY KEY (device, run_id, t));
  • Other systems: the other example code for your IT - a general receiver in Python and Node.js, flows for Node-RED and n8n, and a bridge into the import folder or the REST API of your LIMS.
  • More than tracking: the webhook export also sends the live weight and, with ENTERPRISE, the records of the scale - see connectivity and LIMS / ELN and sensors.
  • Python instead of PHP: upscale-tracking-receiver.py is the twin of the example - the same folders and files, Python 3 standard library only (the sealed envelope needs the package cryptography). It runs as its own small server on port 8090, with your web server in front of it for https.

The example code is MIT licensed: copy it, change it and use it in your own projects.

Tracking on your own website: questions and answers

Can the scale send its tracking data to my own website without the app?

Yes. In your WiFi network the scale sends the start, the stop, every alarm and every point itself through its webhook export (PRO) - the app can be closed. The example receiver stores the points, shows a live chart, gives a CSV and sends e-mails at alarms.

Do I need a database?

Not for the example: it keeps every run as plain files (points.csv, alarms.jsonl, run.json) and runs on almost every PHP host. For many scales or long runs at short intervals, change the storage to SQLite, MySQL, PostgreSQL or InfluxDB - the example names the few functions to replace.

What happens when my server or the WiFi is down?

With the webhook export the scale keeps recording and sends the run again from its first point when the receiver answers again; the receiver drops the points it already has. With the app the newest point and the missing alarms are sent when the app connects again, not every point of the time in between.

Why does the app need https?

Browsers post from the app only to https addresses, and the receiver must allow the address of the app (https://up-scales.com) for cross-origin requests. The example does that. The scale itself can also post to a plain http address in your own network with HMAC-signed or the sealed envelope.

How do I get an e-mail when a run reaches its target?

Set the target of the run in the tracking mode, and UPSCALE_MAIL_TO (plus SMTP if your host needs it) in the example. Every alarm of the scale - target, constant weight, jump, peak, band, LOW / HIGH limits, restart - becomes an e-mail; your own limits and a silent scale can send one too.

Is there a Python version?

Yes: upscale-tracking-receiver.py in the same folder as the PHP file - the same file layout, Python 3 standard library only; the sealed envelope needs the package cryptography.

Also useful for you

The same app, for other work

Every function is in the same app - at home, in business and in the lab. All functions at a glance.

Last updated · by Johann Anderson, FARM 23 SL

READY TO UP↑SCALE YOUR SCALE?

Start with the free version - the board costs under 15 EUR and you may never need more. If you do, unlock PRO from 4.43 EUR a month, 46.90 EUR a year or once for 119.90 EUR incl. VAT - or ENTERPRISE & COMPLIANCE from 13.00 EUR a month (once: 599.00 EUR). The lifetime licences are once and forever, no subscription needed; no advertisements, everything works offline, updates stay free.