Device

Device as returned by HomeyAPIV2.ManagerDevices.

Extends

Instance Properties

available

available: boolean

Type

  • boolean

capabilities

capabilities: array

Type

  • array

capabilitiesObj

capabilitiesObj: object

Type

  • object

capabilitiesOptions

capabilitiesOptions: object

Type

  • object

class

class: string

Type

  • string

color

color: string

Type

  • string

data

data: object

Type

  • object

driverId

driverId: string

Type

  • string

driverUri

driverUri: string

Type

  • string

energy

energy: object

Type

  • object

energyObj

energyObj: object

Type

  • object

flags

flags: array

Type

  • array

homey

homey: HomeyAPIV3

The Homey of the Item.

Type

icon

icon: string

Type

  • string

iconObj

iconObj: object

Type

  • object

iconOverride

iconOverride: string|null

Type

  • string | null

id

id: string

Type

  • string

images

images: array

Type

  • array

insights

insights: array

Type

  • array

manager

manager: HomeyAPIV3.Manager

The Manager of the Item.

Type

name

name: string

Type

  • string

note

note: string

Type

  • string

ready

ready: boolean

Type

  • boolean

repair

repair: boolean

Type

  • boolean

settings

settings: object

Type

  • object

settingsObj

settingsObj: boolean

Type

  • boolean

ui

ui: object

Type

  • object

uiIndicator

uiIndicator: string|null

Type

  • string | null

unavailableMessage

unavailableMessage: string

Type

  • string

unpair

unpair: boolean

Type

  • boolean

uri

uri: string

The URI of the Item, e.g. homey:foo:bar.

Type

  • string

virtualClass

virtualClass: string|null

Type

  • string | null

zone

zone: string

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>

Events

delete

.on('delete')

update

.on('update')

Parameters

Name Type Description
device
object