Skip to content

Instantly share code, notes, and snippets.

@adampetrovic
Last active September 17, 2025 09:03
Show Gist options
  • Select an option

  • Save adampetrovic/448b276d591ee1c1a2ebd9e52119c9f8 to your computer and use it in GitHub Desktop.

Select an option

Save adampetrovic/448b276d591ee1c1a2ebd9e52119c9f8 to your computer and use it in GitHub Desktop.
Homebrew by Weight - La Marzocco Linea Micra

⚠️ Update 2025-09-15: La Marzocco API Access Changes

Hi everyone,

With the recent changes La Marzocco has made to their firmware and connectivity, the approach used in this integration is no longer feasible.

Specifically:

  • Local websocket access has been removed.
  • Third-party API integrations are now being actively blocked.

This means that many of the automations and workflows you’ve been able to build with this tool—and projects like it—are now broken or will stop working soon.

For years, the openness of La Marzocco machines allowed power users and hobbyists to create integrations that went beyond the official LM app:

  • Brew-by-weight workflows
  • Smart scale tareing and usage tracking
  • Flexible automations through platforms like Home Assistant

These contributions were the reason many of us became La Marzocco’s loudest advocates. We invested heavily in their machines because we could extend them, automate them, and share that passion with others.

Unfortunately, La Marzocco’s current direction is user-hostile: instead of supporting openness, they’re shutting it down.

A community petition has been launched to push back against this change: https://www.change.org/p/keep-la-marzoccothird-party-api-access-open

If you care about keeping these integrations alive, please sign and share. Numbers matter here, and showing La Marzocco that this isn’t just a handful of power users but a passionate community could make a real difference.

– Adam

This is my 'homebrew' version of the brew-by-weight functionality that comes with a Linea Mini plus the LaMarzocco + Acaia proprietary scales. Given I have a Micra, this functionality isn't supported out of the box.

It uses:

How it works:

  • input_number.coffee_target_weight: used to set the desired weight
  • input_number.coffee_drip_duration: used to estimate how long (in secs) the coffee continues to drip after the pump is stopped.
  1. Turn on the scales and wait for the connected symbol to show on the scales (next to the timer).
  2. Start the shot. Homeassistant will tare the scales automatically and start the timer on the scales.
  3. Once the shot timer reaches 10 seconds, the brew-by-weight automation should trigger
  4. The automation continues to monitor the current weight and flow rate from the scales, continually updating the coffee_estimated_drip_weight template sensor.
  5. Once the current weight reaches the threshold of (current_weight + coffee_estimated_drip_weight >= target_weight) it turns off the machine (only way to stop the pump) and turns it back on.

Adjust the input_number.coffee_drip_duration over time to get more accurate.

