# Device Extension / BaseDevice

If you plan to write a device specific integration then this is the correct page for you

The **`sp.BaseDevice`** supports [events](/grid/extensions/events.md), [actions](/grid/extensions/actions.md) as well as all structures for the viewport.\
\- Receive commands and/or data within Grid.\
\- Send commands and/or data from Grid.\
\- Supports user data\
\- Supports child objects within the project tree\
\- Can be visualized within the viewport / 3D space

```python
import sp

class Device_Plugin(sp.BaseDevice):

    def __init__(self):
        sp.BaseDevice.__init__(self)

if __name__ == "__main__":
	sp.registerPlugin(Device_Plugin)
```

<figure><img src="/files/j9SSLIjA04vQIpUJPlFf" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/BF2Tqb43eAA4Tgl7PRdc" alt=""><figcaption></figcaption></figure>

## Main Class

The class name <mark style="color:orange;">**`Device_Plugin`**</mark> can be customized and also represent the name of your Plugin.

```python
class Device_Plugin(sp.BaseDevice):
```

While **`(`sp.BaseDevice`)`** can´t be renamed.&#x20;

## Initialization

Within your **Main Class** it´s necessary to define a function for the initialization:

```python
    def __init__(self):
        sp.BaseDevice.__init__(self)
```

## Register

To register the plugin you need the following lines of code outside of your **Main Class**:

```python
if __name__ == "__main__":
	sp.registerPlugin(Device_Plugin)
```


---

# Agent Instructions: 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:

```
GET https://stage-precision.gitbook.io/grid/extensions/extension-types/device-extension-basedevice.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
