-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvariables.js
41 lines (35 loc) · 1.03 KB
/
variables.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
function buildVariables(self) {
const variables = []
const values = {}
self.lights.forEach((light) => {
variables.push({
variableId: `light_${light.id}`,
name: `Light ${light.name}`,
});
values[`light_${light.id}`] = light.name;
});
self.rooms.forEach((room) => {
variables.push({
variableId: `room_${room.id}`,
name: `Room ${room.name}`,
});
values[`room_${room.id}`] = room.name;
});
self.scenes.forEach((scene) => {
variables.push({
variableId: `scene_${scene.id}`,
name: `Scene ${scene.name}`,
});
values[`scene_${scene.id}`] = scene.name;
});
self.zones.forEach((zone) => {
variables.push({
variableId: `zone_${zone.id}`,
name: `Zone ${zone.name}`,
});
values[`zone_${zone.id}`] = zone.name;
});
self.setVariableDefinitions(variables);
self.setVariableValues(values);
}
module.exports = { buildVariables }