Brew by Weight: Target Weight Webhook

Brew by Weight: Target Weight Webhook

February 9, 2026·
Beanstats

A common requests from espresso enthusiasts using Beanstats with a connected scale has been “brew by weight”, the ability to automatically stop the pump when the shot reaches a target yield. With the new Target Weight Reached webhook event. This is now possible, even if your espresso machine doesn’t support it, with Beanstats and a smart plug.

The Problem

When pulling an espresso shot, hitting a precise yield weight is crucial for consistency. A recipe that calls for 36g out of 18g in needs to land close to that 36g target every time. Manually watching the scale and cutting the pump introduces human error and inconsistency.

How It Works

The new workflow is straightforward:

  1. Set your target — In the espresso brew form, a new “Webhook Target” field appears in the Yield section. Enter your desired output weight (e.g., 36g).

  2. Brew normally — Start your shot with the connected scale. Beanstats monitors weight at 10Hz as usual.

  3. Webhook fires early — When the extracted weight reaches your target minus a configurable drip-through offset, Beanstats sends a webhook to your configured endpoints. The default offset is 2.0g, accounting for liquid still in transit from the group head. You might need to adjust the offset based on your machine and network.

  4. Automation takes over — Your Home Assistant, n8n, or other automation platform receives the webhook and can trigger any action: toggle a smart plug, send a signal to your machine, flash a light, play a sound, or anything else.

Drip-Through Offset

Every espresso setup has some amount of liquid in transit between the group head and the cup when the pump stops. The drip-through offset (configurable in Webhook Settings) compensates for this:

  • Default: 2.0g — Works well for most setups
  • Increase if your shots consistently run over target
  • Decrease if they consistently run under

Webhook Payload

The event sends all the data your automation might need:

{
  "event": "target_weight_reached",
  "timestamp": "2026-02-09T08:30:00Z",
  "data": {
    "currentWeight": 34.2,
    "targetWeight": 36.0,
    "offsetGrams": 2.0,
    "elapsedSeconds": 25.3,
    "flowRate": 1.8
  }
}

Fields like elapsedSeconds and flowRate are included so you can build more sophisticated automations — for example, logging shot data to a spreadsheet or dashboard alongside the pump-stop event.

Setting It Up

Prerequisites

  • Beanstats Premium subscription
  • A connected Bluetooth scale
  • At least one webhook endpoint with the “Target Weight Reached” event enabled

Configuration

  1. Go to Settings > Webhooks
  2. Add or edit an endpoint and enable the Target Weight Reached event (it’s opt-in, not enabled by default)
  3. Adjust the Drip-Through Offset in the Settings section if needed
  4. When creating an espresso brew, enter your target weight in the Webhook Target field
The Webhook Target field only appears for espresso brews when you have Premium and at least one endpoint with the Target Weight Reached event enabled.

Home Assistant Example

A basic Home Assistant automation to turn off a smart plug when the target weight is reached:

automation:
  - alias: "Stop Espresso Pump"
    trigger:
      - platform: webhook
        webhook_id: beanstats_target_weight
        allowed_methods:
          - POST
    condition:
      - condition: template
        value_template: "{{ trigger.json.event == 'target_weight_reached' }}"
    action:
      - service: switch.turn_off
        target:
          entity_id: switch.espresso_machine_pump

One-Shot Design

The webhook fires exactly once per brew when the threshold is crossed. There’s no risk of repeated triggers if the weight fluctuates around the target. The event resets when you start a new brew session.

What’s Next

This is a first step toward full brew-by-weight automation. We’re looking at ways to make the experience even smoother in future updates. If you’re using this feature with an interesting automation setup, we’d love to hear about it.

Happy brewing!