Skip to content

Instantly share code, notes, and snippets.

@bbbenji
Last active January 20, 2025 14:12
Show Gist options
  • Save bbbenji/8b38cfd891810fc4f4c4f5fd9d1e54df to your computer and use it in GitHub Desktop.
Save bbbenji/8b38cfd891810fc4f4c4f5fd9d1e54df to your computer and use it in GitHub Desktop.
Bambu Lab Automation Suite - Manage lights and notifications for Bambu Lab.
blueprint:
name: Bambu Lab X1C Automation Suite
description: >
Manage lights and notifications for Bambu Lab X1C with customizable trigger settings,
including an optional feature to turn on the chamber light when the chamber door is opened.
domain: automation
input:
# ===== Automation Options =====
automation_options_intro:
name: "----- Automation Options -----"
description: "Configure the triggers and behaviors for the automation."
default: ""
selector:
text: {} # Using 'text' selector as a placeholder.
enable_x1c_chamber_light_trigger:
name: Enable X1C Chamber Light Trigger
description: >
Toggle the automation trigger based on the X1C chamber light state.
default: true
selector:
boolean: {}
enable_print_finished_trigger:
name: Enable Print Finished Trigger
description: >
Toggle the automation trigger for print finished events.
default: true
selector:
boolean: {}
enable_error_sensor_trigger:
name: Enable Error Sensor Trigger
description: >
Toggle the automation trigger based on the X1C error sensor state.
default: true
selector:
boolean: {}
enable_chamber_door_trigger:
name: Enable Chamber Door Trigger
description: >
Toggle the automation trigger that turns on the chamber light when the chamber door is opened.
default: false
selector:
boolean: {}
print_finished_delay:
name: Print Finished Delay
description: >
Delay in minutes after print finished before executing the next action.
default: 0 # Default to no delay.
selector:
number:
min: 0
max: 60
unit_of_measurement: minutes
mode: slider
# ===== Settings =====
settings_intro:
name: "----- Settings -----"
description: "Specify the devices and sensors to be used in the automation."
default: ""
selector:
text: {} # Using 'text' selector as a placeholder.
external_light:
name: External Light
description: >
Light to be toggled by the X1C chamber light.
selector:
entity:
domain: light
x1c_chamber_light:
name: X1C Chamber Light
description: >
The X1C chamber light to monitor and control.
selector:
entity:
domain: light
chamber_door_sensor:
name: Chamber Door Sensor
description: >
Sensor to monitor the state of the chamber door.
selector:
entity:
domain: binary_sensor
bambu_lab_printer:
name: Bambu Lab Printer
description: >
The Bambu Lab printer to monitor for print finished events.
selector:
device:
integration: bambu_lab
error_sensor:
name: X1C Error Sensor
description: >
Sensor to monitor for X1C errors.
selector:
entity:
domain: binary_sensor
notification_device:
name: Notification Device
description: >
Device to send notifications to.
selector:
device:
integration: mobile_app
trigger:
- platform: state
entity_id: !input 'x1c_chamber_light'
from: "off"
to: "on"
- platform: state
entity_id: !input 'x1c_chamber_light'
from: "on"
to: "off"
- platform: device
device_id: !input 'bambu_lab_printer'
domain: bambu_lab
type: event_print_finished
- platform: state
entity_id: !input 'error_sensor'
to: "on"
- platform: state
entity_id: !input 'chamber_door_sensor'
from: "closed"
to: "open"
action:
- choose:
- conditions: "{{ enable_x1c_chamber_light_trigger }}"
sequence:
- choose:
- conditions: >
{{ trigger.entity_id == x1c_chamber_light and trigger.to_state.state == 'off' }}
sequence:
- service: light.turn_off
target:
entity_id: !input 'external_light'
- conditions: >
{{ trigger.entity_id == x1c_chamber_light and trigger.to_state.state == 'on' }}
sequence:
- service: light.turn_on
target:
entity_id: !input 'external_light'
- conditions: "{{ enable_print_finished_trigger }}"
sequence:
- delay:
minutes: "{{ print_finished_delay }}"
- service: light.turn_off
target:
entity_id: !input 'x1c_chamber_light'
- conditions: "{{ enable_error_sensor_trigger }}"
sequence:
- service: notify.mobile_app
data:
message: "X1C issue detected - ({{ state_attr(error_sensor, '1-Severity') }})"
title: "{{ state_attr(error_sensor, '1-Error') }}"
data:
actions:
- action: "URI"
title: "See possible solutions on Bambu Lab Wiki"
uri: "{{ state_attr(error_sensor, '1-Wiki') }}"
target:
device_id: !input 'notification_device'
- conditions: >
{{ enable_chamber_door_trigger and
trigger.entity_id == chamber_door_sensor and
trigger.to_state.state == 'open' }}
sequence:
- service: light.turn_on
target:
entity_id: !input 'x1c_chamber_light'
default: []
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment