#Door switch macro

5 messages · Page 1 of 1 (latest)

strong ivy
#

[gcode_button porta] pin: ^!PG14 press_gcode: {% if "xyz" not in printer.toolhead.homed_axes %} ACENDER_LUZES {% endif %} SET_PIN PIN=caselight VALUE=1.00 {% if printer["gcode_macro status_part_ready"] != null %} status_ready {% endif %}
I'm trying to make a macro that when the printer is homed and has the status_part_ready macro, it turns on the light and changes to status_ready

but it seems like it is ignoring the part of {% if printer["gcode_macro status_part_ready"] != null %} ready_status {% endif %}
Can someone help me?

fresh cragBOT
#

Ahoi @strong ivy!
It looks like you did not provide all the necessary information we need to help you.
Please upload your logfiles and a detailed description of your problem.
For further information see: https://docs.mainsail.xyz/faq/getting-help/discord#provide-information
Note: We only accept .log and .txt files as log files.
This is an automated message

alpine lodge
#

I am not sure what you believe printer["gcode_macro status_part_ready"] != null should do. A macro is not like a function cal in other programming languages that would have an return value.

#

You program klipper jinja here so what could work

variable_ready = False
gcode:
  ...
  SET_GCODE_VARIABLE MACRO=STATUS_PART_READY VARIABLE=ready VALUE=True
  ...```
and than check
```printer["gcode_macro STATUS_PART_READY"].ready == True```
#

as a side not for best practice: