Device

Extends

Classes

Instance Properties

homey

homey: HomeyAPIV3

The Homey of the Item.

Type

id

id: string

The ID of the Item.

Type

  • string

manager

manager: HomeyAPIV3.Manager

The Manager of the Item.

Type

uri

uri: string

The 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

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

makeCapabilityInstance

makeCapabilityInstance(capabilityId, listener): HomeyAPIV3.ManagerDevices.Device.DeviceCapability

Creates 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>