external_components:
- source:
type: git
url: https://github.com/adampetrovic/esphome-acaia-component
ref: log_flow
refresh: 0s
esphome:
name: coffee-controller
friendly_name: coffee-controller
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
logger:
level: DEBUG
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "Coffee-Controller"
password: "password"
bluetooth_proxy:
active: True
esp32_ble_tracker:
ble_client:
- mac_address: <mac address of your scales>
id: acaia_client
acaia:
ble_client_id: acaia_client
id: acaia_1
binary_sensor:
- platform: acaia
connected:
name: Acaia Connected
id: acaia_connected
sensor:
- platform: acaia
weight:
id: scale_sens
name: Scale weight
accuracy_decimals: 1
unit_of_measurement: g
filters:
- lambda: return x * 1000;
flow:
name: Scale flow
id: flow_sens
button:
- platform: template
name: Tare Scales
id: scale_tare
icon: "mdi:scale"
on_press:
- acaia.tare: acaia_1
- platform: template
name: Start Timer
id: start_timer
icon: "mdi:timer-outline"
on_press:
- acaia.start_timer: acaia_1
- platform: template
name: Stop Timer
id: stop_timer
icon: "mdi:timer-outline"
on_press:
- acaia.stop_timer: acaia_1
- platform: template
name: Reset Timer
id: reset_timer
icon: "mdi:timer-outline"
on_press:
- acaia.reset_timer: acaia_1
input_number:
coffee_target_weight:
name: Coffee Target Weight
unit_of_measurement: g
initial: 42
min: 10
max: 60
step: 1
coffee_drip_duration:
name: Coffee Drip Duration
unit_of_measurement: s
initial: 2.5
min: 0
max: 10
step: 0.1
sensor:
- platform: template
sensors:
coffee_estimated_drip_weight:
unique_id: coffee_estimated_drip_weight
friendly_name: Coffee Post-Shot Drip Weight
unit_of_measurement: "g"
availability_template: "{{ states('sensor.coffee_controller_scale_flow') | float > 0 }}"
value_template: >
{{ (states('input_number.coffee_drip_duration') | float * states('sensor.coffee_controller_scale_flow') | float) | round(2) }}
automation:
- id: start_shot_setup_scales
alias: "[Coffee] Setup scales on shot start"
mode: single
trigger:
- platform: state
entity_id: binary_sensor.micra_brewing_active
to: "on"
condition:
- "{{ is_state('binary_sensor.coffee_controller_acaia_connected', 'on') }}"
action:
- service: button.press
target:
entity_id: button.coffee_controller_reset_timer
- service: button.press
target:
entity_id: button.coffee_controller_start_timer
- service: button.press
target:
entity_id: button.coffee_controller_tare_scales
- id: stop_shot_setup_scales
alias: "[Coffee] Stop scales on target weight"
mode: single
trigger:
- platform: template
value_template: "{{ states('sensor.coffee_controller_scale_weight') | float >= states('input_number.coffee_target_weight') | float }}"
condition:
- "{{ states('sensor.micra_shot_timer') | float >= 10 }}"
action:
- service: button.press
target:
entity_id: button.coffee_controller_stop_timer
- id: brew_by_weight
alias: "[Coffee] Brew by Weight"
mode: single
trigger:
# make sure we're actually brewing a valid shot
- platform: template
value_template: "{{ states('sensor.micra_shot_timer') | float >= 10 }}"
condition:
- "{{ is_state('binary_sensor.coffee_controller_acaia_connected', 'on') }}"
action:
- wait_template: "{{ states('sensor.coffee_controller_scale_flow') | float > 0 }}"
timeout:
seconds: 5
continue_on_timeout: false
- repeat:
# stop when actual_weight >= target_weight - estimated_drip_weight
# estimated_drip_weight is calculated above
until: "{{ (states('sensor.coffee_controller_scale_weight') | float >= (states('input_number.coffee_target_weight') | float - states('sensor.coffee_estimated_drip_weight') | float))}}"
sequence:
- delay:
milliseconds: 100
- service: switch.turn_off
target:
entity_id: switch.coffee_machine
- delay:
seconds: 2
- service: switch.turn_on
target:
entity_id: switch.coffee_machine
@adampetrovic
Copy link
Author

adampetrovic commented Sep 15, 2025

⚠️ Update 2025-09-15: La Marzocco API Access Changes

Hi everyone,

With the recent changes La Marzocco has made to their firmware and connectivity, the approach used in this integration is no longer feasible.

Specifically:

  • Local websocket access has been removed.
  • Third-party API integrations are now being actively blocked. (See zweckj/pylamarzocco#109)

This means that many of the automations and workflows you’ve been able to build with this tool—and projects like it—are now broken or will stop working soon.

For years, the openness of La Marzocco machines allowed power users and hobbyists to create integrations that went beyond the official LM app:

  • Brew-by-weight workflows
  • Smart scale tareing and usage tracking
  • Flexible automations through platforms like Home Assistant

These contributions were the reason many of us became La Marzocco’s loudest advocates. We invested heavily in their machines because we could extend them, automate them, and share that passion with others.

Unfortunately, La Marzocco’s current direction is user-hostile: instead of supporting openness, they’re shutting it down.

A community petition has been launched to push back against this change: https://www.change.org/p/keep-la-marzoccothird-party-api-access-open

If you care about keeping these integrations alive, please sign and share. Numbers matter here, and showing La Marzocco that this isn’t just a handful of power users but a passionate community could make a real difference.

– Adam

@TiStef
Copy link

TiStef commented Sep 17, 2025

Since PYLAMARZOCCO has now been fixed, it is likely that also the HA version should start working again.
I am updating my version of BBW using the PYLAMARZOCCO and AIOACAIA and it should work no problem.
You will need a laptop running to utilize the BBW functionality on the Micra, but it works well.
Somebody here might have an idea on how to run the python script in a more smaller device maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment