-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.js
59 lines (46 loc) · 2.24 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
52
53
54
55
56
57
58
59
'use strict';
const Homey = require('homey');
//apps.developers.athom.com chapter Flows, "listening for events"
//Register run listeners for each flow card
//TRIGGGERCARDS
//CONDITIONCARDS
//V2 implementation
// const ConditionComment = new Homey.FlowCardCondition('condition_Comment');
// const ConditionFixThis = new Homey.FlowCardCondition('condition_FixThis');
//V3 implementation
// let ConditionComment = this.homey.flow.getconditioncard('condition_Comment');
// let ConditionFixThis = this.homey.flow.getconditioncard('condition_FixThis');
//ACTIONCARDS
// const ActionComment = new Homey.FlowCardAction('action_Comment');
// const ActionFixThis = new Homey.FlowCardAction('action_FixThis');
//V3 implementation
// let ActionComment = this.homey.flow.getActioncard('action_Comment');
// let ActionFixThis = this.homey.flow.getActioncard('action_FixThis');
//apps.developers.athom.com chapter App Development guidelines, "General"
// add the name of your app here. This class will should be the same name as used later in the "module.exports"
class FlowComments extends Homey.App {
onInit() {
this.log(`${Homey.manifest.id} ${Homey.manifest.version} initialising --------------`)
// flow conditions
// moved declarations into onInit()
// Changed capatilization on getconditioncard
const ConditionComment = this.homey.flow.getConditionCard('condition_Comment');
const ConditionFixThis = this.homey.flow.getConditionCard('condition_FixThis');
// flow actions
const ActionComment = this.homey.flow.getActionCard('action_Comment');
const ActionFixThis = this.homey.flow.getActionCard('action_FixThis');
// The card created is not active. So no function is defined. It will always return "true"
// removed .register() is no longer needed
ConditionComment
.registerRunListener(async (args,state) => {return true})
ConditionFixThis
.registerRunListener(async (args,state) => {return true});
ActionComment
.registerRunListener(async (args,state) => {return true});
ActionFixThis
.registerRunListener(async (args,state) => {return true});
this.log(`${Homey.manifest.id} ready for action ----------------------`)
}
}
// add the name of your app here, the name is the class name as defined earlier
module.exports = FlowComments;