Device as returned by HomeyAPIV2.ManagerDevices.
Extends
Instance Properties
available
available: booleanType
- boolean
capabilities
capabilities: arrayType
- array
capabilitiesObj
capabilitiesObj: objectType
- object
capabilitiesOptions
capabilitiesOptions: objectType
- object
class
class: stringType
- string
color
color: stringType
- string
data
data: objectType
- object
driverId
driverId: stringType
- string
driverUri
driverUri: stringType
- string
energy
energy: objectType
- object
energyObj
energyObj: objectType
- object
flags
flags: arrayType
- array
homey
homey: HomeyAPIV3icon
icon: stringType
- string
iconObj
iconObj: objectType
- object
iconOverride
iconOverride: string|nullType
- string | null
id
id: stringType
- string
images
images: arrayType
- array
insights
insights: arrayType
- array
manager
manager: HomeyAPIV3.Managername
name: stringType
- string
note
note: stringType
- string
ready
ready: booleanType
- boolean
repair
repair: booleanType
- boolean
settings
settings: objectType
- object
settingsObj
settingsObj: booleanType
- boolean
ui
ui: objectType
- object
uiIndicator
uiIndicator: string|nullType
- string | null
unpair
unpair: booleanType
- boolean
uri
uri: stringThe URI of the Item, e.g. homey:foo:bar
.
Type
- string
virtualClass
virtualClass: string|nullType
- string | null
zone
zone: stringType
- 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 |