Enclosure plugin displayed on main screen?


#1

Is there any way to put enclosure plugin info on the main screen rather than going off to another screen (selecting the plugin, selecting whichever relay (for example) you want to activate) and then returning back to the main screen ?
It would be nice if I could have a toggle button for the relay on the main screen sort of a label and then a button that is either red/green (for active) and white/clear for inactive.


#2

You can edit the ~/.octoprint/config.yaml to add buttons to the Control tab, for instance. Mine looks like this:

buttons

If you knew the GPIO pin number associated with the relay, that would make this easier.


#3

Thanks !!!! I will give that a try ... and yes, I do know all the GPIO pins used.


#4

For this, I used the Gcode System Commands plugin to create one OCTO-related command which corresponds to a shell script. In that shell script, you'd toggle the GPIO pin.


#5

This went way over my head :frowning:


#6

Okay, I have no idea which GPIO pin you're using so I'll assume 17 throughout. In theory, this should work:

  1. Install the Gcode Systems Commands plugin
  2. Restart OctoPrint
  3. Visit Settings -> Gcode Systems Commands
  4. Click on the [+] button
  5. Add OCTO 901 which runs something like ~/scripts/toggle17on.sh
  6. Remote into the Raspberry using ssh pi@octopi.local and raspberry as the default password
  7. Run touch ~/scripts/toggle17on.sh to create a script
  8. Run nano ~/scripts/toggle17on.sh to edit it

toggle17on.sh:

#!/bin/bash

echo "1" > /sys/class/gpio/gpio17/value
  1. Run echo 17 > /sys/class/gpio/export to tell the system that you want to set pin 17 as an output port
  2. Make a copy of your config.yaml with cp ~/.octoprint/config.yaml ~/scripts/config.yaml
  3. Run nano ~/.octoprint/config.yaml to edit the control section:
controls:
- children:
  - command: OCTO901
    name: OCTO901
    type: command
  name: Control Enclosure
  type: section

When editing a yaml file, tabs and indents are super-critical so be careful.

  1. Restart OctoPrint and visit the Control tab

#7

Thanks for the details ! I will give that a try although it will likely be next weekend before I can dive into this thing!

There is a big empty section in the 'control' screen that I can fill uo with all manner of 'stuff' :slight_smile: