Skip to content

Commit

Permalink
Added API info and new settings option
Browse files Browse the repository at this point in the history
- Added information regarding API function built into plugin
- Updated information to match a new custom GCODE setting
- Updated settings image to match new setting
  • Loading branch information
thomst08 committed Feb 1, 2024
1 parent 9a5bfba commit 34b66e1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions _plugins/octolight.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,28 +97,44 @@ Curently, you can configure settings:
- **!! IMPORTANT !!** The Raspberry Pi can only control the **GPIO** pins (orange labels on the pinout image below)
![Raspberry Pi GPIO](/assets/img/plugins/octolight/rpi_gpio.png)

- `Inverted output`: If true, the output will be inverted
- `Inverted output`: If true, the output will be inverted.
- Usage: If you have a light, that is turned off when voltage is applied to the pin (wired in negative logic), you should turn on this option, so the light isn't on when you reboot your Raspberry Pi.

- `Light is a button`: If true, the output will be treated as a button press
- `Light is a button`: If true, the output will be treated as a button press.
- Usage: This function allows OctoLight to toggle the Raspberry Pi pin on and off with a small delay to allow for lights that require a button press to change states.

- `Button Press delay (ms)`: This sets a time out for how long a button press is, this is only used if `Light is a button` is enabled.
- Default value: 200
- Note: This value is in micro seconds.

- `Delay Light Off (mins)`: This sets a time out for when the light will automatically turn its self-off in an event
- `Delay Light Off (mins)`: This sets a time out for when the light will automatically turn its self-off in an event.
- Default value: 5
- Note: This value is in minutes
- Note: This value is in minutes.

- `Setup Printer Events`: This allows you to select what you would like the light to do on a printer event
- `Setup Printer Events`: This allows you to select what you would like the light to do on a printer event.
- There are multiple events, these can each be tweaked based on your desired preference.
- Default is set to 'Nothing'.
- Set the light to do nothing, turn on, turn off, or turn on then turn itself off after the delay time value
- Set the light to do nothing, turn on, turn off, or turn on then turn itself off after the delay time value.

- `Enable Custom GCODE Detection`: This must be enabled for GCODE to be read and toggle the light.
- If this option is disabled, then the custom GCODE bellow this option will not function.

- `Setup Custom GCODE`: This allows you to select what you would like the light to do when a set GCODE command is sent to the printer
- Default is 'OCTOLIGHT ON' and 'OCTOLIGHT OFF' for on and off respectively.
- These commands can be any command the user enters, these could be event commands for the printer (e.g.: M600) or custom commands.
- `Setup Custom GCODE`: This allows you to select what you would like the light to do when a set GCODE command is sent to the printer.
- Default is 'OCTOLIGHT ON', 'OCTOLIGHT OFF' and 'OCTOLIGHT DELAY OFF' for on, off and on with a delayed turn off respectively.
- These commands can be any command the user enters, these could be event commands for the printer (e.g.: M600) or custom commands.


## API
Base API URL: `GET http://YOUR_OCTOPRINT_SERVER/api/plugin/octolight?action=ACTION_NAME`

This API always returns updated light state in JSON: `{state: true}` <br />
Any API call will require a API key with the "Control" permission. Without this, you will receive a 403 error.

_(if the action parameter not given, the action toggle will be used by default)_
#### Actions
- **toggle** (default action): Toggle light switch on/off.
- **turnOn**: Turn on light.
- **turnOff**: Turn off light.
- **getState**: Get current light switch state.
- **delayOff**: Turn on light and setup timer to shutoff light after delay time, note, `&delay=VALUE` can be added to the URL to override the default time value.
- **delayOffStop**: Testing for shutting off timer and light.
Binary file modified assets/img/plugins/octolight/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 34b66e1

Please sign in to comment.