Hello, I'm trying to make Octoprint read the output of the M407 command,

Hello,

I’m trying to make Octoprint read the output of the M407 command, when I send it, this is the answer

Send: M407
Recv: Filament diameter (mm):1.72, volumetric multiplier (%):1.00
Recv: ok

Relevant part of config.yaml:

  • children:
    • command: M407
      name: Get width
      regex: Filament diameter (mm):([0-9.]+), volumetric multiplier (%):([0-9.]+)
      template: ‘Filament diameter (mm):{0}, volumetric multiplier (%):{1}’
      type: feedback_command
      name: Filament width sensor
      type: section

What is wrong? When clicking the button… nothing happens, but I see the command executed in terminal

I’m using Octopi 0.9.0

You’ll have to escape the percent symbol for starters :wink:

you need to escape the parentheses around the mm. Parentheses are valid regex syntax, your pattern is looking for a string “Filament diameter mm” with the mm being in the first group, so it will never match “Filament diameter (mm)”. Try “Filament diameter (mm)” instead. Same problem for the %.

@foosel , do you think it is possible to graph the filament width sensor reading across time like it is done with temperature? Can you point me to the most viable solution?

Write a plugin. http://docs.octoprint.org/en/devel/plugins/gettingstarted.html

I updated Octoprint to devel and now I’m running some plugins to see how they work. I read the docs but how do I trigger a M407 command every 5-10 seconds? I’m trying to adapt the navbar temperature plugin to show filament width but in my case I don’t have temperatureViewModel with all the needed information

@foosel , I’m stuck again :slight_smile:

Sorry, sick, can’t help at the moment. Take a look at the docs, the printer module plus the RepeatedTimer from the util module are what you want to take a closer look at.

Also I suggest posting such questions in the octoprint g+ community, there are also some plugin authors in there