@ray-js/lamp-schedule-core 1.0.1-beta-4 → 1.0.1-beta-5
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/lib/hooks/useCommonSupport.js +16 -16
- package/package.json +1 -1
|
@@ -72,18 +72,20 @@ export const useScheduleInit = props => {
|
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
74
|
ScheduleLogger.info('useScheduleInit props: ', props);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
// 必须先注册群组,再注册设备, 群组中也存在 devId
|
|
76
|
+
if (props.groupId) {
|
|
77
|
+
ScheduleLogger.info('useScheduleInit registerGroupChange groupId: ', props.groupId);
|
|
78
|
+
registerGroupChange({
|
|
79
|
+
groupIdList: [props.groupId],
|
|
80
|
+
success(res) {
|
|
81
|
+
ScheduleLogger.info('useScheduleInit registerGroupChange success: ', res);
|
|
80
82
|
// 监听dp值变化 并触发
|
|
81
83
|
|
|
82
84
|
if (_isInit) {
|
|
83
85
|
ScheduleLogger.warn('useSupport: support is already initialized');
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
|
-
|
|
88
|
+
onGroupDpDataChangeEvent(res => {
|
|
87
89
|
if (!(res !== null && res !== void 0 && res.dps)) {
|
|
88
90
|
ScheduleLogger.warn(`useScheduleInit fail ${DP_CHANGE_EVENT_KEY}`, res);
|
|
89
91
|
return;
|
|
@@ -96,23 +98,21 @@ export const useScheduleInit = props => {
|
|
|
96
98
|
});
|
|
97
99
|
},
|
|
98
100
|
fail(err) {
|
|
99
|
-
ScheduleLogger.error('useScheduleInit
|
|
101
|
+
ScheduleLogger.error('useScheduleInit registerGroupChange fail', err);
|
|
100
102
|
}
|
|
101
103
|
});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
success(res) {
|
|
108
|
-
ScheduleLogger.info('useScheduleInit registerGroupChange success: ', res);
|
|
104
|
+
} else if (props.devId) {
|
|
105
|
+
ScheduleLogger.info('useScheduleInit registerDeviceListListener devId: ', props.devId);
|
|
106
|
+
registerDeviceListListener({
|
|
107
|
+
deviceIdList: [props.devId],
|
|
108
|
+
success: () => {
|
|
109
109
|
// 监听dp值变化 并触发
|
|
110
110
|
|
|
111
111
|
if (_isInit) {
|
|
112
112
|
ScheduleLogger.warn('useSupport: support is already initialized');
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
onDpDataChange(res => {
|
|
116
116
|
if (!(res !== null && res !== void 0 && res.dps)) {
|
|
117
117
|
ScheduleLogger.warn(`useScheduleInit fail ${DP_CHANGE_EVENT_KEY}`, res);
|
|
118
118
|
return;
|
|
@@ -125,7 +125,7 @@ export const useScheduleInit = props => {
|
|
|
125
125
|
});
|
|
126
126
|
},
|
|
127
127
|
fail(err) {
|
|
128
|
-
ScheduleLogger.error('useScheduleInit
|
|
128
|
+
ScheduleLogger.error('useScheduleInit registerDeviceListListener fail', err);
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
}
|