---
title: "Devices"
description: "Managing devices and hardware interfaces using the Python API"
url: https://developer.disguise.one/python-api/guides/devices/
---

# Devices Python Samples

This guide demonstrates how to use the Disguise Python API to interact with devices and the Device Manager. Devices represent external hardware or software endpoints (e.g., DMX, OSC, MIDI, projectors, cameras) that can be controlled or monitored by Disguise. The [`DeviceManager`](/python-api/docs/devicemanager) (`state.devices`) is responsible for managing all device objects in the project.

## Device Manager Operations

| Task | Python |
| :-- | :-- |
| **Get the main Device Manager object** | `device_manager = state.devices`<br>Returns the singleton [`DeviceManager`](/python-api/docs/devicemanager) instance for the current project. |
| **Find all devices of a specific type (e.g., DmxDevice)** | `[d for d in device_manager.devices if isinstance(d, DmxDevice)]`<br>Returns a list of all devices of the specified type. |
| **Add a device to the Device Manager** | `device_manager.devices.append(device_object)`<br>Adds a [`Device`](/python-api/docs/device) object to the manager, making it active in the project. |
| **Remove a device from the Device Manager** | `device_manager.devices.remove(device_object)`<br>Removes a [`Device`](/python-api/docs/device) object from the manager. |
| **Get a device by description** | `my_device = next((d for d in device_manager.devices if d.description == "MyDevice"), None)`<br>Finds a device by its user-facing description. |
| **List all device description** | `[d.description for d in device_manager.devices]`<br>Returns a list of all device names. |

### List all active devices

```python
for device in device_manager.devices:
    # Process each device
    pass
```

Iterates through all currently active [`Device`](/python-api/docs/device) objects.

## Device Properties & Methods

(Assumes `device` is a [`Device`](/python-api/docs/device) object, e.g., from iterating `device_manager.devices`.)

| Task | Python |
| :-- | :-- |
| **Get the device’s type name** | `type(device).__username__`<br>Returns the user-visible name of the type of the device (e.g., “DmxDevice”, “OscDevice”). |
| **Get the device’s user-facing name** | `device.name` |
| **Get the device’s unique path** | `device.path`<br>Returns a [`Path`](/python-api/docs/path) object representing the device’s location in the project. |
| **Check if the device is enabled** | `device.enabled`<br>Returns `True` if the device is enabled/active. |
| **Enable or disable a device** | `device.enabled = True` or `device.enabled = False` |
| **Get a `DmxDevice`’s driver type (e.g., “ArtNet”)** | `device.driverType()`<br>Returns the DMX driver type as a string. Only for [`DmxDevice`](/python-api/docs/dmxdevice) objects. |

## OSC Device Example

(Assumes `osc_device` is an instance of [`OscDevice`](/python-api/docs/oscdevice).)

| Task | Python |
| :-- | :-- |
| **Set OSC input (receive) port** | `osc_device.receivePort = 8000` |
| **Set OSC output (send) port** | `osc_device.sendPort = 8001` |
| **Set OSC destination IP address** | `osc_device.sendIPAddress = "127.0.0.1"` |
| **Get OSC device’s current status** | `osc_device.status`<br>Returns the current connection/status string. |

## Additional Device Operations

| Task | Python |
| :-- | :-- |
| **Save changes to a device** | `device.save()`<br>Persists any modifications to disk. |
| **Reload a device from disk** | `device.reload()`<br>Reloads the device, discarding unsaved changes. |
| **Delete a device** | `device_manager.deleteDevice(device)`<br>Removes the device from the project and deletes its file. |
