> For the complete documentation index, see [llms.txt](https://cp2004.gitbook.io/ws281x-led-status/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cp2004.gitbook.io/ws281x-led-status/configuration/custom-triggers.md).

# Custom Triggers

{% hint style="info" %}
This feature took more effort than most to develop, if you've enjoyed using it please consider [supporting development of the plugin.](https://github.com/sponsors/cp2004)
{% endhint %}

## Custom @ commands

The simplest custom trigger, a custom @ command. All commands are prefixed as such:`@WS custom <command>` to make sure they do not conflict with others.

You can define your own custom effect to run when this @ command is received.

## Custom Events

You can setup the plugin to react to **any** event you choose for it. For a list of OctoPrint's events, please [see it's documentation](https://docs.octoprint.org/en/master/events/index.html). 3rd party plugins will add their own events, which should appear in the list to select them.

Like above, you can then add a custom effect that will be triggered whenever this event is received.

## Custom Gcode Effects

There's 3 types of triggers here, that you can use.

### Gcode Match

Match **just** the G or M code. For example, if you enter `G28`, the plugin will match `G28 X Y`, or `G28 Z` as well. Or if you enter `G29` it will match `G29 T` as well.

### Exact Match

This will match the entire line sent to the printer. If you just want an effect when homing Z, you could enter `G28 Z` here. The whole line needs to be exactly the same for this effect to trigger.

### Regex Match

Here you can enter a valid regex to run against the lines received from the printer. For example, `G[0-9]+` would match **any** G command sent to the printer. You could use `M50[0-3]` to match any of the EEPROM management commands, M500, M501, M502 or M503.

{% hint style="warning" %}
**Performance Warning**

Adding many regex matches here could (more likely **will**) slow down the communication to the printer. Running a list of regexes against every line sent to the printer is not impact free. If you notice slowdowns, remove the entries here.
{% endhint %}

![Screenshot of the settings page](/files/CyKrRAc2UAYwgC1RQVj4)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cp2004.gitbook.io/ws281x-led-status/configuration/custom-triggers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
