jschuh / klipper-macros

A collection of useful macros for the Klipper 3D printer firmware
GNU General Public License v3.0
972 stars 172 forks source link

Support/Feature Request: M600 with Telegram bot message #32

Closed klaas1979 closed 1 year ago

klaas1979 commented 1 year ago

Hi,

I am trying to add a message to the Telegram Bot when a Filament Change is triggered. Basically I would need something like this to work:

# Overwrite the M600 in jshuh klipper-macros to add telegram message to Filament Change
[gcode_macro m600]
rename_existing: M600.284564
gcode:
  RESPOND PREFIX=tgalarm MSG=Print paused for Filament change!
  M600.284564

I added this after the import of the klipper-macros in my printer.cfg. But I throws an error because M600 is not defined. Sadly I could not find my answers in the klipper manual.

Is there any way to extend the M600 macro (or all macros) to send messages via respond to telegram bot? Any directions are highly appreciated. If not it would be great to have some configuration option to send messages on some g-codes for user interaction.

Best Klaas

jschuh commented 1 year ago

Klipper can be a bit quirky with case sensitivity when performing name lookups in these sorts of declarations (sometimes I have to read the code in configfile.py to understand what it's doing).

In this case it worked when I changed the first line of your macro by capitalizing the command in the section declaration like so: [gcode_macro M600]

klaas1979 commented 1 year ago

thank you very much, I will read the configfile.py and try it out!