Example
// register system events
this.homey.on('memwarn', () => console.log('memwarn!'));
// access a Manager
const latitude = this.homey.geolocation.getLatitude();
console.log('Latitude: ', latitude);
Extends
Instance Properties
api
api: ManagerApiType
app
app: Appapps
apps: ManagerAppsType
arp
arp: ManagerArpType
audio
audio: ManagerAudioType
ble
ble: ManagerBLEType
clock
clock: ManagerClockType
cloud
cloud: ManagerCloudType
discovery
discovery: ManagerDiscoveryType
drivers
drivers: ManagerDriversType
env
env: anyThe env.json environment variables
Type
- any
flow
flow: ManagerFlowType
geolocation
geolocation: ManagerGeolocationType
i18n
i18n: ManagerI18nType
images
images: ManagerImagesType
insights
insights: ManagerInsightsType
ledring
ledring: ManagerLedringType
manifest
manifest: anyThe app.json manifest
Type
- any
nfc
nfc: ManagerNFCType
notifications
notifications: ManagerNotificationsType
platform
platform: 'local'|'cloud'The platform of the Homey that is running this app (local
or cloud
)
This property may be
undefined
on older Homey Pro versions
Type
- 'local' | 'cloud'
platformVersion
platformVersion: 1|2The platform's version of the Homey that is running this app (1
or 2
)
This property may be
undefined
on older Homey Pro versions
Type
- 1 | 2
rf
rf: ManagerRFType
settings
settings: ManagerSettingsType
speechInput
speechInput: ManagerSpeechInputType
speechOutput
speechOutput: ManagerSpeechOutputType
version
version: stringThe software version of the Homey that is running this app
Type
- string
zigbee
zigbee: ManagerZigBeeType
zwave
zwave: ManagerZwaveType
Instance Methods
__
__(key, tagsopt): stringShortcut to ManagerI18n#__
Parameters
Name | Type | Description |
---|---|---|
key
|
string | Object | translation string or Object |
tags
|
Object
<optional> |
values to interpolate into the translation |
Returns
Examples
this.homey.__('errors.device_unavailable');
this.homey.__({ en: 'My String', nl: 'Mijn tekst' });
clearInterval
clearInterval(timeoutId)Alias to clearInterval
Parameters
Name | Type | Description |
---|---|---|
timeoutId
|
any |
clearTimeout
clearTimeout(timeoutId)Alias to clearTimeout
Parameters
Name | Type | Description |
---|---|---|
timeoutId
|
any |
error
error(…args)Emits the __error
event with args
as parameters.
Parameters
Name | Type | Description |
---|---|---|
args
|
*
<repeatable> |
hasPermission
hasPermission(permission): booleanParameters
Name | Type | Description |
---|---|---|
permission
|
string |
Returns
log
log(…args)Emits the __log
event with args
as parameters.
Parameters
Name | Type | Description |
---|---|---|
args
|
*
<repeatable> |
setInterval
setInterval(callback, ms, …args): NodeJS.TimerAlias to setInterval that ensures the interval is correctly disposed of when the Homey instance gets destroyed
Parameters
Name | Type | Description |
---|---|---|
callback
|
function | |
ms
|
number | |
args
|
any
<repeatable> |
Returns
setTimeout
setTimeout(callback, ms, …args): NodeJS.TimerAlias to setTimeout that ensures the timout is correctly disposed of when the Homey instance gets destroyed
Parameters
Name | Type | Description |
---|---|---|
callback
|
function | |
ms
|
number | |
args
|
any
<repeatable> |
Returns
Events
cpuwarn
.on('cpuwarn')This event is fired when the app is using too much CPU. When the app does not behave within reasonable amount of time, the app is killed.
Parameters
Name | Type | Description |
---|---|---|
data
|
object | |
count
|
number | The number of warnings already sent. |
limit
|
number | The number of maximum warnings until the app is killed. |
|
memwarn
.on('memwarn')This event is fired when the app is using too much memory. When the app does not behave within reasonable amount of time, the app is killed.
Parameters
Name | Type | Description |
---|---|---|
data
|
object | |
count
|
number | The number of warnings already sent. |
limit
|
number | The number of maximum warnings until the app is killed. |
|
unload
.on('unload')This event is fired when the app is being stopped.