-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathfeedbacks.js
More file actions
90 lines (86 loc) · 2.71 KB
/
Copy pathfeedbacks.js
File metadata and controls
90 lines (86 loc) · 2.71 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const { combineRgb } = require('@companion-module/base')
const v3 = require('node-hue-api').v3
module.exports = function (self) {
self.setFeedbackDefinitions({
light: {
name: 'Light',
type: 'boolean',
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'light',
type: 'dropdown',
label: 'Light',
default: 'Select light',
choices: self.lights.map((light) => ({
id: light.id,
label: light.name
}))
}
],
callback: async (feedback) => {
const light = self.lights.find((light) => light.id == feedback.options.light);
if (light) {
return light.state.on;
}
}
},
room: {
name: 'Room',
type: 'boolean',
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'room',
type: 'dropdown',
label: 'Room',
required: true,
default: "Select room",
choices: self.rooms.map((room) => ({
id: room.id,
label: room.name
}))
}
],
callback: async (feedback) => {
const room = self.rooms.find((room) => room.id == feedback.options.room);
if (room) {
return room.state.any_on;
}
}
},
zone: {
name: 'Zone',
type: 'boolean',
defaultStyle: {
bgcolor: combineRgb(0, 255, 0),
color: combineRgb(0, 0, 0),
},
options: [
{
id: 'zone',
type: 'dropdown',
label: 'Zone',
required: true,
default: "Select zone",
choices: self.zones.map((zone) => ({
id: zone.id,
label: zone.name
}))
}
],
callback: async (feedback) => {
const zone = self.zones.find((zone) => zone.id == feedback.options.zone);
if (zone) {
return zone.state.any_on;
}
}
},
})
}