sedgett / OctoPrint_IFTTTmaker

Octoprint plugin for the IFTTT Maker channel.
13 stars 6 forks source link

Events with Multiple Octopi printers #16

Open ioTataryn opened 5 years ago

ioTataryn commented 5 years ago

Hello, it would be useful to have customizable event names, so that multiple printers can be used.

Currently printer 1's event will fire and turn off printer 2.

Editable event names would fix this. can you do this?

jbeardon commented 5 years ago

I'd like to +1 that suggestion, possibly replacing the 'op' at the beginning of the event name with an editable string or set of drop down values such as P1, P2, P3 etc?

Good work on the plugin. It's certainly the easiest way to get Octoprint and IFTTT up and running without involving multiple services. Having the ability to determine which printer is generating an event would be a welcome addition.

All the best. JB

hookemmike commented 5 years ago

Bump, I have 2 printers running OctoPrint and would like to know which one notified me if I have them both running at the same time.

jbeardon commented 5 years ago

I've worked around this using an example on the Octoprint event cookbook: in the 'Push notifications for Android / iOS via IFTTT' section.

You need to have the Yamlpatcher plugin installed and enabled. This is the code to be added via the YamlPatcher:

events:
  enabled: True
  subscriptions:
  - event: PrintDone
    command: curl -s
      -F "value1={name}"
      https://maker.ifttt.com/trigger/printername_print_done/with/key/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    type: system

Obviously change the printername bit on each of your octoprint instances to reference your printer. For your example p1_print_done, then look for that in IFTTT. The xxxxxxxx bit is your IFTTT webhook key.

Works a treat and within a few seconds of the print finishing.

hookemmike commented 5 years ago

thank you, I am trying this code with my key but I keep getting this error:

What you entered is neither a valid Yamlpatcher patch string nor valid YAML. If you were trying to enter a Yamlpatcher patch string, make sure you copy-pasted it correctly and maybe take another look at the patch format. If you were trying to enter YAML yourself, make absolutely sure that your indentation is uniform and only uses spaces, and maybe take another look at the YAML Primer.

jbeardon commented 5 years ago

Sorry @hookemmike I had not inserted the code as 'code' - schoolboy error for a first time Github poster! The editor had messed with it. Try again from the updated post

hookemmike commented 5 years ago

thank you thank you thank you, this is EXACTLY what I was looking for, took me a bit to figure out what to put in the event portion of IFTTT and I made a separate hook for paused, canceled, and failed. I really only wanted done and paused so when the filament runs out on the one in my garage I am notified. I appreciate your help.

jbeardon commented 5 years ago

@hookemmike Glad to be of help.