-
Notifications
You must be signed in to change notification settings - Fork 126
/
app.js
51 lines (41 loc) · 1.63 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';
const Homey = require('homey');
const { debug } = require('zigbee-clusters');
debug(true);
class tuyazigbee extends Homey.App {
onInit() {
this.log('Tuya Zigbee app is running...');
// Register the action card for christmas lights
this.homey.flow.getActionCard('start_effect')
.registerRunListener(async (args, state) => {
this.log("Christmas Lights Action Card Triggered");
await args.christmas_lights_device.StartEffect(args);
return true
})
// Register the action card for setting window open status
this.homey.flow.getActionCard('window_open_status_set')
.registerRunListener(async ({ device, window_open_status }) => {
this.log("Window is open Action Card Triggered");
await device.setWindowOpen(window_open_status);
});
// Register the condition card for checking if the window is open
this.homey.flow.getConditionCard('window_open_status_get')
.registerRunListener(async ({ device }) => {
this.log("Window is open Condition Card Triggered");
return device.getWindowOpen();
});
/* // Register the action card for setting window open status
this.homey.flow.getActionCard('window_open_status_set_2')
.registerRunListener(async ({ device, window_open_status }) => {
this.log("Window is open Action Card Triggered");
await device.setWindowOpen(window_open_status);
});
// Register the condition card for checking if the window is open
this.homey.flow.getConditionCard('window_open_status_get_2')
.registerRunListener(async ({ device }) => {
this.log("Window is open Condition Card Triggered");
return device.getWindowOpen();
}); */
}
}
module.exports = tuyazigbee;