Code Monkey home page Code Monkey logo

Comments (7)

LuxuSam avatar LuxuSam commented on August 28, 2024

Hi, thank you very much :)

I like the idea to have action of other plugins included in my plugin! I'll have a look at if and how this can be achieved!

Cheers,
Sam

from physicalbutton.

LuxuSam avatar LuxuSam commented on August 28, 2024

I'm sorry but I cannot find out how to get the available commands from other plugins 😅
If someone knows how to achieve this, I would be happy to get a hint on that or a PR :)

from physicalbutton.

electronicm avatar electronicm commented on August 28, 2024

I'll see if there is any information on the weekend.

from physicalbutton.

OllisGit avatar OllisGit commented on August 28, 2024

Hi @LuxuSam,
if the plugin author doesn't provide a public api (web or internal) to execute tasks or read data you can directly get the plugin implementation and call the function directly...but this is a risky thing.

I wrote a helper function in my PrintJobHistory-Plugin that delivers the 3rd party plugin instance. On that instance you can call the needed function.
See https://github.com/OllisGit/OctoPrint-PrintJobHistory/blob/1.16.0/octoprint_PrintJobHistory/__init__.py#L291-L332

Usage:

pluginInfo = self._getPluginInformation({ "key": "costestimation", "minVersion": "3.4.0"})
self._costEstimationPluginImplementationState = pluginInfo[0]
self._costEstimationPluginImplementation = pluginInfo[1]

..do some state checks (installed/disabled)

self._costEstimationPluginImplementation.getCostData()

If the 3rd party plugin is willing to provide an api, it should use the "helpers-feature"
https://docs.octoprint.org/en/master/plugins/helpers.html#helpers

Or depending of the "usecase" it could fire an custom-event and a listener-plugin can react in "realtime" instead of polling the information from the plugin.
See
https://github.com/OllisGit/OctoPrint-DisplayLayerProgress#events

from physicalbutton.

LuxuSam avatar LuxuSam commented on August 28, 2024

Hi @OllisGit,

Thank you for the clarification, provided documentation, and your code examples :D

I'll look into it in more detail as soon as I'll have time to work on the plugin again! Exams are coming up.

from physicalbutton.

jneilliii avatar jneilliii commented on August 28, 2024

For the original request, PSU Control supports CLI commands so you could use system and the command /home/pi/oprint/bin/octoprint plugins psucontrol:toggle I think.

https://github.com/kantlivelong/OctoPrint-PSUControl/wiki/CLI

from physicalbutton.

kantlivelong avatar kantlivelong commented on August 28, 2024

There are helper functions available.

https://github.com/kantlivelong/OctoPrint-PSUControl/wiki/Developers

from physicalbutton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.