Skip to content

Instantly share code, notes, and snippets.

@ayn
Last active April 10, 2025 16:01
Show Gist options
  • Save ayn/a8b9a344197ed235a4ac2719d2203340 to your computer and use it in GitHub Desktop.
Save ayn/a8b9a344197ed235a4ac2719d2203340 to your computer and use it in GitHub Desktop.
brew by weight automation (micra x lunar x homeasistant)
alias: Brew by Weight
description: ""
triggers:
- entity_id:
- sensor.lunar_xxxxx_weight
above: 5
trigger: numeric_state
conditions:
- condition: state
entity_id: binary_sensor.micra_mrXXXXXX_brewing_active
state: "on"
enabled: false
actions:
- wait_for_trigger:
- value_template: >-
{% set current_weight = states('sensor.lunar_xxxxx_weight') |
float(0) %} {% set flow_rate =
states('sensor.lunar_xxxxx_volume_flow_rate') | float(0) %} {% set
target_weight = states('input_number.coffee_target_weight') | float(0)
%} {% if states('sensor.lunar_xxxxx_volume_flow_rate') in ['unknown',
'unavailable', 'none'] or flow_rate <= 0 %}
false
{% else %}
{{ ((target_weight - current_weight) / flow_rate) < 1.3 }}
{% endif %}
trigger: template
- target:
entity_id: switch.micra_mrXXXXXX
action: switch.turn_off
data: {}
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- target:
entity_id: switch.micra_mrXXXXXX
action: switch.turn_on
data: {}
@ayn
Copy link
Author

ayn commented Apr 9, 2025

the brewing_active condition has been disabled as that sensor is unavailable since new LM app/gw firmware.

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