Skip to content

Commit

Permalink
Event entity: Add automation triggered by button press (#34937)
Browse files Browse the repository at this point in the history
* Add button automation

* Move example from Matter page to event entity

* Move images to event integration

* Rephrase

* Add extra info on state

* Add pushbutton module as example

* Make it more obvious that fields need to be left empty

* Fix typo

* Matter page: link to tutorial

* Add step to add second option
  • Loading branch information
c0ffeeca7 committed Sep 27, 2024
1 parent 334b297 commit ae69855
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 0 deletions.
44 changes: 44 additions & 0 deletions source/_integrations/event.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,50 @@ action:
When creating automations in the automation editor in the UI, the event types are available as a dropdown list, depending on the event entity you are using. This means you don't have to remember the different event types and can easily select them.
## Automating on a button press
This section shows a similar example to the example automation shown above in YAML. It's an automation that is triggered by an event state change, but shows how to implement it in the UI. To start an automation triggered by a button press (or a button press pattern), follow these steps.
### Prerequisites
- You have a device that takes button presses as inputs, such as a Tuo Smart Button, VTM31SN dimmer by Inovelli, or the Matter Pushbutton Module by Innovation Matters
- The device has been added to Home Assistant
### To automate on a button press
1. If you like, give your button event entity a friendly name.
- Under {% my integrations title="**Settings** > **Devices & services**" %}, select the **Matter** integration card and select the device.
- On the **Events** card, select the button entity.
![Select the button entity](/images/integrations/event/matter_button_event_entity.png)
- Under **Name**, enter the new friendly name.
![Change the entity name](/images/integrations/event/matter_button_rename.png)
2. Go to {% my automations title="**Settings** > **Automations & scenes**" %} and select **Create Automation**.
![The automation editor.](/images/getting-started/automation-editor.png)
- Then, select **Create new automation**. This brings up an empty automation page.
![The start of a new automation.](/images/getting-started/new-automation.png)
3. Define what should {% term trigger %} the automation to run.
- Select **Add trigger**, then, select **Entity** > **State**.
- Type `event` and select your button entity.
- **Important**: Leave the other fields **empty**.
![Select button event as trigger](/images/integrations/event/matter_trigger_on_button_event.png)
4. Define the condition when something should happen.
- Under **Then do**, select **Add action**.
- Type `choose` and select **Add condition**.
- Select **Entity** > **State** and select your button event entity from the list.
- Under **Attribute**, select **Event type**.
- Under **State**, select the state change you want to act as trigger, for example **Pressed once**.
- **Pressed once** is the event type. But the state of this event is the timestamp of when the button was pressed. This is why we automate on the state change so that it is triggered every time the button is pressed.
![Condition - button pressed](/images/integrations/event/matter_condition_button_pressed.png)
5. Define what should happen when your automation is triggered (when the button is pressed, for example).
- Select **Add action** and define your action.
6. Repeat these steps for each event type you want to monitor.
- In this example, we want to do something else when the button was pressed twice.
![Condition - add another option when the button is pressed twice](/images/integrations/event/matter_button_option_2.png)
7. **Save** the automation.

## Device class

{% include integrations/device_class_intro.md %}
Expand Down
4 changes: 4 additions & 0 deletions source/_integrations/matter.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ The CSA operates a Distributed Compliance Ledger (DCL) which provides metadata f
Notification of an OTA update for a Matter device
</p>

## Automate on a button press

You have a device that takes button presses as inputs (such as a Tuo Smart Button, VTM31SN dimmer by Inovelli, or the Matter Pushbutton Module by Innovation) and now want to trigger an automation based on that button press. To learn how to create an automation triggered by a button press, refer to this [tutorial](/integrations/event/#automating-on-a-button-press).

## Experiment with Matter using a ESP32 dev board

You do not yet have any Matter-compatible hardware but you do like to try it out or maybe create your own DIY Matter device? We have [prepared a page for you](https://nabucasa.github.io/matter-example-apps/) where you can easily flash Matter firmware to a supported ESP32 development board. We recommend the M5 Stamp C3 device running the Lighting app.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 ae69855

Please sign in to comment.