🗀 DEVICES
C_DEVICES extends COMMON_COMPONENT
Component to manage/update devices, which are used to implement the underlying connectivity of OpenHaus.
- Schema
- Methods
- Classes
- class.adapter.js Represents a adapter instance
- class.device.js Represents a device instance
- class.interface.js Represents a interface instance
- class.interfaceStream.js Represents a interface stream instance
Name | Type | Required | Default value | Description |
---|---|---|---|---|
_id | String | ObjectId | MongoDB ObjectID convert to a String | |
name | String | x | Human friendly name that represents the device | |
interfaces | Array | x | Interfaces that OpenHaus can connect to, see class.interfaces.js | |
timestamps | Object | Timestamps, when something was done to the object e.g. created /updated |
||
timestamps.created | Number | Date.now() |
Unix timestamp, set when .add is called to Date.now() |
|
timestamps.updated | Number | null |
Unix timestamp, set to Date.now() when .update is called |
|
enabled | Boolean | true |
Indicates if the device should be handeld |
{
"_id":"603fe5d18791152879a9babc",
"name":"AV - Receiver",
"interfaces":[
{
"type":"ETHERNET",
"transport":"tcp",
"settings":{
"host":"172.16.0.121",
"port":60128
},
"_id":"603fe5d18791152879a9babd",
"adapter":[
"eiscp"
]
}
],
"timestamps":{
"created":1614800337353,
"updated":null
},
"enabled":true
}
data
{Object} Object structure as defined in schema.cb
{Function} Callback function, if absent, a promise is returned.
Add a new device to the database and creates a device instance
id
{String} Device id as defined in schema.cb
{Function} Callback function, if absent, a promise is returned.
Get a device from the
.items
array
id
{String} Device id as defined in schema.cb
{Function} Callback function, if absent, a promise is returned.
Removes a device from the database
id
{String} Device id as defined in schema.data
{Object} Properties to update on deviceid
object/instance.cb
{Function} Callback function, if absent, a promise is returned.
Updates a device object in database & device instance in
.items
array
obj
{Object} Key/value to look for devices.cb
{Function} Callback function, if absent, a promise is returned.
Find device with mathing key/values pair in the
.items
array
🗀 class.adapter.js
Implements a adapter instance
🗀 class.device.js
Represent a device instance
🗀 class.interface.js
Represent a device instance
🗀 class.interfaceStream.js
Represent a device instance