Salandora / octoprint-customControl

This plugin makes Custom Controls editable through the OctoPrint WebUI
GNU Affero General Public License v3.0
26 stars 15 forks source link

how to work output command #25

Open whitedavil opened 5 years ago

whitedavil commented 5 years ago

Good morning at all.

Thanks for your plug-in, it work very nice, but I have a small question:

How to work the output command?

I try to add button "get position" with regex and template sintax, add an output command but not work. How to combine the request "get position" button to "output window"?

thanks for all and sorry for my bad english.

surdu commented 5 years ago

There is a bug in the plugin. According to the docs, in the config.yml file that this plugin generates, the following content

regex: X:(.*?) Y:(.*?) Z:(.*?)
template: X={0}, Y={1}, Z={2}

should look like this:

regex: "X:(.*?) Y:(.*?) Z:(.*?)"
template: "X={0}, Y={1}, Z={2}"

(add quotes around the values).

If @Salandora is willing to merge my PR, I'm volunteering to try and fix this issue

Salandora commented 5 years ago

Interesting, never had a problem with the missing quotes. Also they shouldn't make a difference I think. Also @whitedavil can you show what you did like screenshots? Also have you restarted the octoprint server after adding the commands?

surdu commented 5 years ago

If the quotes aren't the problem, then I don't know what the problem is 😞 . I just noticed there is a difference, and I can't actually test if the quotes are the fix, because after I restart the OctoPi server, the changes that I do manually to that file are reverted.

rufik commented 3 years ago

I have a problem with output as well. Octoprint 1.4.2, plugin version 0.2.2. I'd like to make a very simple command: just get flow rate from printer (M221 output). So here it is definition: image It results in following entry in config.yaml:

controls:
-   children:
    -   command: M221
        confirm: null
        default: Click button to get value.
        name: Show flowrate
        regex: '(.*)(Flow: )(.+)'
        template: 'Captured groups: {1} - {2} - {3}'
    layout: vertical
    name: Custom

Output of M221 is (following octoprint terminal):

Send: M221
Recv: echo:E0 Flow: 120%
Recv: ok

My regex has been tested and seems working well: image

But there is no result of clicking my "Show flowrate" button :/ How can I debug it, is it possible at all?

Googliola commented 1 year ago

Just for future reference: the plugin seems to use single quotes where it should use no quotes at all. Editing that part in config.yaml did the trick for me.

controls: