Constructor
HomeyAPIApp
new HomeyAPIApp(args)Parameters
Name | Type | Description |
---|---|---|
args
|
Object | |
homey
|
Homey | The Homey instance of your app, usually |
debug
|
boolean
<optional> default: false
|
Enable debug logs. |
|
Example
// app.json
{
...
"platforms": [ "local" ],
"permissions": [ "homey:manager:api" ],
}
// app.js
const Homey = require('homey');
const { HomeyAPIApp } = require('homey-api');
class MyApp extends Homey.App {
async onInit() {
const api = new HomeyAPIApp({
homey: this.homey,
});
const devices = await api.devices.getDevices();
this.log('Devices:', devices);
}
}
Extends
Properties
DISCOVERY_STRATEGIES
DISCOVERY_STRATEGIESPossible Discovery Strategies
Properties
Name | Type | Description |
---|---|---|
DISCOVERY_STRATEGIES
|
object | |
LOCAL
|
string | Local HTTP, e.g. |
|
Methods
__
__(input): string|nullTranslates an i18n-object (e.g. { en: 'My String', nl: 'Mijn tekst' }
to a string.
Uses the language of Homey as defined in Homey.
Parameters
Name | Type | Description |
---|---|---|
input
|
object | |
en
|
string | English translation |
nl
|
string | Dutch translation |
|
Returns
- The translated string, or null
string
|
null
Example
homeyApi.__({
en: 'Hello',
nl: 'Hallo',
fr: 'Bonjour',
}); // returns "Hello" if Homey is set to English
isConnected
isConnected(): BooleanIf Homey is connected to Socket.io.
Returns
Boolean