# Drivers

Properties

* **string:** *id*

  This property is a constant value defined by the driver itself and contains it's own driver id. This should be manually assigned in code by the developer or token-negotiator. This, in no case, should ever change.
* **string:** *name*

  This property is a partially constant value that contains the friendly name for this driver. It should simply state what this driver is for.
* **string:** *developer*

  This property contains the developer's name.
* **string:** *description*

  The description for this driver
* **string:** *type*

  The type of driver that this is.

  Possible types:

  * Single: This driver (device) only reports on one single controller or capability
  * Multi: This driver (device) has multiple controllers and actions
* **string:** *location*

  This property is an add-on property assigned by HomeCore, the driver can, however should not in any case assign to this property.
* **Object:** *capabilities*

  An object of capabilities for this driver (device)

```javascript
// Sample capabilties object
{
    power: 0, // 0 = a binary on/off state
    speed: 1, // 1 = a set of integers
    temp: 2, // 2 = a possible range of integers
    time: 3, // 3 = arbitrary string
    plots: 4 // 4 = custom data type (requires a HomeCore datatype to be defined)
}
```

* **Array\[Controller]:** *controllers*

  An array of all the controllers for this device

```javascript
// Sample controller object
{
    name: "Power",
    type: "binary/powerOnOrOff", // powerOnOrOff is custom name, can be anything
    id: "power",
    location: this.location, // 'this' is the driver's location
    states: [true, false] // Binary only has two states
}

// 0, Binary
states: [true, false]

// 1, Set
states: [1,2,3]

// 2, Range
states: [-20,300]

// 3, String
states: [""]
states: ["sampleStringState1", "sampleStringState2"]
states: ["{\"name\": \"Sample JSON State #1\"}"]

// 4, Custom
states: [
    {
        // State #1
    }, 
    {
        // State #2
    }
]
```

```javascript
// Sample controllers array
[
    {
        name: "Power",
        type: "binary/powerOnOrOff",
        id: "power",
        location: this.location,
        states: [true, false]
    },
    {
        name: "Fan Speed",
        type: "set/speeds",
        id: "speed",
        location: this.location,
        states: [1, 2, 3]
    }
]
```

* **function:** *onPublish*

  This property is a constant value defined by the driver itself and contains it's own driver id. This should be manually assigned in code by the developer or token-negotiator. This, in no case, should ever change.
* **function:** *init*

  This property is a constant value defined by the driver itself and contains it's own driver id. This should be manually assigned in code by the developer or token-negotiator. This, in no case, should ever change.
* **function:** *getState*

  This property is a constant value defined by the driver itself and contains it's own driver id. This should be manually assigned in code by the developer or token-negotiator. This, in no case, should ever change.
* **function:** *updateState*

  This property is a constant value defined by the driver itself and contains it's own driver id. This should be manually assigned in code by the developer or token-negotiator. This, in no case, should ever change.
* **function:** *setInternalState*

  This property is a constant value defined by the driver itself and contains it's own driver id. This should be manually assigned in code by the developer or token-negotiator. This, in no case, should ever change.
* **function:** *disconnect*

  This property is a constant value defined by the driver itself and contains it's own driver id. This should be manually assigned in code by the developer or token-negotiator. This, in no case, should ever change.


---

# 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://docs.microart.app/apis/homecore/drivers.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.
