@ray-js/lamp-schedule-core 1.0.1-beta-5 → 1.0.1-beta-6

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.
@@ -31,7 +31,7 @@ export function useBaseLightDp(dpCode, defaultDpValue) {
31
31
  if (+dpCode !== +dpCode) {
32
32
  dpId = getDpIdByDpCode(dpCode);
33
33
  }
34
- if (dpData.deviceId === deviceId && dpId in dpData.dps) {
34
+ if (dpId in dpData.dps) {
35
35
  scheduleLogger.debug(`${dpCode} ==> emitter will changed:`, dpData);
36
36
  const _dpValue = dpData.dps[dpId];
37
37
  if (isEqual(preDpValue.current, _dpValue)) {
@@ -105,13 +105,18 @@ export const getDpDataByMesh = function () {
105
105
  if (dpCodes.length >= 5) {
106
106
  scheduleLogger.warn('getDpDataByMesh: 单次查询 dp 数过多,dp 可能响应不及时,请分次查询');
107
107
  }
108
- scheduleLogger.debug('getDpDataByMesh 开始查询DP参数 dpCodes:', dpCodes);
109
108
  const deviceData = devIdOrGroupIdCache.get();
110
109
  const deviceId = deviceData === null || deviceData === void 0 ? void 0 : deviceData.devId;
110
+ const groupId = deviceData === null || deviceData === void 0 ? void 0 : deviceData.groupId;
111
+ if (groupId) {
112
+ scheduleLogger.error('getDpDataByMesh: 群组中不支持查询dp');
113
+ return;
114
+ }
111
115
  if (!deviceId) {
112
116
  scheduleLogger.error('getDpDataByMesh: 未能获取到deviceId');
113
117
  return;
114
118
  }
119
+ scheduleLogger.debug('getDpDataByMesh 开始查询DP参数 dpCodes:', dpCodes);
115
120
  const dpIds = dpCodes.map(item => getDpIdByDpCode(item)).filter(i => !!i).map(String); // 简化字符串转换
116
121
 
117
122
  if (dpIds.length === 0) {
@@ -92,7 +92,7 @@ export const useScheduleInit = props => {
92
92
  }
93
93
  ScheduleLogger.info(`useScheduleInit ${DP_CHANGE_EVENT_KEY}`, res);
94
94
  emitter.emit(DP_CHANGE_EVENT_KEY, {
95
- deviceId: res.devId || res.deviceId,
95
+ deviceId: res.devId || res.deviceId || res.groupId,
96
96
  dps: res === null || res === void 0 ? void 0 : res.dps
97
97
  });
98
98
  });
@@ -103,7 +103,13 @@ export class Support {
103
103
  setScheduleCache(DEV_INFO_KEY, res);
104
104
  // 群组中为空
105
105
  groupId && (devIdOrGroupIdCache === null || devIdOrGroupIdCache === void 0 ? void 0 : devIdOrGroupIdCache.set('', groupId));
106
- resolve(true);
106
+ const dpMap = {};
107
+ Object.keys(res.dps).forEach(dpId => {
108
+ const dpCode = getDpCodeByDpId(dpId);
109
+ dpCode && setDpState(dpCode, res.dps[dpId]);
110
+ });
111
+ Object.keys(dpMap).length && initDpState(dpMap);
112
+ resolve(res);
107
113
  },
108
114
  fail: err => {
109
115
  this.groupDevInfo = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-schedule-core",
3
- "version": "1.0.1-beta-5",
3
+ "version": "1.0.1-beta-6",
4
4
  "description": "照明计划模块核心能力",
5
5
  "main": "./lib/index.js",
6
6
  "files": [