# Device Event

Trigger `cable.connector`

trigger.device_event

Fires when USB devices, displays, or audio devices connect or disconnect. This trigger monitors hardware changes on your Mac, letting you automate responses to peripheral events.

For USB events, you can optionally filter by device name substring to target specific devices. The trigger provides device details including name, vendor ID, product ID, display count, and audio device information depending on the event type.

## Ports

Direction | Name | Data Type | Description
--- | --- | --- | ---
Outlet | Output | Any | Payload emitted when a device event occurs

## Configuration

Field | Type | Default | Description
--- | --- | --- | ---
Event | `Dropdown` | USB Connected | Device event type: USB Connected, USB Disconnected, Display Connected, Display Disconnected, or Audio Device Changed
Device Name Filter | `Text` | — | Optional filter by device name substring Visible when Event is USB Connected or USB Disconnected
Custom Arguments | `Key-Value` | — | Additional key-value pairs included in the output payload

## Output Variables

Variable | Type | Description
--- | --- | ---
`event` | String | Event type that fired
`deviceName` | String | Name of the device (USB events)
`vendorID` | String | USB vendor ID
`productID` | String | USB product ID
`displayCount` | Number | Number of active displays (display events)
`deviceCount` | Number | Number of audio devices (audio events)
`defaultOutputDevice` | String | Default audio output device name
`timestamp` | String | ISO 8601 timestamp

## Example

Run a backup script when an external drive is connected: