@ray-js/lamp-schedule-core 1.0.0-beta-1
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/README.md +565 -0
- package/lib/config/dpCodes.d.ts +27 -0
- package/lib/config/dpCodes.js +30 -0
- package/lib/config/index.d.ts +2 -0
- package/lib/config/index.js +2 -0
- package/lib/config/rhythms/defaultValue.d.ts +18 -0
- package/lib/config/rhythms/defaultValue.js +72 -0
- package/lib/config/rhythms/index.d.ts +10 -0
- package/lib/config/rhythms/index.js +35 -0
- package/lib/conflict/ConflictResolver.d.ts +2 -0
- package/lib/conflict/ConflictResolver.js +284 -0
- package/lib/conflict/__test__/ConflictResolver.test.d.ts +1 -0
- package/lib/conflict/__test__/ConflictResolver.test.js +183 -0
- package/lib/conflict/__test__/index.test.d.ts +1 -0
- package/lib/conflict/__test__/index.test.js +385 -0
- package/lib/conflict/__test__/scheduleDataManager.test.d.ts +1 -0
- package/lib/conflict/__test__/scheduleDataManager.test.js +170 -0
- package/lib/conflict/__test__/transform.test.d.ts +1 -0
- package/lib/conflict/__test__/transform.test.js +454 -0
- package/lib/conflict/__test__/updateDeviceDp.d.ts +1 -0
- package/lib/conflict/__test__/updateDeviceDp.js +114 -0
- package/lib/conflict/index.d.ts +42 -0
- package/lib/conflict/index.js +103 -0
- package/lib/conflict/scheduleDataManager.d.ts +12 -0
- package/lib/conflict/scheduleDataManager.js +79 -0
- package/lib/conflict/transform.d.ts +71 -0
- package/lib/conflict/transform.js +251 -0
- package/lib/conflict/type.d.ts +55 -0
- package/lib/conflict/type.js +17 -0
- package/lib/conflict/updateDeviceDp.d.ts +1 -0
- package/lib/conflict/updateDeviceDp.js +41 -0
- package/lib/constant/index.d.ts +5 -0
- package/lib/constant/index.js +5 -0
- package/lib/context/index.d.ts +3 -0
- package/lib/context/index.js +3 -0
- package/lib/context/rhythms/actions.d.ts +20 -0
- package/lib/context/rhythms/actions.js +52 -0
- package/lib/context/rhythms/index.d.ts +5 -0
- package/lib/context/rhythms/index.js +51 -0
- package/lib/context/rhythms/reducer.d.ts +24 -0
- package/lib/context/rhythms/reducer.js +38 -0
- package/lib/context/schedule/actions.d.ts +7 -0
- package/lib/context/schedule/actions.js +51 -0
- package/lib/context/schedule/context.d.ts +6 -0
- package/lib/context/schedule/context.js +52 -0
- package/lib/context/schedule/index.d.ts +1 -0
- package/lib/context/schedule/index.js +1 -0
- package/lib/context/schedule/reducer.d.ts +16 -0
- package/lib/context/schedule/reducer.js +104 -0
- package/lib/context/schedule/type.d.ts +41 -0
- package/lib/context/schedule/type.js +11 -0
- package/lib/context/timer/actions.d.ts +8 -0
- package/lib/context/timer/actions.js +52 -0
- package/lib/context/timer/context.d.ts +10 -0
- package/lib/context/timer/context.js +53 -0
- package/lib/context/timer/index.d.ts +1 -0
- package/lib/context/timer/index.js +1 -0
- package/lib/context/timer/reducer.d.ts +15 -0
- package/lib/context/timer/reducer.js +70 -0
- package/lib/context/timer/type.d.ts +46 -0
- package/lib/context/timer/type.js +24 -0
- package/lib/dpParser/README.md +63 -0
- package/lib/dpParser/__test__/cycle.test.d.ts +1 -0
- package/lib/dpParser/__test__/cycle.test.js +258 -0
- package/lib/dpParser/__test__/random.test.d.ts +1 -0
- package/lib/dpParser/__test__/random.test.js +211 -0
- package/lib/dpParser/__test__/rhythms.test.d.ts +1 -0
- package/lib/dpParser/__test__/rhythms.test.js +71 -0
- package/lib/dpParser/__test__/rtcTimer.test.d.ts +1 -0
- package/lib/dpParser/__test__/rtcTimer.test.js +235 -0
- package/lib/dpParser/__test__/sleep.test.d.ts +1 -0
- package/lib/dpParser/__test__/sleep.test.js +71 -0
- package/lib/dpParser/__test__/sleepCommon.test.d.ts +1 -0
- package/lib/dpParser/__test__/sleepCommon.test.js +197 -0
- package/lib/dpParser/__test__/timerReport.test.d.ts +1 -0
- package/lib/dpParser/__test__/timerReport.test.js +100 -0
- package/lib/dpParser/__test__/wakeup.test.d.ts +1 -0
- package/lib/dpParser/__test__/wakeup.test.js +69 -0
- package/lib/dpParser/__test__/wakeupCommon.test.d.ts +1 -0
- package/lib/dpParser/__test__/wakeupCommon.test.js +131 -0
- package/lib/dpParser/cycle/index.d.ts +15 -0
- package/lib/dpParser/cycle/index.js +134 -0
- package/lib/dpParser/index.d.ts +23 -0
- package/lib/dpParser/index.js +43 -0
- package/lib/dpParser/random/index.d.ts +15 -0
- package/lib/dpParser/random/index.js +127 -0
- package/lib/dpParser/rhythms.d.ts +41 -0
- package/lib/dpParser/rhythms.js +116 -0
- package/lib/dpParser/rtcTimer.d.ts +17 -0
- package/lib/dpParser/rtcTimer.js +300 -0
- package/lib/dpParser/sleep/index.d.ts +9 -0
- package/lib/dpParser/sleep/index.js +29 -0
- package/lib/dpParser/sleep/sleepCommon.d.ts +11 -0
- package/lib/dpParser/sleep/sleepCommon.js +117 -0
- package/lib/dpParser/sleep/sleepSigmesh.d.ts +0 -0
- package/lib/dpParser/sleep/sleepSigmesh.js +101 -0
- package/lib/dpParser/timerReport.d.ts +11 -0
- package/lib/dpParser/timerReport.js +43 -0
- package/lib/dpParser/utils.d.ts +27 -0
- package/lib/dpParser/utils.js +53 -0
- package/lib/dpParser/wakeup/index.d.ts +10 -0
- package/lib/dpParser/wakeup/index.js +34 -0
- package/lib/dpParser/wakeup/wakeupCommon.d.ts +11 -0
- package/lib/dpParser/wakeup/wakeupCommon.js +106 -0
- package/lib/dpParser/wakeup/wakeupSigmesh.d.ts +15 -0
- package/lib/dpParser/wakeup/wakeupSigmesh.js +86 -0
- package/lib/hooks/__test__/useCommon.test.d.ts +1 -0
- package/lib/hooks/__test__/useCommon.test.js +72 -0
- package/lib/hooks/__test__/useCountdownDp.test.d.ts +1 -0
- package/lib/hooks/__test__/useCountdownDp.test.js +82 -0
- package/lib/hooks/__test__/useCycleDp.test.d.ts +1 -0
- package/lib/hooks/__test__/useCycleDp.test.js +92 -0
- package/lib/hooks/__test__/useRandomDp.test.d.ts +1 -0
- package/lib/hooks/__test__/useRandomDp.test.js +88 -0
- package/lib/hooks/__test__/useRhythmsDp.test.d.ts +1 -0
- package/lib/hooks/__test__/useRhythmsDp.test.js +81 -0
- package/lib/hooks/__test__/useSleepDp.test.d.ts +1 -0
- package/lib/hooks/__test__/useSleepDp.test.js +127 -0
- package/lib/hooks/__test__/useTimeFlush.test.d.ts +1 -0
- package/lib/hooks/__test__/useTimeFlush.test.js +109 -0
- package/lib/hooks/__test__/useTimerDp.test.d.ts +1 -0
- package/lib/hooks/__test__/useTimerDp.test.js +79 -0
- package/lib/hooks/__test__/useTimerOperate.test.d.ts +1 -0
- package/lib/hooks/__test__/useTimerOperate.test.js +286 -0
- package/lib/hooks/__test__/useTimerOperateCloud.test.d.ts +1 -0
- package/lib/hooks/__test__/useTimerOperateCloud.test.js +190 -0
- package/lib/hooks/__test__/useTimerOperateLocal.test.d.ts +1 -0
- package/lib/hooks/__test__/useTimerOperateLocal.test.js +216 -0
- package/lib/hooks/__test__/useTimerReportDp.test.d.ts +1 -0
- package/lib/hooks/__test__/useTimerReportDp.test.js +93 -0
- package/lib/hooks/__test__/useTimerSupport.test.d.ts +1 -0
- package/lib/hooks/__test__/useTimerSupport.test.js +110 -0
- package/lib/hooks/__test__/useWakeUpDp.test.d.ts +1 -0
- package/lib/hooks/__test__/useWakeUpDp.test.js +129 -0
- package/lib/hooks/useBaseLightDp.d.ts +21 -0
- package/lib/hooks/useBaseLightDp.js +165 -0
- package/lib/hooks/useCommon.d.ts +29 -0
- package/lib/hooks/useCommon.js +59 -0
- package/lib/hooks/useCommonSupport.d.ts +25 -0
- package/lib/hooks/useCommonSupport.js +241 -0
- package/lib/hooks/useCountdownDp.d.ts +13 -0
- package/lib/hooks/useCountdownDp.js +28 -0
- package/lib/hooks/useCountdownSupport.d.ts +9 -0
- package/lib/hooks/useCountdownSupport.js +13 -0
- package/lib/hooks/useCycleDp.d.ts +7 -0
- package/lib/hooks/useCycleDp.js +21 -0
- package/lib/hooks/useCycleSupport.d.ts +12 -0
- package/lib/hooks/useCycleSupport.js +16 -0
- package/lib/hooks/useRandomDp.d.ts +7 -0
- package/lib/hooks/useRandomDp.js +21 -0
- package/lib/hooks/useRandomSupport.d.ts +12 -0
- package/lib/hooks/useRandomSupport.js +16 -0
- package/lib/hooks/useRhythmsDp.d.ts +7 -0
- package/lib/hooks/useRhythmsDp.js +23 -0
- package/lib/hooks/useSleepDp.d.ts +6 -0
- package/lib/hooks/useSleepDp.js +21 -0
- package/lib/hooks/useSleepSupport.d.ts +8 -0
- package/lib/hooks/useSleepSupport.js +13 -0
- package/lib/hooks/useTimeFlush.d.ts +8 -0
- package/lib/hooks/useTimeFlush.js +31 -0
- package/lib/hooks/useTimerDp.d.ts +5 -0
- package/lib/hooks/useTimerDp.js +25 -0
- package/lib/hooks/useTimerFlushList.d.ts +11 -0
- package/lib/hooks/useTimerFlushList.js +53 -0
- package/lib/hooks/useTimerOperate.d.ts +68 -0
- package/lib/hooks/useTimerOperate.js +403 -0
- package/lib/hooks/useTimerOperateCloud.d.ts +31 -0
- package/lib/hooks/useTimerOperateCloud.js +233 -0
- package/lib/hooks/useTimerOperateLocal.d.ts +40 -0
- package/lib/hooks/useTimerOperateLocal.js +310 -0
- package/lib/hooks/useTimerReportDp.d.ts +15 -0
- package/lib/hooks/useTimerReportDp.js +48 -0
- package/lib/hooks/useTimerSupport.d.ts +13 -0
- package/lib/hooks/useTimerSupport.js +38 -0
- package/lib/hooks/useWakeUpDp.d.ts +6 -0
- package/lib/hooks/useWakeUpDp.js +21 -0
- package/lib/hooks/useWakeUpSupport.d.ts +8 -0
- package/lib/hooks/useWakeUpSupport.js +13 -0
- package/lib/hooks/useWakeupDp.d.ts +6 -0
- package/lib/hooks/useWakeupDp.js +21 -0
- package/lib/hooks/useWakeupSupport.d.ts +8 -0
- package/lib/hooks/useWakeupSupport.js +13 -0
- package/lib/i18n/index.d.ts +142 -0
- package/lib/i18n/index.js +7 -0
- package/lib/i18n/rhythms.d.ts +73 -0
- package/lib/i18n/rhythms.js +72 -0
- package/lib/i18n/strings.d.ts +73 -0
- package/lib/i18n/strings.js +6 -0
- package/lib/index.d.ts +51 -0
- package/lib/index.js +64 -0
- package/lib/types/countdown.d.ts +3 -0
- package/lib/types/countdown.js +1 -0
- package/lib/types/cycle.d.ts +22 -0
- package/lib/types/cycle.js +1 -0
- package/lib/types/global.d.ts +9 -0
- package/lib/types/index.d.ts +331 -0
- package/lib/types/index.js +76 -0
- package/lib/types/random.d.ts +20 -0
- package/lib/types/random.js +1 -0
- package/lib/types/rhythms.d.ts +79 -0
- package/lib/types/rhythms.js +15 -0
- package/lib/types/sleep.d.ts +36 -0
- package/lib/types/sleep.js +1 -0
- package/lib/types/timer.d.ts +107 -0
- package/lib/types/timer.js +1 -0
- package/lib/types/wakeup.d.ts +38 -0
- package/lib/types/wakeup.js +1 -0
- package/lib/utils/ScheduleCache.d.ts +19 -0
- package/lib/utils/ScheduleCache.js +39 -0
- package/lib/utils/ScheduleCloudProperty.d.ts +75 -0
- package/lib/utils/ScheduleCloudProperty.js +220 -0
- package/lib/utils/ScheduleDataSync.d.ts +82 -0
- package/lib/utils/ScheduleDataSync.js +127 -0
- package/lib/utils/ScheduleEmit.d.ts +67 -0
- package/lib/utils/ScheduleEmit.js +61 -0
- package/lib/utils/ScheduleLogger.d.ts +19 -0
- package/lib/utils/ScheduleLogger.js +71 -0
- package/lib/utils/ScheduleSupport.d.ts +131 -0
- package/lib/utils/ScheduleSupport.js +373 -0
- package/lib/utils/ScheduleUtils.d.ts +12 -0
- package/lib/utils/ScheduleUtils.js +51 -0
- package/lib/utils/__test__/ScheduleCloudProperty.test.d.ts +1 -0
- package/lib/utils/__test__/ScheduleCloudProperty.test.js +320 -0
- package/lib/utils/__test__/ScheduleSupport.test.d.ts +1 -0
- package/lib/utils/__test__/ScheduleSupport.test.js +211 -0
- package/lib/utils/__test__/ScheduleUtils.test.d.ts +1 -0
- package/lib/utils/__test__/ScheduleUtils.test.js +119 -0
- package/lib/utils/__test__/common.test.d.ts +1 -0
- package/lib/utils/__test__/common.test.js +147 -0
- package/lib/utils/__test__/storage.test.d.ts +1 -0
- package/lib/utils/__test__/storage.test.js +98 -0
- package/lib/utils/__test__/time.test.d.ts +1 -0
- package/lib/utils/__test__/time.test.js +146 -0
- package/lib/utils/common.d.ts +23 -0
- package/lib/utils/common.js +109 -0
- package/lib/utils/dpState.d.ts +5 -0
- package/lib/utils/dpState.js +27 -0
- package/lib/utils/getCachedSystemInfo.d.ts +39 -0
- package/lib/utils/getCachedSystemInfo.js +20 -0
- package/lib/utils/isInIDE.d.ts +1 -0
- package/lib/utils/isInIDE.js +5 -0
- package/lib/utils/storage.d.ts +5 -0
- package/lib/utils/storage.js +32 -0
- package/lib/utils/time.d.ts +40 -0
- package/lib/utils/time.js +84 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
English | [简体中文](./README-zh_CN.md)
|
|
2
|
+
|
|
3
|
+
# @ray-js/lamp-schedule-core
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@ray-js/lamp-schedule-core) [](https://www.npmjs.com/package/@ray-js/lamp-schedule-core)
|
|
6
|
+
|
|
7
|
+
> 照明计划模块核心能力
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
$ npm install @ray-js/lamp-schedule-core
|
|
13
|
+
# or
|
|
14
|
+
$ yarn add @ray-js/lamp-schedule-core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Here's the English translation of the provided API documentation:
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## API
|
|
22
|
+
|
|
23
|
+
### useScheduleInit
|
|
24
|
+
|
|
25
|
+
- Initializes the scheduling module.
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
// Initializes the scheduling module. Since it's an asynchronous operation,
|
|
29
|
+
// wait for `isReady` to be true before using it.
|
|
30
|
+
const { isReady } = useScheduleInit({
|
|
31
|
+
devId: deviceId,
|
|
32
|
+
groupId,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (!isReady) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
// Other code
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### scheduleDpCodes
|
|
42
|
+
|
|
43
|
+
- Standard DP codes for the scheduling module.
|
|
44
|
+
|
|
45
|
+
### DP Value Retrieval and Update
|
|
46
|
+
|
|
47
|
+
#### useBaseLightDp
|
|
48
|
+
|
|
49
|
+
- Retrieves the DP value corresponding to a scheduling module DP code. This returns the raw DP value without conversion.
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { useBaseLightDp } from '@ray-js/lamp-schedule-core';
|
|
53
|
+
const { dpValue: power } = useBaseLightDp(scheduleDpCodes.SWITCH_LED);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Obtain the specific module dp value
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
// biological rhythm example, Others similar
|
|
60
|
+
import { useRhythmsDp } from '@ray-js/lamp-schedule-core';
|
|
61
|
+
const { dpValue: rhythmDpValue, updateDp: updateRhythmDpValue } = useRhythmsDp();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Regular Timer
|
|
65
|
+
|
|
66
|
+
#### TimerContextProvider
|
|
67
|
+
|
|
68
|
+
- Timer context provider, making it easy to retrieve timer data later using `useTimerContext`.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { TimerContextProvider } from '@ray-js/lamp-schedule-core';
|
|
72
|
+
|
|
73
|
+
<TimerContextProvider>
|
|
74
|
+
{/* Timer list module */}
|
|
75
|
+
<CommonTimerList />
|
|
76
|
+
</TimerContextProvider>;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Timer List
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { useTimerListFlush, TTimerData, useTimerList } from '@ray-js/lamp-schedule-core';
|
|
83
|
+
|
|
84
|
+
const { flushTimerList } = useTimerListFlush();
|
|
85
|
+
const { getTimerList } = useTimerList();
|
|
86
|
+
|
|
87
|
+
const cloudCategory = ''; // Cloud timing category value, default is timer, for details, see: [Request Parameters](https://developer.tuya.com/cn/miniapp/develop/ray/api/timer/base/addTimer#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0)
|
|
88
|
+
getTimerList()
|
|
89
|
+
.then((res: { timers?: TTimerData[] }) => {
|
|
90
|
+
const { timers } = res;
|
|
91
|
+
flushTimerList(timers);
|
|
92
|
+
// Cloud timer return value
|
|
93
|
+
if (timers) {
|
|
94
|
+
scheduleLogger.debug('getTimerList success:', res);
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
.catch(err => {
|
|
98
|
+
scheduleLogger.error('getTimerList fail:', err);
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### useTimerContext
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
const { state } = useTimerContext();
|
|
106
|
+
// Cloud timer list, RTC timer list
|
|
107
|
+
const { cloudTimerList = [], rtcTimerList = [] } = state;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### useTimerUpdateStatusWithFlush
|
|
111
|
+
|
|
112
|
+
- Updates the timer's on/off status.
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
const { updateStatusTimerWithFlush, TTimerData } = useTimerUpdateStatusWithFlush();
|
|
116
|
+
|
|
117
|
+
// Timer data
|
|
118
|
+
const detail: TTimerData = xxx;
|
|
119
|
+
|
|
120
|
+
updateStatusTimerWithFlush(detail.timerId, !detail.status)
|
|
121
|
+
.then(() => {
|
|
122
|
+
hideLoading();
|
|
123
|
+
})
|
|
124
|
+
.catch(err => {
|
|
125
|
+
scheduleLogger.error('handleSwitch, updateTimerWithFlush:', err);
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
#### Add Timer
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
const { useTimerAddWithFlush } = useTimerRemoveWithFlush();
|
|
133
|
+
|
|
134
|
+
const { addTimerWithFlush } = useTimerAddWithFlush();
|
|
135
|
+
|
|
136
|
+
const category = 'timer'; // 含义详见:[请求参数](https://developer.tuya.com/cn/miniapp/develop/ray/api/timer/base/addTimer#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0)
|
|
137
|
+
const _timer: TTimerDataAdd = {};
|
|
138
|
+
|
|
139
|
+
// Conflict detection
|
|
140
|
+
const conflict = Conflict.add({
|
|
141
|
+
type: EScheduleFunctionType.TIMER,
|
|
142
|
+
detail: [_timer as TTimerDataUpdate],
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
if (conflict.isConflict) {
|
|
146
|
+
// There's a conflict, handle with a prompt, etc.
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Add timer
|
|
150
|
+
addTimerWithFlush(_timer, category)
|
|
151
|
+
.then((newTimer: TTimerData) => {
|
|
152
|
+
hideLoading();
|
|
153
|
+
})
|
|
154
|
+
.catch(err => {
|
|
155
|
+
scheduleLogger.error('addTimerWithFlush err:', err);
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Delete Timer
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
const { removeTimerWithFlush } = useTimerRemoveWithFlush();
|
|
163
|
+
|
|
164
|
+
removeTimerWithFlush(timerId)
|
|
165
|
+
.then(() => {
|
|
166
|
+
showToast({
|
|
167
|
+
title: Strings.getLang('delete_success'),
|
|
168
|
+
icon: 'success',
|
|
169
|
+
});
|
|
170
|
+
resolve(true);
|
|
171
|
+
})
|
|
172
|
+
.catch(err => {
|
|
173
|
+
scheduleLogger.error('removeTimerWithFlush timer failed: ', err);
|
|
174
|
+
resolve(false);
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### Edit Timer
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import { useTimerUpdateWithFlush } from '@ray-js/lamp-schedule-core';
|
|
182
|
+
|
|
183
|
+
const { updateTimerWithFlush } = useTimerUpdateWithFlush();
|
|
184
|
+
|
|
185
|
+
const newTimerData: TTimerDataUpdate = {};
|
|
186
|
+
const oldTimerData: TTimerDataUpdate = {};
|
|
187
|
+
|
|
188
|
+
updateTimerWithFlush(newTimerData, oldTimerData)
|
|
189
|
+
.then(() => {
|
|
190
|
+
onClose && onClose();
|
|
191
|
+
})
|
|
192
|
+
.catch(err => {
|
|
193
|
+
hideLoading();
|
|
194
|
+
scheduleLogger.error('handleUpdateTimer, updateTimerWithFlush:', err);
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Cycle Timer
|
|
199
|
+
|
|
200
|
+
- Retrieve and update DP values.
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
const { dpValue: cycleDataDpValue, updateDp: updateCycleDpValue } = useCycleDp();
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Random Timer
|
|
207
|
+
|
|
208
|
+
- Retrieve and update DP values.
|
|
209
|
+
|
|
210
|
+
```tsx
|
|
211
|
+
const { dpValue: randomDataDpValue, updateDp: updateRandomDpValue } = useRandomDp();
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Sleep Timer
|
|
215
|
+
|
|
216
|
+
- Retrieve and update DP values.
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
const { dpValue: sleepDataDpValue, updateDp: updateSleepDpValue } = useSleepDp();
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Wake-Up Timer
|
|
223
|
+
|
|
224
|
+
- Retrieve and update DP values.
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
const { dpValue: wakeDataDpValue, updateDp: updateWakeUpDpValue } = useWakeUpDp();
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Countdown
|
|
231
|
+
|
|
232
|
+
#### useCountdownDp
|
|
233
|
+
|
|
234
|
+
- Retrieves countdown DP values and supports DP updates.
|
|
235
|
+
|
|
236
|
+
```tsx
|
|
237
|
+
import { useCountdownDp } from '@ray-js/lamp-schedule-core';
|
|
238
|
+
const { dpValue: countdownDpValue, updateDp: updateCountdownDpValue } = useCountdownDp();
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
#### useCountdownDpPull
|
|
242
|
+
|
|
243
|
+
- Actively pulls countdown DP data, typically used for Sigmesh devices.
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
useCountdownDpPull();
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Conflict Detection: Used to determine if the currently set schedule conflicts with previously set schedules.
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import { Conflict } from '@ray-js/lamp-schedule-core';
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Initialization: init
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
import { Conflict } from '@ray-js/lamp-schedule-core';
|
|
261
|
+
// Since modules might be scattered, init can be executed multiple times.
|
|
262
|
+
// It will accumulate and deduplicate entries.
|
|
263
|
+
Conflict.init([
|
|
264
|
+
{
|
|
265
|
+
// Conflict type
|
|
266
|
+
type: EScheduleFunctionType.RHYTHM,
|
|
267
|
+
// Conflicting DP value, here taking biological rhythm DP as an example
|
|
268
|
+
detail: [
|
|
269
|
+
{
|
|
270
|
+
...rhythmDpValue,
|
|
271
|
+
weeks,
|
|
272
|
+
status: rhythmDpValue?.power,
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
]);
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Add: add
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
const { isConflict, conflictList } = Conflict.add({
|
|
283
|
+
// Conflict type
|
|
284
|
+
type: EScheduleFunctionType.COUNTDOWN,
|
|
285
|
+
// Conflicting DP value, here taking countdown DP as an example
|
|
286
|
+
detail: [
|
|
287
|
+
{
|
|
288
|
+
countdown: _countdownValue,
|
|
289
|
+
status: !!_countdownValue,
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
if (isConflict) {
|
|
295
|
+
// There's a conflict, handle with a prompt, etc.
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
// Other code
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Update: update
|
|
302
|
+
|
|
303
|
+
```tsx
|
|
304
|
+
const { isConflict, conflictList = [] } = Conflict.update(
|
|
305
|
+
{
|
|
306
|
+
// Conflict type
|
|
307
|
+
type: EScheduleFunctionType.TIMER,
|
|
308
|
+
detail: [_newTimer],
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
// Conflict type
|
|
312
|
+
type: EScheduleFunctionType.TIMER,
|
|
313
|
+
detail: [timer],
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
if (isConflict) {
|
|
317
|
+
// There's a conflict, handle with a prompt, etc.
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Remove: remove
|
|
323
|
+
|
|
324
|
+
```tsx
|
|
325
|
+
// When deleting a module within a schedule, the corresponding module's conflict data needs to be removed.
|
|
326
|
+
Conflict.remove({
|
|
327
|
+
// Conflict type
|
|
328
|
+
type: EScheduleFunctionType.TIMER,
|
|
329
|
+
detail: [item as TTimerData],
|
|
330
|
+
});
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Supported Capabilities
|
|
336
|
+
|
|
337
|
+
### Initialization
|
|
338
|
+
|
|
339
|
+
```tsx
|
|
340
|
+
// Method 1:
|
|
341
|
+
import { Support } from '@ray-js/lamp-schedule-core/lib/utils/ScheduleSupport';
|
|
342
|
+
const support = new Support({ devId: devInfo.devId });
|
|
343
|
+
|
|
344
|
+
// Method 2:
|
|
345
|
+
|
|
346
|
+
import { useSupport } from '@ray-js/lamp-schedule-core';
|
|
347
|
+
|
|
348
|
+
const support = useSupport();
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### isSupportDp
|
|
352
|
+
|
|
353
|
+
```tsx
|
|
354
|
+
// Determine if countdown is supported based on the dpCode.
|
|
355
|
+
const isSupportCountdown = support.isSupportDp(scheduleDpCodes.COUNTDOWN);
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### isGroupDevice
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
// Determine if it's a group device.
|
|
362
|
+
const isGroup = support.isGroupDevice();
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### isSigMeshDevice
|
|
366
|
+
|
|
367
|
+
```tsx
|
|
368
|
+
// Determine if it's a Sigmesh device.
|
|
369
|
+
const isSigMesh = support.isSigMeshDevice();
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### getDevInfo
|
|
373
|
+
|
|
374
|
+
```tsx
|
|
375
|
+
// Get device information.
|
|
376
|
+
const devInfo = support.getDevInfo();
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### useSupportCloudTimer: Determine if cloud timers are supported.
|
|
380
|
+
|
|
381
|
+
```tsx
|
|
382
|
+
const isSupportCloudTimer = useSupportCloudTimer();
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### useSupportRtcTimer: Determine if RTC timers are supported.
|
|
386
|
+
|
|
387
|
+
```tsx
|
|
388
|
+
const isSupportLocalTimer = useSupportLocalTimer();
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Other Capabilities
|
|
392
|
+
|
|
393
|
+
```tsx
|
|
394
|
+
import { useHourType, getSupportIns } from '@ray-js/lamp-schedule-core';
|
|
395
|
+
// Whether it's 12-hour format.
|
|
396
|
+
const { is12Hour } = useHourType();
|
|
397
|
+
// Get Support instance, for use in non-functional components.
|
|
398
|
+
const support = getSupportIns();
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
## DP Parsers
|
|
402
|
+
|
|
403
|
+
### getCycleParser - Periodic Timer DP Parser Function
|
|
404
|
+
|
|
405
|
+
```ts
|
|
406
|
+
const cycleParser = getCycleParser();
|
|
407
|
+
|
|
408
|
+
// Parse
|
|
409
|
+
cycleParser.parser();
|
|
410
|
+
// Unparse
|
|
411
|
+
cycleParser.formatter();
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### getRandomParser - Random Timer DP Parser Function
|
|
415
|
+
|
|
416
|
+
```ts
|
|
417
|
+
const randomParser = getRandomParser();
|
|
418
|
+
|
|
419
|
+
// Parse
|
|
420
|
+
randomParser.parser();
|
|
421
|
+
// Unparse
|
|
422
|
+
randomParser.formatter();
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### getSleepParser - Sleep Timer DP Parser Function
|
|
426
|
+
|
|
427
|
+
```ts
|
|
428
|
+
const sleepParser = getSleepParser();
|
|
429
|
+
|
|
430
|
+
// Parse
|
|
431
|
+
sleepParser.parser();
|
|
432
|
+
// Unparse
|
|
433
|
+
sleepParser.formatter();
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### getWakeupParser - Wake-up Timer DP Parser Function
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
const wakeupParser = getWakeUpParser();
|
|
440
|
+
|
|
441
|
+
// Parse
|
|
442
|
+
wakeupParser.parser();
|
|
443
|
+
// Unparse
|
|
444
|
+
wakeupParser.formatter();
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### getRhythmParser - Biological Rhythm Timer DP Parser Function
|
|
448
|
+
|
|
449
|
+
```ts
|
|
450
|
+
const rhythmsParser = getRhythmParser();
|
|
451
|
+
|
|
452
|
+
// Parse
|
|
453
|
+
rhythmsParser.parser();
|
|
454
|
+
// Unparse
|
|
455
|
+
rhythmsParser.formatter();
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### getRtcParser - Local Timer DP Parser Function
|
|
459
|
+
|
|
460
|
+
```ts
|
|
461
|
+
const rtcParser = getRtcParser();
|
|
462
|
+
|
|
463
|
+
// Parse
|
|
464
|
+
rtcParser.parser();
|
|
465
|
+
// Unparse
|
|
466
|
+
rtcParser.formatter();
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
## Specific Usage
|
|
470
|
+
|
|
471
|
+
### 1. Initializing Schedule Module Capabilities
|
|
472
|
+
|
|
473
|
+
```tsx
|
|
474
|
+
import { useScheduleInit } from '@ray-js/lamp-schedule-core';
|
|
475
|
+
const { isReady } = useScheduleInit({
|
|
476
|
+
devId: deviceId,
|
|
477
|
+
groupId,
|
|
478
|
+
});
|
|
479
|
+
if (!isReady) {
|
|
480
|
+
return null;
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### 2\. Selecting the Capability to Develop
|
|
485
|
+
|
|
486
|
+
```tsx
|
|
487
|
+
// Taking the sleep module as an example
|
|
488
|
+
import { useSleepDp, TSleepData } from '@ray-js/lamp-schedule-core';
|
|
489
|
+
|
|
490
|
+
// 2.0 Check if the sleep module is supported
|
|
491
|
+
const support = useSupport();
|
|
492
|
+
// Check if the sleep DP (data point) is supported
|
|
493
|
+
const isSupportSleep = support.isSupportDp(scheduleDpCodes.SLEEP);
|
|
494
|
+
if (!isSupportSleep) {
|
|
495
|
+
// If not supported, return directly or don't display on the page
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// 2.1 Get the DP value
|
|
500
|
+
const { dpValue: sleepDpValue, updateDp: updateSleepDpValue } = useSleepDp<TSleepData>();
|
|
501
|
+
|
|
502
|
+
// The sleep DP data is obtained; refer to TSleepData for the specific format.
|
|
503
|
+
// 2.2 Add sleep DP data
|
|
504
|
+
// 2.2.1 Before saving, check for conflicts
|
|
505
|
+
// sleepDpValue is of type TSleepData
|
|
506
|
+
const restDp = {}; // Modified sleep value
|
|
507
|
+
const newNode: TSleepData = {
|
|
508
|
+
...sleepDpValue,
|
|
509
|
+
...restDp,
|
|
510
|
+
status: true,
|
|
511
|
+
};
|
|
512
|
+
const { isConflict, conflictList = [] } = Conflict.add({
|
|
513
|
+
// Conflict type
|
|
514
|
+
type: EScheduleFunctionType.SLEEP,
|
|
515
|
+
// Conflict DP value; here, the sleep DP is used as an example
|
|
516
|
+
detail: [newNode],
|
|
517
|
+
});
|
|
518
|
+
if (isConflict) {
|
|
519
|
+
// If there's a conflict, prompt for resolution
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
// 2.2.2 Get the new sleepDpValue from useSleepDp (which automatically refreshes the value) to refresh the page display.
|
|
523
|
+
|
|
524
|
+
// 2.3 Edit and update sleep DP data
|
|
525
|
+
// 2.3.1 Before saving, check for conflicts
|
|
526
|
+
// sleepDpValue is of type TSleepData
|
|
527
|
+
const restDp = {}; // Modified sleep value
|
|
528
|
+
const newNode: TSleepData = {
|
|
529
|
+
...sleepDpValue,
|
|
530
|
+
...restDp,
|
|
531
|
+
status: true,
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
const { isConflict, conflictList = [] } = Conflict.update(
|
|
535
|
+
{
|
|
536
|
+
type: EScheduleFunctionType.SLEEP,
|
|
537
|
+
// New node
|
|
538
|
+
detail: [newNode],
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
type: EScheduleFunctionType.SLEEP,
|
|
542
|
+
// Currently edited node
|
|
543
|
+
detail: [sleepDataDpValue.nodes?.[sleepData?.index]],
|
|
544
|
+
}
|
|
545
|
+
);
|
|
546
|
+
if (isConflict) {
|
|
547
|
+
// If there's a conflict, prompt for resolution
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
// 2.3.2 Get the new sleepDpValue from useSleepDp (which automatically refreshes the value) to refresh the page display.
|
|
551
|
+
|
|
552
|
+
// 2.4 Delete sleep DP data
|
|
553
|
+
// 2.4.1 When saving, first remove the data
|
|
554
|
+
const index = xx; // Index of the selected node to be deleted
|
|
555
|
+
const currentNode = sleepDataDpValue?.nodes?.[index];
|
|
556
|
+
if (currentNode) {
|
|
557
|
+
Conflict.remove({
|
|
558
|
+
type: EScheduleFunctionType.SLEEP,
|
|
559
|
+
detail: [currentNode],
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
// 2.4.2 After successful deletion, useSleepDp (which automatically refreshes the value) to get the new sleepDpValue to refresh the page display.
|
|
563
|
+
|
|
564
|
+
// The "sleep module" above serves as an example to demonstrate the CRUD (Create, Read, Update, Delete) capabilities of module functions. Other modules are used similarly.
|
|
565
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const scheduleDpCodes: {
|
|
2
|
+
readonly SWITCH_LED: "switch_led";
|
|
3
|
+
/** 倒计时 */
|
|
4
|
+
readonly COUNTDOWN: "countdown";
|
|
5
|
+
/** 随机定时 or 灯光看家 */
|
|
6
|
+
readonly RANDOM_TIMING: "random_timing";
|
|
7
|
+
/** 生物节律 */
|
|
8
|
+
readonly RHYTHM_MODE: "rhythm_mode";
|
|
9
|
+
/** 灯光助眠 */
|
|
10
|
+
readonly SLEEP_MODE: "sleep_mode";
|
|
11
|
+
/** 灯光唤醒 */
|
|
12
|
+
readonly WAKE_UP_MODE: "wakeup_mode";
|
|
13
|
+
/** 循环定时 */
|
|
14
|
+
readonly CYCLE_TIMING: "cycle_timing";
|
|
15
|
+
/** 通用本地定时 */
|
|
16
|
+
readonly LOCAL_TIMER: "local_timer";
|
|
17
|
+
/** 灯带本地定时 */
|
|
18
|
+
readonly STRIP_LOCAL_TIMER: "strip_local_timer";
|
|
19
|
+
/** 定时同步 一般用于 Beacon */
|
|
20
|
+
readonly TIMER_SYNC: "timer_sync";
|
|
21
|
+
/** 定时状态上报 Sigmesh本地定时 */
|
|
22
|
+
readonly TIMER_REPORT: "timer_report";
|
|
23
|
+
/** Rtc定时 */
|
|
24
|
+
readonly RTC_TIMER: "rtc_timer";
|
|
25
|
+
/** 色温 */
|
|
26
|
+
readonly TEMPERATURE: "temp_value";
|
|
27
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EScheduleType } from '../types';
|
|
2
|
+
|
|
3
|
+
// 整体计划模块的 dp 映射表
|
|
4
|
+
export const scheduleDpCodes = {
|
|
5
|
+
[EScheduleType.SWITCH_LED]: 'switch_led',
|
|
6
|
+
/** 倒计时 */
|
|
7
|
+
[EScheduleType.COUNTDOWN]: 'countdown',
|
|
8
|
+
/** 随机定时 or 灯光看家 */
|
|
9
|
+
[EScheduleType.RANDOM_TIMING]: 'random_timing',
|
|
10
|
+
/** 生物节律 */
|
|
11
|
+
[EScheduleType.RHYTHM_MODE]: 'rhythm_mode',
|
|
12
|
+
/** 灯光助眠 */
|
|
13
|
+
[EScheduleType.SLEEP_MODE]: 'sleep_mode',
|
|
14
|
+
/** 灯光唤醒 */
|
|
15
|
+
[EScheduleType.WAKE_UP_MODE]: 'wakeup_mode',
|
|
16
|
+
/** 循环定时 */
|
|
17
|
+
[EScheduleType.CYCLE_TIMING]: 'cycle_timing',
|
|
18
|
+
/** 通用本地定时 */
|
|
19
|
+
[EScheduleType.LOCAL_TIMER]: 'local_timer',
|
|
20
|
+
/** 灯带本地定时 */
|
|
21
|
+
[EScheduleType.STRIP_LOCAL_TIMER]: 'strip_local_timer',
|
|
22
|
+
/** 定时同步 一般用于 Beacon */
|
|
23
|
+
[EScheduleType.TIMER_SYNC]: 'timer_sync',
|
|
24
|
+
/** 定时状态上报 Sigmesh本地定时 */
|
|
25
|
+
[EScheduleType.TIMER_REPORT]: 'timer_report',
|
|
26
|
+
/** Rtc定时 */
|
|
27
|
+
[EScheduleType.RTC_TIMER]: 'rtc_timer',
|
|
28
|
+
/** 色温 */
|
|
29
|
+
TEMPERATURE: 'temp_value'
|
|
30
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const defaultValue: {
|
|
2
|
+
key: number;
|
|
3
|
+
version: number;
|
|
4
|
+
power: boolean;
|
|
5
|
+
mode: number;
|
|
6
|
+
weeks: number[];
|
|
7
|
+
number: number;
|
|
8
|
+
rhythms: {
|
|
9
|
+
power: boolean;
|
|
10
|
+
hour: number;
|
|
11
|
+
minute: number;
|
|
12
|
+
hue: number;
|
|
13
|
+
saturation: number;
|
|
14
|
+
value: number;
|
|
15
|
+
brightness: number;
|
|
16
|
+
temperature: number;
|
|
17
|
+
}[];
|
|
18
|
+
}[];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export const defaultValue = [0, 1, 2].map((item, i) => {
|
|
2
|
+
const power = true;
|
|
3
|
+
return {
|
|
4
|
+
key: item,
|
|
5
|
+
// 标识
|
|
6
|
+
version: 0,
|
|
7
|
+
power: true,
|
|
8
|
+
mode: 0,
|
|
9
|
+
// 两节点之间一直渐变
|
|
10
|
+
weeks: [1, 1, 1, 1, 1, 1, 1, 0],
|
|
11
|
+
number: i === 1 ? 5 : 6,
|
|
12
|
+
rhythms: [
|
|
13
|
+
// 隐藏节点
|
|
14
|
+
{
|
|
15
|
+
power,
|
|
16
|
+
hour: 6,
|
|
17
|
+
minute: 0,
|
|
18
|
+
hue: 0,
|
|
19
|
+
saturation: 0,
|
|
20
|
+
value: 0,
|
|
21
|
+
brightness: 0,
|
|
22
|
+
temperature: 100
|
|
23
|
+
}, {
|
|
24
|
+
power,
|
|
25
|
+
hour: 6,
|
|
26
|
+
minute: 30,
|
|
27
|
+
hue: 0,
|
|
28
|
+
saturation: 0,
|
|
29
|
+
value: 0,
|
|
30
|
+
brightness: 100,
|
|
31
|
+
temperature: 50
|
|
32
|
+
}, {
|
|
33
|
+
power,
|
|
34
|
+
hour: 11,
|
|
35
|
+
minute: 30,
|
|
36
|
+
hue: 0,
|
|
37
|
+
saturation: 0,
|
|
38
|
+
value: 0,
|
|
39
|
+
brightness: 100,
|
|
40
|
+
temperature: 100
|
|
41
|
+
}, {
|
|
42
|
+
power,
|
|
43
|
+
hour: 17,
|
|
44
|
+
minute: 0,
|
|
45
|
+
hue: 0,
|
|
46
|
+
saturation: 0,
|
|
47
|
+
value: 0,
|
|
48
|
+
brightness: 70,
|
|
49
|
+
temperature: 50
|
|
50
|
+
},
|
|
51
|
+
// 隐藏节点
|
|
52
|
+
{
|
|
53
|
+
power,
|
|
54
|
+
hour: 20,
|
|
55
|
+
minute: 30,
|
|
56
|
+
hue: 0,
|
|
57
|
+
saturation: 0,
|
|
58
|
+
value: 0,
|
|
59
|
+
brightness: 70,
|
|
60
|
+
temperature: 50
|
|
61
|
+
}, {
|
|
62
|
+
power,
|
|
63
|
+
hour: 21,
|
|
64
|
+
minute: 0,
|
|
65
|
+
hue: 0,
|
|
66
|
+
saturation: 0,
|
|
67
|
+
value: 0,
|
|
68
|
+
brightness: 0,
|
|
69
|
+
temperature: 0
|
|
70
|
+
}]
|
|
71
|
+
};
|
|
72
|
+
});
|