@ledvance/group-ui-biz-bundle 1.0.91 → 1.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/modules/biorhythm/BiorhythmBean.ts +1 -1
- package/src/modules/diyScene/DefaultScenes.ts +439 -0
- package/src/modules/diyScene/DiySceneActions.ts +206 -0
- package/src/modules/diyScene/DiySceneEditorPage.tsx +356 -0
- package/src/modules/diyScene/DiyScenePage.tsx +281 -0
- package/src/modules/diyScene/Router.ts +25 -0
- package/src/modules/energyConsumption/EnergyConsumptionActions.ts +134 -119
- package/src/modules/energyConsumption/EnergyConsumptionChart.tsx +30 -9
- package/src/modules/energyConsumption/component/DateSwitch.tsx +111 -0
- package/src/modules/energyConsumption/component/NewBarChart.tsx +16 -3
- package/src/modules/fixedTimeForPlug/FixedTimeForPlugPage.tsx +14 -0
- package/src/modules/fixedTimeForPlug/ItemCard.tsx +3 -2
- package/src/modules/fixedTimingForLight/FixedTimingForLightPage.tsx +14 -0
- package/src/modules/fixedTimingForLight/ItemCard.tsx +3 -2
- package/src/modules/flags/FlagActions.ts +3 -1
- package/src/modules/flags/FlagPage.tsx +4 -3
- package/src/modules/mood_new/Interface.ts +1 -0
- package/src/modules/mood_new/MoodActions.ts +12 -1
- package/src/modules/mood_new/MoodItem.tsx +2 -1
- package/src/modules/mood_new/MoodPage.tsx +34 -12
- package/src/modules/randomTimeForPlug/ItemCard.tsx +3 -2
- package/src/modules/randomTimeForPlug/RandomTimeForPlugPage.tsx +14 -0
- package/src/modules/randomTimingForLight/RandomTimingForLightPage.tsx +14 -0
- package/src/modules/sleepWakeUp/SleepWakeUpPage.tsx +34 -5
- package/src/modules/timeSchedule/Interface.ts +19 -10
- package/src/modules/timeSchedule/TimeScheduleActions.ts +7 -1
- package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +116 -26
- package/src/modules/timeSchedule/TimeSchedulePage.tsx +1 -0
- package/src/modules/timeSchedule/components/ManuaSettings.tsx +35 -3
- package/src/modules/timeSchedule/components/ScheduleCard.tsx +5 -6
- package/src/modules/timer/TimerAction.ts +1 -1
- package/src/navigation/Routers.ts +3 -1
package/package.json
CHANGED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
|
|
2
|
+
import I18n from "@ledvance/base/src/i18n";
|
|
3
|
+
import { DiySceneInfo } from "@ledvance/base/src/utils/interface";
|
|
4
|
+
|
|
5
|
+
export default [{
|
|
6
|
+
// 00650000000000000003e800000000
|
|
7
|
+
id: 101,
|
|
8
|
+
name: I18n.getLang('mood_strip_default_mood_focus'),
|
|
9
|
+
type: 'Static',
|
|
10
|
+
nodes: [],
|
|
11
|
+
speed: 0,
|
|
12
|
+
duration: 0,
|
|
13
|
+
mode: 0,
|
|
14
|
+
h: 0,
|
|
15
|
+
s: 0,
|
|
16
|
+
v: 1000,
|
|
17
|
+
colorTemp: 0,
|
|
18
|
+
brightness: 0,
|
|
19
|
+
}, {
|
|
20
|
+
// 00660000000000000003e800000000
|
|
21
|
+
id: 102,
|
|
22
|
+
name: I18n.getLang('mood_strip_default_mood_lavender'),
|
|
23
|
+
type: 'Static',
|
|
24
|
+
nodes: [],
|
|
25
|
+
speed: 0,
|
|
26
|
+
duration: 0,
|
|
27
|
+
mode: 0,
|
|
28
|
+
h: 0,
|
|
29
|
+
s: 0,
|
|
30
|
+
v: 1000,
|
|
31
|
+
colorTemp: 0,
|
|
32
|
+
brightness: 0,
|
|
33
|
+
}, {
|
|
34
|
+
// 00670000000000000003e800000000
|
|
35
|
+
id: 103,
|
|
36
|
+
name: I18n.getLang('mood_strip_default_mood_lavender_true_colors'),
|
|
37
|
+
type: 'Static',
|
|
38
|
+
nodes: [],
|
|
39
|
+
speed: 0,
|
|
40
|
+
duration: 0,
|
|
41
|
+
mode: 0,
|
|
42
|
+
h: 0,
|
|
43
|
+
s: 0,
|
|
44
|
+
v: 1000,
|
|
45
|
+
colorTemp: 0,
|
|
46
|
+
brightness: 0,
|
|
47
|
+
}, {
|
|
48
|
+
// 00680000000000000003e800000000
|
|
49
|
+
id: 104,
|
|
50
|
+
name: I18n.getLang('mood_strip_default_mood_night_light'),
|
|
51
|
+
type: 'Static',
|
|
52
|
+
nodes: [],
|
|
53
|
+
speed: 0,
|
|
54
|
+
duration: 0,
|
|
55
|
+
mode: 0,
|
|
56
|
+
h: 0,
|
|
57
|
+
s: 0,
|
|
58
|
+
v: 1000,
|
|
59
|
+
colorTemp: 0,
|
|
60
|
+
brightness: 0,
|
|
61
|
+
}, {
|
|
62
|
+
// 00690000000000000003e800000000
|
|
63
|
+
id: 105,
|
|
64
|
+
name: I18n.getLang('mood_strip_default_mood_cozy'),
|
|
65
|
+
type: 'Static',
|
|
66
|
+
nodes: [],
|
|
67
|
+
speed: 0,
|
|
68
|
+
duration: 0,
|
|
69
|
+
mode: 0,
|
|
70
|
+
h: 0,
|
|
71
|
+
s: 0,
|
|
72
|
+
v: 1000,
|
|
73
|
+
colorTemp: 0,
|
|
74
|
+
brightness: 0,
|
|
75
|
+
}, {
|
|
76
|
+
// 006a0000000000000003e800000000
|
|
77
|
+
id: 106,
|
|
78
|
+
name: I18n.getLang('mood_strip_default_mood_atmosphere'),
|
|
79
|
+
type: 'Static',
|
|
80
|
+
nodes: [],
|
|
81
|
+
speed: 0,
|
|
82
|
+
duration: 0,
|
|
83
|
+
mode: 0,
|
|
84
|
+
h: 0,
|
|
85
|
+
s: 0,
|
|
86
|
+
v: 1000,
|
|
87
|
+
colorTemp: 0,
|
|
88
|
+
brightness: 0,
|
|
89
|
+
}, {
|
|
90
|
+
// 006b0000000000000003e800000000
|
|
91
|
+
id: 107,
|
|
92
|
+
name: I18n.getLang('mood_strip_default_mood_relax'),
|
|
93
|
+
type: 'Static',
|
|
94
|
+
nodes: [],
|
|
95
|
+
speed: 0,
|
|
96
|
+
duration: 0,
|
|
97
|
+
mode: 0,
|
|
98
|
+
h: 0,
|
|
99
|
+
s: 0,
|
|
100
|
+
v: 1000,
|
|
101
|
+
colorTemp: 0,
|
|
102
|
+
brightness: 0,
|
|
103
|
+
}, {
|
|
104
|
+
// 006c00000000000000003e80000000
|
|
105
|
+
id: 108,
|
|
106
|
+
name: I18n.getLang('mood_strip_default_mood_sky'),
|
|
107
|
+
type: 'Static',
|
|
108
|
+
nodes: [],
|
|
109
|
+
speed: 0,
|
|
110
|
+
duration: 0,
|
|
111
|
+
mode: 0,
|
|
112
|
+
h: 0,
|
|
113
|
+
s: 0,
|
|
114
|
+
v: 1000,
|
|
115
|
+
colorTemp: 0,
|
|
116
|
+
brightness: 0,
|
|
117
|
+
}, {
|
|
118
|
+
// 00c93232000000000003e800000000
|
|
119
|
+
id: 201,
|
|
120
|
+
name: I18n.getLang('mood_strip_default_mood_ocean'),
|
|
121
|
+
type: 'Dynamic',
|
|
122
|
+
nodes: [],
|
|
123
|
+
speed: 50,
|
|
124
|
+
duration: 50,
|
|
125
|
+
mode: 0,
|
|
126
|
+
h: 0,
|
|
127
|
+
s: 0,
|
|
128
|
+
v: 1000,
|
|
129
|
+
colorTemp: 0,
|
|
130
|
+
brightness: 0,
|
|
131
|
+
}, {
|
|
132
|
+
// 00ca3232000000000003e800000000
|
|
133
|
+
id: 202,
|
|
134
|
+
name: I18n.getLang('mood_strip_default_mood_warmth'),
|
|
135
|
+
type: 'Dynamic',
|
|
136
|
+
nodes: [],
|
|
137
|
+
speed: 50,
|
|
138
|
+
duration: 50,
|
|
139
|
+
mode: 0,
|
|
140
|
+
h: 0,
|
|
141
|
+
s: 0,
|
|
142
|
+
v: 1000,
|
|
143
|
+
colorTemp: 0,
|
|
144
|
+
brightness: 0,
|
|
145
|
+
}, {
|
|
146
|
+
// 00cb3232000000000003e800000000
|
|
147
|
+
id: 203,
|
|
148
|
+
name: I18n.getLang('mood_strip_default_mood_romance'),
|
|
149
|
+
type: 'Dynamic',
|
|
150
|
+
nodes: [],
|
|
151
|
+
speed: 50,
|
|
152
|
+
duration: 50,
|
|
153
|
+
mode: 0,
|
|
154
|
+
h: 0,
|
|
155
|
+
s: 0,
|
|
156
|
+
v: 1000,
|
|
157
|
+
colorTemp: 0,
|
|
158
|
+
brightness: 0,
|
|
159
|
+
}, {
|
|
160
|
+
// 00cc3232000000000003e800000000
|
|
161
|
+
id: 204,
|
|
162
|
+
name: I18n.getLang('mood_strip_default_mood_jungle'),
|
|
163
|
+
type: 'Dynamic',
|
|
164
|
+
nodes: [],
|
|
165
|
+
speed: 50,
|
|
166
|
+
duration: 50,
|
|
167
|
+
mode: 0,
|
|
168
|
+
h: 0,
|
|
169
|
+
s: 0,
|
|
170
|
+
v: 1000,
|
|
171
|
+
colorTemp: 0,
|
|
172
|
+
brightness: 0,
|
|
173
|
+
}, {
|
|
174
|
+
// 00cd3232000000000003e800000000
|
|
175
|
+
id: 205,
|
|
176
|
+
name: I18n.getLang('mood_strip_default_mood_sunset'),
|
|
177
|
+
type: 'Dynamic',
|
|
178
|
+
nodes: [],
|
|
179
|
+
speed: 50,
|
|
180
|
+
duration: 50,
|
|
181
|
+
mode: 0,
|
|
182
|
+
h: 0,
|
|
183
|
+
s: 0,
|
|
184
|
+
v: 1000,
|
|
185
|
+
colorTemp: 0,
|
|
186
|
+
brightness: 0,
|
|
187
|
+
}, {
|
|
188
|
+
// 00ce3232000000000003e800000000
|
|
189
|
+
id: 206,
|
|
190
|
+
name: I18n.getLang('mood_strip_default_mood_missing'),
|
|
191
|
+
type: 'Dynamic',
|
|
192
|
+
nodes: [],
|
|
193
|
+
speed: 50,
|
|
194
|
+
duration: 50,
|
|
195
|
+
mode: 0,
|
|
196
|
+
h: 0,
|
|
197
|
+
s: 0,
|
|
198
|
+
v: 1000,
|
|
199
|
+
colorTemp: 0,
|
|
200
|
+
brightness: 0,
|
|
201
|
+
}, {
|
|
202
|
+
// 00cf3232000000000003e800000000
|
|
203
|
+
id: 207,
|
|
204
|
+
name: I18n.getLang('mood_strip_default_mood_party'),
|
|
205
|
+
type: 'Dynamic',
|
|
206
|
+
nodes: [],
|
|
207
|
+
speed: 50,
|
|
208
|
+
duration: 50,
|
|
209
|
+
mode: 0,
|
|
210
|
+
h: 0,
|
|
211
|
+
s: 0,
|
|
212
|
+
v: 1000,
|
|
213
|
+
colorTemp: 0,
|
|
214
|
+
brightness: 0,
|
|
215
|
+
}, {
|
|
216
|
+
// 00d03232000000000003e800000000
|
|
217
|
+
id: 208,
|
|
218
|
+
name: I18n.getLang('mood_strip_default_mood_rainbow'),
|
|
219
|
+
type: 'Dynamic',
|
|
220
|
+
nodes: [],
|
|
221
|
+
speed: 50,
|
|
222
|
+
duration: 50,
|
|
223
|
+
mode: 0,
|
|
224
|
+
h: 0,
|
|
225
|
+
s: 0,
|
|
226
|
+
v: 1000,
|
|
227
|
+
colorTemp: 0,
|
|
228
|
+
brightness: 0,
|
|
229
|
+
}, {
|
|
230
|
+
// 00d13232000000000003e800000000
|
|
231
|
+
id: 209,
|
|
232
|
+
name: I18n.getLang('mood_strip_default_mood_meditation'),
|
|
233
|
+
type: 'Dynamic',
|
|
234
|
+
nodes: [],
|
|
235
|
+
speed: 50,
|
|
236
|
+
duration: 50,
|
|
237
|
+
mode: 0,
|
|
238
|
+
h: 0,
|
|
239
|
+
s: 0,
|
|
240
|
+
v: 1000,
|
|
241
|
+
colorTemp: 0,
|
|
242
|
+
brightness: 0,
|
|
243
|
+
}, {
|
|
244
|
+
// 00d23232000000000003e800000000
|
|
245
|
+
id: 210,
|
|
246
|
+
name: I18n.getLang('mood_strip_default_mood_wake_time'),
|
|
247
|
+
type: 'Dynamic',
|
|
248
|
+
nodes: [],
|
|
249
|
+
speed: 50,
|
|
250
|
+
duration: 50,
|
|
251
|
+
mode: 0,
|
|
252
|
+
h: 0,
|
|
253
|
+
s: 0,
|
|
254
|
+
v: 1000,
|
|
255
|
+
colorTemp: 0,
|
|
256
|
+
brightness: 0,
|
|
257
|
+
}, {
|
|
258
|
+
// 00d33232000000000003e800000000
|
|
259
|
+
id: 211,
|
|
260
|
+
name: I18n.getLang('mood_strip_default_mood_spring'),
|
|
261
|
+
type: 'Dynamic',
|
|
262
|
+
nodes: [],
|
|
263
|
+
speed: 50,
|
|
264
|
+
duration: 50,
|
|
265
|
+
mode: 0,
|
|
266
|
+
h: 0,
|
|
267
|
+
s: 0,
|
|
268
|
+
v: 1000,
|
|
269
|
+
colorTemp: 0,
|
|
270
|
+
brightness: 0,
|
|
271
|
+
}, {
|
|
272
|
+
// 00d43232000000000003e800000000
|
|
273
|
+
id: 212,
|
|
274
|
+
name: I18n.getLang('mood_strip_default_mood_halloween'),
|
|
275
|
+
type: 'Dynamic',
|
|
276
|
+
nodes: [],
|
|
277
|
+
speed: 50,
|
|
278
|
+
duration: 50,
|
|
279
|
+
mode: 0,
|
|
280
|
+
h: 0,
|
|
281
|
+
s: 0,
|
|
282
|
+
v: 1000,
|
|
283
|
+
colorTemp: 0,
|
|
284
|
+
brightness: 0,
|
|
285
|
+
}, {
|
|
286
|
+
// 00d53232000000000003e800000000
|
|
287
|
+
id: 213,
|
|
288
|
+
name: I18n.getLang('mood_strip_default_mood_christmas'),
|
|
289
|
+
type: 'Dynamic',
|
|
290
|
+
nodes: [],
|
|
291
|
+
speed: 50,
|
|
292
|
+
duration: 50,
|
|
293
|
+
mode: 0,
|
|
294
|
+
h: 0,
|
|
295
|
+
s: 0,
|
|
296
|
+
v: 1000,
|
|
297
|
+
colorTemp: 0,
|
|
298
|
+
brightness: 0,
|
|
299
|
+
}, {
|
|
300
|
+
// 00d63232000000000003e800000000
|
|
301
|
+
id: 214,
|
|
302
|
+
name: I18n.getLang('mood_strip_default_mood_noble'),
|
|
303
|
+
type: 'Dynamic',
|
|
304
|
+
nodes: [],
|
|
305
|
+
speed: 50,
|
|
306
|
+
duration: 50,
|
|
307
|
+
mode: 0,
|
|
308
|
+
h: 0,
|
|
309
|
+
s: 0,
|
|
310
|
+
v: 1000,
|
|
311
|
+
colorTemp: 0,
|
|
312
|
+
brightness: 0,
|
|
313
|
+
}, {
|
|
314
|
+
// 00d73232000000000003e800000000
|
|
315
|
+
id: 215,
|
|
316
|
+
name: I18n.getLang('mood_strip_default_mood_energy'),
|
|
317
|
+
type: 'Dynamic',
|
|
318
|
+
nodes: [],
|
|
319
|
+
speed: 50,
|
|
320
|
+
duration: 50,
|
|
321
|
+
mode: 0,
|
|
322
|
+
h: 0,
|
|
323
|
+
s: 0,
|
|
324
|
+
v: 1000,
|
|
325
|
+
colorTemp: 0,
|
|
326
|
+
brightness: 0,
|
|
327
|
+
}, {
|
|
328
|
+
// 00d83232000000000003e800000000
|
|
329
|
+
id: 216,
|
|
330
|
+
name: I18n.getLang('mood_strip_default_mood_deep_dive'),
|
|
331
|
+
type: 'Dynamic',
|
|
332
|
+
nodes: [],
|
|
333
|
+
speed: 50,
|
|
334
|
+
duration: 50,
|
|
335
|
+
mode: 0,
|
|
336
|
+
h: 0,
|
|
337
|
+
s: 0,
|
|
338
|
+
v: 1000,
|
|
339
|
+
colorTemp: 0,
|
|
340
|
+
brightness: 0,
|
|
341
|
+
}, {
|
|
342
|
+
// 00d93232000000000003e800000000
|
|
343
|
+
id: 217,
|
|
344
|
+
name: I18n.getLang('mood_strip_default_mood_mojito'),
|
|
345
|
+
type: 'Dynamic',
|
|
346
|
+
nodes: [],
|
|
347
|
+
speed: 50,
|
|
348
|
+
duration: 50,
|
|
349
|
+
mode: 0,
|
|
350
|
+
h: 0,
|
|
351
|
+
s: 0,
|
|
352
|
+
v: 1000,
|
|
353
|
+
colorTemp: 0,
|
|
354
|
+
brightness: 0,
|
|
355
|
+
}, {
|
|
356
|
+
// 00da3232000000000003e800000000
|
|
357
|
+
id: 218,
|
|
358
|
+
name: I18n.getLang('mood_strip_default_mood_forest'),
|
|
359
|
+
type: 'Dynamic',
|
|
360
|
+
nodes: [],
|
|
361
|
+
speed: 50,
|
|
362
|
+
duration: 50,
|
|
363
|
+
mode: 0,
|
|
364
|
+
h: 0,
|
|
365
|
+
s: 0,
|
|
366
|
+
v: 1000,
|
|
367
|
+
colorTemp: 0,
|
|
368
|
+
brightness: 0,
|
|
369
|
+
}, {
|
|
370
|
+
// 00db3232000000000003e800000000
|
|
371
|
+
id: 219,
|
|
372
|
+
name: I18n.getLang('mood_strip_default_mood_cyberpunk'),
|
|
373
|
+
type: 'Dynamic',
|
|
374
|
+
nodes: [],
|
|
375
|
+
speed: 50,
|
|
376
|
+
duration: 50,
|
|
377
|
+
mode: 0,
|
|
378
|
+
h: 0,
|
|
379
|
+
s: 0,
|
|
380
|
+
v: 1000,
|
|
381
|
+
colorTemp: 0,
|
|
382
|
+
brightness: 0,
|
|
383
|
+
}, {
|
|
384
|
+
// 00dc3232000000000003e800000000
|
|
385
|
+
id: 220,
|
|
386
|
+
name: I18n.getLang('mood_strip_default_mood_summer'),
|
|
387
|
+
type: 'Dynamic',
|
|
388
|
+
nodes: [],
|
|
389
|
+
speed: 50,
|
|
390
|
+
duration: 50,
|
|
391
|
+
mode: 0,
|
|
392
|
+
h: 0,
|
|
393
|
+
s: 0,
|
|
394
|
+
v: 1000,
|
|
395
|
+
colorTemp: 0,
|
|
396
|
+
brightness: 0,
|
|
397
|
+
}, {
|
|
398
|
+
// 00dd3232000000000003e800000000
|
|
399
|
+
id: 221,
|
|
400
|
+
name: I18n.getLang('mood_strip_default_mood_fall'),
|
|
401
|
+
type: 'Dynamic',
|
|
402
|
+
nodes: [],
|
|
403
|
+
speed: 50,
|
|
404
|
+
duration: 50,
|
|
405
|
+
mode: 0,
|
|
406
|
+
h: 0,
|
|
407
|
+
s: 0,
|
|
408
|
+
v: 1000,
|
|
409
|
+
colorTemp: 0,
|
|
410
|
+
brightness: 0,
|
|
411
|
+
}, {
|
|
412
|
+
// 00de3232000000000003e800000000
|
|
413
|
+
id: 222,
|
|
414
|
+
name: I18n.getLang('mood_strip_default_mood_club'),
|
|
415
|
+
type: 'Dynamic',
|
|
416
|
+
nodes: [],
|
|
417
|
+
speed: 50,
|
|
418
|
+
duration: 50,
|
|
419
|
+
mode: 0,
|
|
420
|
+
h: 0,
|
|
421
|
+
s: 0,
|
|
422
|
+
v: 1000,
|
|
423
|
+
colorTemp: 0,
|
|
424
|
+
brightness: 0,
|
|
425
|
+
}, {
|
|
426
|
+
// 00df3232000000000003e800000000
|
|
427
|
+
id: 223,
|
|
428
|
+
name: I18n.getLang('mood_strip_default_mood_candlelight'),
|
|
429
|
+
type: 'Dynamic',
|
|
430
|
+
nodes: [],
|
|
431
|
+
speed: 50,
|
|
432
|
+
duration: 50,
|
|
433
|
+
mode: 0,
|
|
434
|
+
h: 0,
|
|
435
|
+
s: 0,
|
|
436
|
+
v: 1000,
|
|
437
|
+
colorTemp: 0,
|
|
438
|
+
brightness: 0,
|
|
439
|
+
}, ] as DiySceneInfo[]
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { useFeatureHook, useGroupDp, useGroupEzvizConfig} from "@ledvance/base/src/models/modules/NativePropsSlice";
|
|
2
|
+
import {getGlobalParamsDp} from "@ledvance/base/src/utils/common";
|
|
3
|
+
import {useCallback} from "react";
|
|
4
|
+
import {DiySceneInfo, DiySceneNode, SceneStatusType, WorkMode} from "@ledvance/base/src/utils/interface";
|
|
5
|
+
import {Result} from "@ledvance/base/src/models/modules/Result";
|
|
6
|
+
import {getHexByHSV} from "@ledvance/base/src/utils";
|
|
7
|
+
import DefaultScenes from "./DefaultScenes";
|
|
8
|
+
|
|
9
|
+
interface SceneStatusInfo {
|
|
10
|
+
id: number
|
|
11
|
+
type: SceneStatusType
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface MoodStripConfig {
|
|
15
|
+
switch_led: boolean
|
|
16
|
+
workMode: WorkMode
|
|
17
|
+
brightValue: number
|
|
18
|
+
tempValue: number
|
|
19
|
+
paintColourData: string
|
|
20
|
+
sceneData?: DiySceneInfo
|
|
21
|
+
diySceneData?: DiySceneInfo
|
|
22
|
+
mixSceneList: DiySceneInfo[]
|
|
23
|
+
loveScene: number[]
|
|
24
|
+
sceneStatus: SceneStatusInfo
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function useSwitchLed(): [boolean, (value: boolean) => Promise<Result<any>>] {
|
|
28
|
+
const [switchLed] = useGroupDp<boolean>(getGlobalParamsDp('switch_led'))
|
|
29
|
+
const [config, setConfig] = useFeatureHook<MoodStripConfig, boolean>('switch_led', false, undefined, undefined, () => ({
|
|
30
|
+
timerTasks: []
|
|
31
|
+
}));
|
|
32
|
+
return [switchLed ?? config, setConfig]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useWorkMode(): [WorkMode, (value: WorkMode) => Promise<Result<any>>] {
|
|
36
|
+
const [workMode] = useGroupDp<WorkMode>(getGlobalParamsDp('work_mode'))
|
|
37
|
+
const [config, setConfig] = useFeatureHook<MoodStripConfig, WorkMode>('workMode', WorkMode.White);
|
|
38
|
+
return [workMode ?? config, setConfig]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function useLoveScenes(): [number[], (loveScenes: number[]) => Promise<Result<any>>] {
|
|
42
|
+
const [dpValue] = useGroupDp<string>(getGlobalParamsDp('love_scene'))
|
|
43
|
+
const dpLoveScenes = decodeLoveScenes(dpValue)
|
|
44
|
+
const [config, setConfig] = useFeatureHook<MoodStripConfig, number[]>('loveScene', dpLoveScenes || [], (val) => encodeLoveScenes(val));
|
|
45
|
+
|
|
46
|
+
return [dpLoveScenes ?? config, setConfig]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function useSceneData(): [(sceneInfo: DiySceneInfo) => Promise<Result<any>>] {
|
|
50
|
+
const [, setSceneConfig] = useFeatureHook<MoodStripConfig, DiySceneInfo | undefined>('sceneData', undefined, (val) => encodeScene(val),
|
|
51
|
+
() => ({[getGlobalParamsDp('switch_led')]: true, [getGlobalParamsDp('work_mode')]: WorkMode.Scene}),
|
|
52
|
+
() => ({switchLed: true, workMode: WorkMode.Scene}));
|
|
53
|
+
const [, setDiySceneConfig] = useFeatureHook<MoodStripConfig, DiySceneInfo | undefined>('diySceneData', undefined, (val) => encodeDiyScene(val),
|
|
54
|
+
() => ({[getGlobalParamsDp('switch_led')]: true, [getGlobalParamsDp('work_mode')]: WorkMode.Scene}),
|
|
55
|
+
() => ({switchLed: true, workMode: WorkMode.Scene}));
|
|
56
|
+
const setSceneData = useCallback((sceneInfo: DiySceneInfo) => {
|
|
57
|
+
if (sceneInfo.type === 'DIY') {
|
|
58
|
+
return setDiySceneConfig(sceneInfo)
|
|
59
|
+
} else {
|
|
60
|
+
return setSceneConfig(sceneInfo)
|
|
61
|
+
}
|
|
62
|
+
}, [])
|
|
63
|
+
return [setSceneData]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function useMixSceneList(): [DiySceneInfo[], (list: DiySceneInfo[]) => Promise<Result<any>>, () => Promise<Result<any>>] {
|
|
67
|
+
const [config, setConfig] = useGroupEzvizConfig<MoodStripConfig, DiySceneInfo[]>('mixSceneList', DefaultScenes)
|
|
68
|
+
const resetConfig = useCallback(() => {
|
|
69
|
+
return setConfig(DefaultScenes)
|
|
70
|
+
}, [])
|
|
71
|
+
return [config, setConfig, resetConfig]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function useSceneStatus(): [number, (type: SceneStatusType, sceneId: number) => Promise<any>, SceneStatusType] {
|
|
75
|
+
const [config, setConfig] = useGroupEzvizConfig<MoodStripConfig, SceneStatusInfo>('sceneStatus', {id: -1, type: SceneStatusType.Scene})
|
|
76
|
+
const sceneStatusId = config.id
|
|
77
|
+
const sceneType = config.type
|
|
78
|
+
const setSceneStatusRemote = useCallback((type: SceneStatusType, sceneId: number) => {
|
|
79
|
+
return setConfig({type: type, id: sceneId})
|
|
80
|
+
}, [])
|
|
81
|
+
return [sceneStatusId, setSceneStatusRemote, sceneType]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function useSceneId() {
|
|
85
|
+
const [dpValue] = useGroupDp<string>(getGlobalParamsDp('scene_data'))
|
|
86
|
+
let sceneId: number | undefined = undefined
|
|
87
|
+
if (dpValue) {
|
|
88
|
+
sceneId = parseInt(dpValue.substring(0, 4), 16)
|
|
89
|
+
}
|
|
90
|
+
return [sceneId]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function useDiySceneId() {
|
|
94
|
+
const [dpValue] = useGroupDp<string>(getGlobalParamsDp('diy_scene_data'))
|
|
95
|
+
let diySceneId: number | undefined = undefined
|
|
96
|
+
if (dpValue) {
|
|
97
|
+
diySceneId = parseInt(dpValue.substring(0, 2), 16)
|
|
98
|
+
}
|
|
99
|
+
return [diySceneId]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function decodeLoveScenes(dpValue: string): number[] {
|
|
103
|
+
const loveScenes: number[] = [];
|
|
104
|
+
for (let i = 2; i < dpValue.length; i += 4) {
|
|
105
|
+
const groupHex = dpValue.slice(i, i + 4);
|
|
106
|
+
const groupDecimal = parseInt(groupHex, 16);
|
|
107
|
+
loveScenes.push(groupDecimal);
|
|
108
|
+
}
|
|
109
|
+
return loveScenes;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function encodeLoveScenes(loveScenes: number[]): string {
|
|
113
|
+
let dpValue = loveScenes.length.toString(16).padStart(2, '0');
|
|
114
|
+
for (const num of loveScenes) {
|
|
115
|
+
const groupHex = num.toString(16).padStart(4, '0');
|
|
116
|
+
dpValue += groupHex;
|
|
117
|
+
}
|
|
118
|
+
return dpValue;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function encodeScene(sceneInfo?: DiySceneInfo): string {
|
|
122
|
+
if (!sceneInfo) {
|
|
123
|
+
return ''
|
|
124
|
+
}
|
|
125
|
+
const idHex = sceneInfo.id.toString(16).padStart(4, '0')
|
|
126
|
+
const speedHex = sceneInfo.speed!.toString(16).padStart(2, '0')
|
|
127
|
+
const durationHex = sceneInfo.duration!.toString(16).padStart(2, '0')
|
|
128
|
+
const modeHex = sceneInfo.mode!.toString(16).padStart(2, '0')
|
|
129
|
+
const hsvHex = getHexByHSV({h: 0, s: 0, v: sceneInfo.v})
|
|
130
|
+
const brightnessHex = '0000'
|
|
131
|
+
const colorTempHex = '0000'
|
|
132
|
+
return `${idHex}${speedHex}${durationHex}${modeHex}${hsvHex}${brightnessHex}${colorTempHex}`
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function decodeScene(dpValue: string): DiySceneInfo {
|
|
136
|
+
const id = parseInt(dpValue.substring(0, 4), 16)
|
|
137
|
+
const speed = parseInt(dpValue.substring(4, 6), 16)
|
|
138
|
+
const duration = parseInt(dpValue.substring(6, 8), 16)
|
|
139
|
+
const mode = parseInt(dpValue.substring(8, 10), 16)
|
|
140
|
+
const hsvHex = dpValue.substring(10, 16)
|
|
141
|
+
const v = parseInt(hsvHex.substring(4, 8), 16) // Assuming the v value is embedded in the HSV hex value
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
id,
|
|
145
|
+
name: '',
|
|
146
|
+
type: speed !== 0 ? 'Dynamic' : 'Static',
|
|
147
|
+
speed,
|
|
148
|
+
duration,
|
|
149
|
+
mode,
|
|
150
|
+
v,
|
|
151
|
+
nodes: []
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
export function encodeDiyScene(sceneInfo?: DiySceneInfo): string {
|
|
157
|
+
if (!sceneInfo) {
|
|
158
|
+
return ''
|
|
159
|
+
}
|
|
160
|
+
const idHex = sceneInfo.id.toString(16).padStart(2, '0')
|
|
161
|
+
const sizeHex = sceneInfo.nodes.length.toString(16).padStart(2, '0')
|
|
162
|
+
const speedHex = sceneInfo.speed!.toString(16).padStart(2, '0')
|
|
163
|
+
const vHex = sceneInfo.v!.toString(16).padStart(4, '0')
|
|
164
|
+
let nodesHex = ''
|
|
165
|
+
sceneInfo.nodes.forEach((node) => {
|
|
166
|
+
nodesHex += node.top.h.toString(16).padStart(4, '0')
|
|
167
|
+
nodesHex += node.top.s.toString(16).padStart(4, '0')
|
|
168
|
+
nodesHex += node.bottom.h.toString(16).padStart(4, '0')
|
|
169
|
+
nodesHex += node.bottom.s.toString(16).padStart(4, '0')
|
|
170
|
+
})
|
|
171
|
+
return `${idHex}${sizeHex}${speedHex}${vHex}${nodesHex}`
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function decodeDiyScene(dpValue: string): DiySceneInfo {
|
|
175
|
+
const id = parseInt(dpValue.substring(0, 2), 16)
|
|
176
|
+
const size = parseInt(dpValue.substring(2, 4), 16)
|
|
177
|
+
const speed = parseInt(dpValue.substring(4, 6), 16)
|
|
178
|
+
const v = parseInt(dpValue.substring(6, 10), 16)
|
|
179
|
+
|
|
180
|
+
let nodes:DiySceneNode[] = []
|
|
181
|
+
let currentIndex = 10 // Start reading nodes after the first 10 characters (id + size + speed + v)
|
|
182
|
+
|
|
183
|
+
for (let i = 0; i < size; i++) {
|
|
184
|
+
const topH = parseInt(dpValue.substring(currentIndex, currentIndex + 4), 16)
|
|
185
|
+
currentIndex += 4
|
|
186
|
+
const topS = parseInt(dpValue.substring(currentIndex, currentIndex + 4), 16)
|
|
187
|
+
currentIndex += 4
|
|
188
|
+
const bottomH = parseInt(dpValue.substring(currentIndex, currentIndex + 4), 16)
|
|
189
|
+
currentIndex += 4
|
|
190
|
+
const bottomS = parseInt(dpValue.substring(currentIndex, currentIndex + 4), 16)
|
|
191
|
+
currentIndex += 4
|
|
192
|
+
|
|
193
|
+
nodes.push({
|
|
194
|
+
top: { h: topH, s: topS, v: 1000 },
|
|
195
|
+
bottom: { h: bottomH, s: bottomS, v: 1000 }
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
id: id,
|
|
200
|
+
name: '',
|
|
201
|
+
type: 'DIY',
|
|
202
|
+
nodes: nodes,
|
|
203
|
+
speed: speed,
|
|
204
|
+
v: v
|
|
205
|
+
}
|
|
206
|
+
}
|