-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathapi.js
59 lines (48 loc) · 1.3 KB
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict';
const Log = require('./Log');
const Homey = require('homey');
module.exports = {
// Retrieve all devices with their information
async getDevices({ homey }) {
return homey.app.getDevices();
},
// Retrieve all zones with their information
async getZones({ homey }) {
return homey.app.getZones();
},
// Fetch running state
async getRunning({ homey }) {
return homey.app.isRunning();
},
// Set running state
async setRunning({ homey, body }) {
const running = body && body.running;
return homey.app.setRunning(running);
},
// Refresh device states
async refresh({ homey }) {
return await homey.app.refresh();
},
// Settings changed
async getSettingsChanged({ homey }) {
return await homey.app.settingsChanged();
},
// Log lines
async getLog({ homey }) {
return Log.getLogLines();
},
// Log level
async getLogLevel({ homey }) {
return Log.getLevel();
},
// Set log level
async setLogLevel({ homey, body }) {
const level = body.level;
Log.info("Set log level: " + level);
return Log.setLevel(level);
},
// Queue/Progress state
async getState({ homey }) {
return homey.app.getState();
}
}