-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapp.js
28 lines (21 loc) · 841 Bytes
/
app.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
'use strict';
const Homey = require('homey');
class MyApp extends Homey.App {
/**
* onInit is called when the app is initialized.
*/
async onInit() {
const batteryRuntimeIsLessCondition = this.homey.flow.getConditionCard('battery_runtime_is_less');
batteryRuntimeIsLessCondition.registerRunListener(async (args, state) => {
const value = args.device.getCapabilityValue('measure_battery_runtime');
return value < args.value;
});
const batteryRuntimeEqualCondition = this.homey.flow.getConditionCard('battery_runtime_equal');
batteryRuntimeEqualCondition.registerRunListener(async (args, state) => {
const value = args.device.getCapabilityValue('measure_battery_runtime');
return value === args.value;
});
this.log('NUT has been initialized');
}
}
module.exports = MyApp;