@ray-js/lamp-schedule-core 1.0.1-beta-3 → 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.
@@ -68,19 +68,24 @@ export const useScheduleInit = props => {
68
68
  // eslint-disable-next-line consistent-return
69
69
  useEffect(() => {
70
70
  if (_isInit) {
71
+ ScheduleLogger.info('useScheduleInit is already initialized');
71
72
  return null;
72
73
  }
73
- if (props.devId) {
74
- registerDeviceListListener({
75
- deviceIdList: [props.devId],
76
- success: () => {
74
+ ScheduleLogger.info('useScheduleInit props: ', props);
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);
77
82
  // 监听dp值变化 并触发
78
83
 
79
84
  if (_isInit) {
80
85
  ScheduleLogger.warn('useSupport: support is already initialized');
81
86
  return;
82
87
  }
83
- onDpDataChange(res => {
88
+ onGroupDpDataChangeEvent(res => {
84
89
  if (!(res !== null && res !== void 0 && res.dps)) {
85
90
  ScheduleLogger.warn(`useScheduleInit fail ${DP_CHANGE_EVENT_KEY}`, res);
86
91
  return;
@@ -91,12 +96,15 @@ export const useScheduleInit = props => {
91
96
  dps: res === null || res === void 0 ? void 0 : res.dps
92
97
  });
93
98
  });
99
+ },
100
+ fail(err) {
101
+ ScheduleLogger.error('useScheduleInit registerGroupChange fail', err);
94
102
  }
95
103
  });
96
- }
97
- if (props.groupId) {
98
- registerGroupChange({
99
- groupIdList: [props.groupId],
104
+ } else if (props.devId) {
105
+ ScheduleLogger.info('useScheduleInit registerDeviceListListener devId: ', props.devId);
106
+ registerDeviceListListener({
107
+ deviceIdList: [props.devId],
100
108
  success: () => {
101
109
  // 监听dp值变化 并触发
102
110
 
@@ -104,7 +112,7 @@ export const useScheduleInit = props => {
104
112
  ScheduleLogger.warn('useSupport: support is already initialized');
105
113
  return;
106
114
  }
107
- onGroupDpDataChangeEvent(res => {
115
+ onDpDataChange(res => {
108
116
  if (!(res !== null && res !== void 0 && res.dps)) {
109
117
  ScheduleLogger.warn(`useScheduleInit fail ${DP_CHANGE_EVENT_KEY}`, res);
110
118
  return;
@@ -115,6 +123,9 @@ export const useScheduleInit = props => {
115
123
  dps: res === null || res === void 0 ? void 0 : res.dps
116
124
  });
117
125
  });
126
+ },
127
+ fail(err) {
128
+ ScheduleLogger.error('useScheduleInit registerDeviceListListener fail', err);
118
129
  }
119
130
  });
120
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-schedule-core",
3
- "version": "1.0.1-beta-3",
3
+ "version": "1.0.1-beta-5",
4
4
  "description": "照明计划模块核心能力",
5
5
  "main": "./lib/index.js",
6
6
  "files": [