Skip to content

Conversation

@joostlek
Copy link
Member

@joostlek joostlek commented Dec 2, 2025

Proposed change

Add documentation on triggers yaml

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features for which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Remove stale or deprecated documentation

Checklist

  • I have read and followed the documentation guidelines.
  • I have verified that my changes render correctly in the documentation.

Additional information

  • This PR fixes or closes issue: fixes #
  • Link to relevant existing code or pull request:

Comment on lines 33 to 37
_OPTIONS_SCHEMA = vol.Schema({
vol.Required("event_type"): cv.string,
vol.Required("behavior", default="any"): vol.In(
["first", "last", "any"]
),
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should adapt this trigger to be more realistic, I'd love for the example YAML to adhere to the example trigger, but from the example it wasn't clear what event_type: str was used for

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think we should have a single consistent example on this page. Lets update the class to represent a nicer trigger.


### Trigger schema

The frontend uses the `triggers.yaml` file to know the structure of the triggers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The frontend uses the `triggers.yaml` file to know the structure of the triggers.
Triggers should have their description in a `triggers.yaml` file. The description specifies the structure of the triggers and is used by the frontend, for example.

it is also used on core, in the get_triggers_for_target websocket api, not only for frontend.

The frontend uses the `triggers.yaml` file to know the structure of the triggers.
This file is similar to `services.yaml`.

For example, the following snippet shows a trigger that takes a target binary sensor with a specific device class and a select selector with a predefined set of options.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, the following snippet shows a trigger that takes a target binary sensor with a specific device class and a select selector with a predefined set of options.
The following snippet shows a trigger that takes a target binary sensor with a specific device class and a select selector with a predefined set of options.

if we update the example class above, I think we can simplify this sentence since it is part of the full example in the current top section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants