Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow single dot to return entire payload value #29

Merged
merged 6 commits into from
Oct 19, 2021
Merged

Allow single dot to return entire payload value #29

merged 6 commits into from
Oct 19, 2021

Conversation

derekantrican
Copy link
Contributor

Allow "." to return the entire payload. This is useful for plugins like https://github.com/derekantrican/OctoPrint-ngrok that don't send a json/dict event payload and instead just send a single argument

@derekantrican
Copy link
Contributor Author

@tjjfvi understandably probably a low use-case, but could this be merged?

@tjjfvi
Copy link
Owner

tjjfvi commented Oct 6, 2021

@derekantrican Could you test this locally? From a brief look, there's a syntax error on lines 50 and 52; conditionals need to end with a :.

Sorry for the very belated response; I must've missed the notification before.

@derekantrican
Copy link
Contributor Author

Thanks for the callout! I think I pushed the appropriate changes (as you can probably tell - I'm not super familiar with Python, just enough to get around).

I'll look into testing it locally tomorrow. I'm fairly unfamiliar with Python & Raspberry Pi, but I'll give it a shot. I found https://docs.octoprint.org/en/master/development/index.html last night so that may help

@tjjfvi
Copy link
Owner

tjjfvi commented Oct 6, 2021

(as you can probably tell - I'm not super familiar with Python, just enough to get around).

Same here, to be honest :)

I'll look into testing it locally tomorrow. I'm fairly unfamiliar with Python & Raspberry Pi, but I'll give it a shot. I found https://docs.octoprint.org/en/master/development/index.html last night so that may help

It's been a while since I've touched octoprint plugins, so I don't fully recall what the process was, and I don't know how it might've changed in the last 2 years. That said, I'm pretty sure that link is for working on octoprint itself, not plugins. Based on my recollection and the plugin tutorial, it seems like you can clone the git repo into ~/.octoprint/plugins/the-plugin-name and run octoprint dev plugin:install inside that directory.

@derekantrican
Copy link
Contributor Author

Ok, I was able to test this. With the code as-is, the payload sent to the IFTTT webhook is:

{'value1': {'tunnel': 'b6ab-2601-600-9b80-8dc0-d113-5b0e-40f9-e16b.ngrok.io'}, 'value2': '', 'value3': ''}

And an IFTTT action of the following:
image

Gives:
image

@tjjfvi tjjfvi merged commit 5158051 into tjjfvi:master Oct 19, 2021
@tjjfvi
Copy link
Owner

tjjfvi commented Oct 19, 2021

Should be released in v1.4.0, though I'm not sure I remembered how to publish a version correctly, so let me know if it doesn't show up (though make sure to clear the plugin cache first).

@derekantrican
Copy link
Contributor Author

Yup! Got the notification that 1.4.0 is available! I'm going to skip it though because I still have the changes locally for #40 and am going to hold on to those until it's merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants