Device as returned by HomeyAPIV3Cloud.ManagerDevices.
Extends
Instance Properties
homey
homey: HomeyAPIV3id
id: stringType
- string
manager
manager: HomeyAPIV3.Managername
name: stringType
- string
note
note: stringType
- string
uri
uri: stringThe URI of the Item, e.g. homey:foo:bar
.
Type
- string
Instance Methods
connect
(async) connect()Connect to this item's Socket.io namespace.
disconnect
(async) disconnect()Discconnect from this item's Socket.io namespace.
getAdvancedFlows
(async) getAdvancedFlows(): Promise.<Object.<string, HomeyAPIV3.ManagerFlow.AdvancedFlow>>Returns
Promise.<Object.<string, HomeyAPIV3.ManagerFlow.AdvancedFlow>>
getDriver
(async) getDriver(): Promise.<HomeyAPIV3.ManagerDrivers.Driver>Get the device's driver.
Returns
Promise.<HomeyAPIV3.ManagerDrivers.Driver>
getFlows
(async) getFlows(): Promise.<Object.<string, HomeyAPIV3.ManagerFlow.Flow>>Get the device's flows.
Returns
Promise.<Object.<string, HomeyAPIV3.ManagerFlow.Flow>>
getLogs
(async) getLogs(): Promise.<Object.<string, HomeyAPIV3.ManagerInsights.Log>>Get the device's logs.
Returns
Promise.<Object.<string, HomeyAPIV3.ManagerInsights.Log>>
getZone
(async) getZone(): Promise.<HomeyAPIV3.ManagerZones.Zone>Get the device's zone.
Returns
Promise.<HomeyAPIV3.ManagerZones.Zone>
makeCapabilityInstance
makeCapabilityInstance(capabilityId, listener): HomeyAPIV3.ManagerDevices.Device.DeviceCapabilityCreates an HomeyAPIV3.DeviceCapability for realtime capability updates.
Parameters
Name | Type | Description |
---|---|---|
capabilityId
|
string | |
listener
|
function | |
value
|
number | boolean | string | |
|
Returns
Example
const onOffInstance = device.makeCapabilityInstance('onoff', value => {
console.log('Device onoff changed to:', value);
});
// Turn on
onOffInstance.setValue(true).catch(console.error);
setCapabilityValue
(async) setCapabilityValue(opts): Promise.<void>Sets a capability's value.
Parameters
Name | Type | Description |
---|---|---|
opts
|
object | |
capabilityId
|
string | |
value
|
number | boolean | string | |
opts
|
object
<optional> |
|
duration
|
number
<optional> |
|
|
||
|
Returns
Promise.<void>
Events
delete
.on('delete')update
.on('update')Parameters
Name | Type | Description |
---|---|---|
device
|
object |