Hi, I used the code WLED Bambulab from (WLED lights for your Bambu Labs 3d printer) to control my ESPHome here. Switching on and off via the Champerlamb also works. However, the sub-conditions do not work, such as switching to red when an error occurs.
Can anyone help me what’s wrong with my code. I have connected an RGBW ESP home controller.
blueprint:
name: Bambu Lab RGBW LED Controller
description: Control one or more RGBW LED strips with Bambu 3D printer
domain: automation
input:
printer_status:
name: Print Status of your Bambu Lab printer
description: Select the print status entity.
selector:
entity:
filter:
- domain:
- sensor
integration: bambu_lab
multiple: false
printer_stage:
name: Current Stage of your Bambu Lab Printer
description: Select the printer current stage entity.
selector:
entity:
filter:
- domain:
- sensor
integration: bambu_lab
multiple: false
chamber_light:
name: Chamber Light of your Bambu Lab Printer
description: Select the printer chamber light entity.
selector:
entity:
filter:
- domain:
- light
integration: bambu_lab
multiple: false
rgbw_lights:
name: RGBW LED Light devices
description: Select the RGBW LED light devices you wish to control.
selector:
device:
multiple: true
source_url: https://gist.github.com/dreed47/b33a76472cc813f7bf48a63c3dde7dce
alias: Bambu Lab RGBW LED Controller
description: ''
trigger:
- platform: state
entity_id:
- !input chamber_light
- !input printer_status
- !input printer_stage
alias: When printer stage, status, or chamber light state changes
condition: []
action:
- if:
- condition: state
state: 'on'
alias: chamber light is on
entity_id: !input chamber_light
- condition: not
conditions:
- condition: state
entity_id: !input printer_stage
state: Scanning Bed Surface
alias: Scanning Bed Surface
- condition: state
entity_id: !input printer_stage
state: Cleaning Nozzle Tip
alias: Cleaning Nozzle Tip
- condition: state
entity_id: !input printer_stage
state: Calibrating Extrusion
alias: Calibrating Extrusion
- condition: state
entity_id: !input printer_status
state: Offline
alias: Printer is off
alias: And Lidar is NOT on
then:
- service: light.turn_on
data:
rgbw_color:
red: 255
green: 255
blue: 255
white: 255
brightness: 100
alias: Turn RGBW LED light on white
target:
device_id: !input rgbw_lights
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input printer_stage
state: Paused due to filament runout
- condition: state
entity_id: !input printer_stage
state: Pause of front cover falling
- condition: state
entity_id: !input printer_stage
state: Paused due to nozzle temperature malfunction
- condition: state
entity_id: !input printer_stage
state: Paused due to heat bed temperature malfunction
sequence:
- service: light.turn_on
data:
rgbw_color:
red: 255
green: 0
blue: 0
white: 0
brightness: 255
target:
device_id: !input rgbw_lights
alias: Turn on RGBW to red
alias: Do we need to set color to red?
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input printer_stage
state: Idle
- condition: state
entity_id: !input printer_status
state: Finish
- condition: state
entity_id: !input printer_status
state: Offline
sequence:
- service: light.turn_on
data:
rgbw_color:
red: 0
green: 255
blue: 0
white: 0
brightness: 255
target:
device_id: !input rgbw_lights
alias: Turn on RGBW to green
alias: Do we need to set color to green?
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input printer_stage
state: Auto Bed Leveling
sequence:
- service: light.turn_on
data:
rgbw_color:
red: 0
green: 0
blue: 255
white: 0
brightness: 255
target:
device_id: !input rgbw_lights
alias: Turn on RGBW to blue
alias: Do we need to set color to blue?
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: !input printer_stage
state: Heatbed Preheating
- condition: state
entity_id: !input printer_stage
state: Heating Hotend
sequence:
- service: light.turn_on
data:
rgbw_color:
red: 255
green: 169
blue: 0
white: 255
brightness: 255
target:
device_id: !input rgbw_lights
alias: Turn on RGBW to yellow
alias: Do we need to set color to yellow?
else:
- service: light.turn_off
data: {}
target:
device_id: !input rgbw_lights
alias: Turn RGBW LED light off
mode: single