@ray-js/api 1.6.0 → 1.6.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/@types/api.d.ts CHANGED
@@ -2,4 +2,5 @@
2
2
  /// <reference path="./api-extend.d.ts" />
3
3
  /// <reference path="./api-cloud.d.ts" />
4
4
  /// <reference path="./gateway.d.ts" />
5
- /// <reference path="./health.d.ts" />
5
+ /// <reference path="./health.d.ts" />
6
+ /// <reference path="./energy.d.ts" />
@@ -0,0 +1,250 @@
1
+ declare namespace ty.energy {
2
+ // 1. 单设备多指标汇总查询
3
+ type GetDeviceDataMultipleSumParams = {
4
+ devId: string // 设备id
5
+ indicatorCodes: string // 维度
6
+ dateType: 'day' | 'week' | 'month' | 'year' // 日期类型
7
+ beginDate: string // 开始日期
8
+ endDate: string // 结束日期
9
+ }
10
+
11
+ type GetDeviceDataMultipleSumResponse = {
12
+ [key: string]: string
13
+ }
14
+
15
+ function getDeviceDataMultipleSum(
16
+ params: GetDeviceDataMultipleSumParams
17
+ ): Promise<GetDeviceDataMultipleSumResponse>
18
+
19
+ // 2. 查询逆变器设备信息
20
+ type GetInverterDeviceInfoParams = {
21
+ devId: string // 设备id
22
+ }
23
+
24
+ type GetInverterDeviceInfoResponse = {
25
+ inverterDailyCharge: string // 当日充电量
26
+ inverterDailyDischarge: string // 当日放电量
27
+ inverterEsTotalCharge: string // 累计充电量
28
+ inverterEsTotalDischarge: string // 累计放电量
29
+ inverterSoc: string // 当天电量
30
+ inverterSoh: string // 电池健康度
31
+ inverterStatus: string // 逆变器状态
32
+ inverterWorkMode: string // 能源模式
33
+ }
34
+
35
+ function getInverterDeviceInfo(
36
+ params: GetInverterDeviceInfoParams
37
+ ): Promise<GetInverterDeviceInfoResponse>
38
+
39
+ // 3. 查询逆变器仪表盘信息
40
+ type GetInverterPanelInfoParams = {
41
+ devId: string // 设备id
42
+ }
43
+
44
+ type GetInverterPanelInfoResponse = {
45
+ eleProduce: string // 当天发电量
46
+ inverterWorkModeSetting: string // 能源模式
47
+ netOutput: string // 净输出
48
+ score: string // 得分
49
+ inverterDcVoltage1: string // 1号当前电压
50
+ inverterDcCurrent1: string // 1号当前电流
51
+ inverterPv1InputPower: string // 1号当前功率
52
+ inverterDcVoltage2: string // 2号当前电压
53
+ inverterDcCurrent2: string // 2号当前电流
54
+ inverterPv2InputPower: string // 2号当前功率
55
+ inverterDcVoltage3: string // 3号当前电压
56
+ inverterDcCurrent3: string // 3号当前电流
57
+ inverterPv3InputPower: string // 3号当前功率
58
+ inverterDcVoltage4: string // 4号当前电压
59
+ inverterDcCurrent4: string // 4号当前电流
60
+ inverterPv4InputPower: string // 4号当前功率
61
+ }
62
+
63
+ function getInverterPanelInfo(
64
+ params: GetInverterPanelInfoParams
65
+ ): Promise<GetInverterPanelInfoResponse>
66
+
67
+ // 4. 查询流向图功率
68
+ type GetInverterFlowInfoParams = {
69
+ devId: string // 设备id
70
+ }
71
+
72
+ type GetInverterFlowInfoResponse = {
73
+ loadPower: string // 负载功率
74
+ pvPower: string // pv功率
75
+ }
76
+
77
+ function getInverterFlowInfo(
78
+ params: GetInverterFlowInfoParams
79
+ ): Promise<GetInverterFlowInfoResponse>
80
+
81
+ // 5. 获取设备属性
82
+ type GetPropertyInfoParams = {
83
+ devId: string // 设备id
84
+ bizType: number // bizType类型
85
+ code: string // 能力code
86
+ }
87
+
88
+ type GetPropertyInfoResponse = {
89
+ value: string // 装机容量
90
+ }[]
91
+
92
+ function getPropertyInfo(params: GetPropertyInfoParams): Promise<GetPropertyInfoResponse>
93
+
94
+ // 6. 保存设备属性
95
+ type SavePropertyParams = {
96
+ devId: string // 设备id
97
+ bizType: number // bizType类型
98
+ code: string // 能力code
99
+ value: string // 装机容量
100
+ }
101
+
102
+ type SavePropertyResponse = boolean
103
+
104
+ function saveProperty(params: SavePropertyParams): Promise<SavePropertyResponse>
105
+
106
+ // 7. 查询EMS系统设备故障事件列表
107
+ type GetDeviceAlarmEventParams = {
108
+ devId: string // 设备id
109
+ brandCode?: string // 品牌商标识(kkt)可选
110
+ weight: number // 目前事件多语言名称权重为1,事件起因多语言权重为3,事件解决方案多语言权重为5
111
+ startTime: number // 开始时间戳
112
+ endTime: number // 结束时间戳
113
+ eventType: 'fault' | 'alarm' // 事件类型 alarm 阈值告警/fault 故障告警
114
+ eventStatus: 0 | 1 // 事件状态 0 已恢复/1 未恢复
115
+ pageNum: number // 当前页
116
+ pageSize: number // 页数
117
+ }
118
+
119
+ type GetDeviceAlarmEventResponse = {
120
+ data: {
121
+ deviceId: string // 设备ID
122
+ startTime: number // 开始时间戳
123
+ endTime: number // 结束时间戳
124
+ name: string // 事件名称
125
+ desc: string // 事件描述
126
+ }[]
127
+ }
128
+
129
+ function getDeviceAlarmEvent(
130
+ params: GetDeviceAlarmEventParams
131
+ ): Promise<GetDeviceAlarmEventResponse>
132
+
133
+ // 8. 查询EMS系统设备故障事件详情
134
+ type GetDeviceAlarmEventDetailParams = {
135
+ devId: string // 设备id
136
+ brandCode?: string // 品牌商标识(kkt)可选
137
+ weight: number // 目前事件多语言名称权重为1,事件起因多语言权重为3,事件解决方案多语言权重为5
138
+ eventId: string // 事件ID
139
+ }
140
+
141
+ type GetDeviceAlarmEventDetailResponse = {
142
+ name: string // 事件名称
143
+ eventSolution: string // 解决方案
144
+ startTime: number // 开始时间戳
145
+ endTime: number // 结束时间戳
146
+ }
147
+
148
+ function getDeviceAlarmEventDetail(
149
+ params: GetDeviceAlarmEventDetailParams
150
+ ): Promise<GetDeviceAlarmEventDetailResponse>
151
+
152
+ // 9. 炭排放查询
153
+ type GetDeviceEnergySavingDataParams = {
154
+ devId: string // 设备id
155
+ phoneCode: string // 国家手机号前缀/或国家码 如德国DE 优先填写国家码,部分国家的手机号前缀一样
156
+ types: string // 节能数据类型: 1.碳排放(吨) 2.煤炭节约量(吨) 3.等效植树量(棵) 5.三口之家1天用电(天)
157
+ }
158
+
159
+ type GetDeviceEnergySavingDataResponse = {
160
+ type: string
161
+ value: string
162
+ }[]
163
+
164
+ function getDeviceEnergySavingData(
165
+ params: GetDeviceEnergySavingDataParams
166
+ ): Promise<GetDeviceEnergySavingDataResponse>
167
+
168
+ // 10. 单设备多指标趋势查询
169
+ type GetDeviceDataTrendParams = {
170
+ devId: string // 设备id
171
+ dateType: 'hour' | 'day' | 'month' // 日期维度
172
+ indicatorCodes: string // 指标code
173
+ beginDate: string // 开始时间
174
+ endDate: string // 结束时间
175
+ aggregationType?: 'SUM' | 'AVG' | 'MAX' | 'MIN' | 'NUM'
176
+ }
177
+
178
+ type GetDeviceDataTrendResponse = {
179
+ indicator: string // 指标code
180
+ total: number // 总数值
181
+ unit: string // 单位
182
+ list: {
183
+ date: string // 日期
184
+ value: number // 数值
185
+ }[]
186
+ }[]
187
+
188
+ function getPropertySettingTranslate(
189
+ params: GetDeviceDataTrendParams
190
+ ): Promise<GetDeviceDataTrendResponse>
191
+
192
+ // 11. 查询逆变器设备模型
193
+ type GetInverterDeviceModelParams = {
194
+ devId: string // 设备id
195
+ }
196
+
197
+ type GetInverterDeviceModelResponse = {
198
+ code: string // 指标code
199
+ data_spec: {
200
+ range: string[]
201
+ range_info: {
202
+ code: string
203
+ name: string
204
+ }[]
205
+ standard: {
206
+ [key: string]: string
207
+ }
208
+ }
209
+ data_type: string
210
+ group: number
211
+ name: string // 工作模式
212
+ type: string // 工作类型
213
+ }[]
214
+
215
+ function getInverterDeviceModel(
216
+ params: GetInverterDeviceModelParams
217
+ ): Promise<GetInverterDeviceModelResponse>
218
+
219
+ // 12. 能源设备属性查询
220
+ type GetDevicePropertySettingTranslateParams = {
221
+ devId: string // 设备id
222
+ codes: string // 指标code
223
+ }
224
+
225
+ type GetDevicePropertySettingTranslateResponse = {
226
+ code: string
227
+ langValue: string
228
+ time: number
229
+ value: string
230
+ }[]
231
+
232
+ function getDevicePropertySettingTranslate(
233
+ params: GetDevicePropertySettingTranslateParams
234
+ ): Promise<GetDevicePropertySettingTranslateResponse>
235
+
236
+ // 13. 逆变器设备属性下发
237
+ type SetDevicePropertySettingParams = {
238
+ devId: string // 设备id
239
+ setting: {
240
+ code: string // 指标code
241
+ value: string // 下发数值
242
+ }[]
243
+ }
244
+
245
+ type SetDevicePropertySettingResponse = boolean
246
+
247
+ function setDevicePropertySetting(
248
+ params: SetDevicePropertySettingParams
249
+ ): Promise<SetDevicePropertySettingResponse>
250
+ }
@@ -0,0 +1,15 @@
1
+ export declare const energy: {
2
+ getDeviceDataMultipleSum: typeof ty.energy.getDeviceDataMultipleSum;
3
+ getInverterDeviceInfo: typeof ty.energy.getInverterDeviceInfo;
4
+ getInverterPanelInfo: typeof ty.energy.getInverterPanelInfo;
5
+ getInverterFlowInfo: typeof ty.energy.getInverterFlowInfo;
6
+ getPropertyInfo: typeof ty.energy.getPropertyInfo;
7
+ saveProperty: typeof ty.energy.saveProperty;
8
+ getDeviceAlarmEvent: typeof ty.energy.getDeviceAlarmEvent;
9
+ getDeviceAlarmEventDetail: typeof ty.energy.getDeviceAlarmEventDetail;
10
+ getDeviceEnergySavingData: typeof ty.energy.getDeviceEnergySavingData;
11
+ getPropertySettingTranslate: typeof ty.energy.getPropertySettingTranslate;
12
+ getInverterDeviceModel: typeof ty.energy.getInverterDeviceModel;
13
+ getDevicePropertySettingTranslate: typeof ty.energy.getDevicePropertySettingTranslate;
14
+ setDevicePropertySetting: typeof ty.energy.setDevicePropertySetting;
15
+ };
@@ -0,0 +1,55 @@
1
+ import { factory } from '../utils';
2
+ const getDeviceDataMultipleSum = factory('getDeviceDataMultipleSum', {
3
+ namespace: 'energy'
4
+ });
5
+ const getInverterDeviceInfo = factory('getInverterDeviceInfo', {
6
+ namespace: 'energy'
7
+ });
8
+ const getInverterPanelInfo = factory('getInverterPanelInfo', {
9
+ namespace: 'energy'
10
+ });
11
+ const getInverterFlowInfo = factory('getInverterFlowInfo', {
12
+ namespace: 'energy'
13
+ });
14
+ const getPropertyInfo = factory('getPropertyInfo', {
15
+ namespace: 'energy'
16
+ });
17
+ const saveProperty = factory('saveProperty', {
18
+ namespace: 'energy'
19
+ });
20
+ const getDeviceAlarmEvent = factory('getDeviceAlarmEvent', {
21
+ namespace: 'energy'
22
+ });
23
+ const getDeviceAlarmEventDetail = factory('getDeviceAlarmEventDetail', {
24
+ namespace: 'energy'
25
+ });
26
+ const getDeviceEnergySavingData = factory('getDeviceEnergySavingData', {
27
+ namespace: 'energy'
28
+ });
29
+ const getPropertySettingTranslate = factory('getPropertySettingTranslate', {
30
+ namespace: 'energy'
31
+ });
32
+ const getInverterDeviceModel = factory('getInverterDeviceModel', {
33
+ namespace: 'energy'
34
+ });
35
+ const getDevicePropertySettingTranslate = factory('getDevicePropertySettingTranslate', {
36
+ namespace: 'energy'
37
+ });
38
+ const setDevicePropertySetting = factory('setDevicePropertySetting', {
39
+ namespace: 'energy'
40
+ });
41
+ export const energy = {
42
+ getDeviceDataMultipleSum,
43
+ getInverterDeviceInfo,
44
+ getInverterPanelInfo,
45
+ getInverterFlowInfo,
46
+ getPropertyInfo,
47
+ saveProperty,
48
+ getDeviceAlarmEvent,
49
+ getDeviceAlarmEventDetail,
50
+ getDeviceEnergySavingData,
51
+ getPropertySettingTranslate,
52
+ getInverterDeviceModel,
53
+ getDevicePropertySettingTranslate,
54
+ setDevicePropertySetting
55
+ };
@@ -11,3 +11,4 @@ export * from './recipe';
11
11
  export * from './laser-clean';
12
12
  export * from './health';
13
13
  export * from './gateway';
14
+ export * from './energy';
@@ -17,4 +17,5 @@ export * from './recipe';
17
17
  // 激光清洁
18
18
  export * from './laser-clean';
19
19
  export * from './health';
20
- export * from './gateway';
20
+ export * from './gateway';
21
+ export * from './energy';
@@ -4,14 +4,14 @@ const regionMap = {
4
4
  EU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
5
5
  IN: 'inimagesd1jqokb9wptk2t.cdn5th.com',
6
6
  RU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
7
- WE: 'd2h2yqnfpu4gl5.cdn5th.com',
8
- UE: 'usimagesd1448c85ulz2o4.cdn5th.com'
7
+ WE: 'weimages57vdxnr.cdn5th.com',
8
+ UE: 'ueimages58yny2.cdn5th.com'
9
9
  };
10
10
  let _regionCode;
11
11
  let getInternalRegionCode = () => {
12
12
  if (!_regionCode) {
13
13
  ty.getAppInfo({
14
- success: function (res) {
14
+ success(res) {
15
15
  _regionCode = res.regionCode;
16
16
  }
17
17
  });
@@ -21,11 +21,11 @@ let getInternalRegionCode = () => {
21
21
  export function getRegionCode() {
22
22
  return new Promise((resolve, reject) => {
23
23
  ty.getAppInfo({
24
- success: function (res) {
24
+ success(res) {
25
25
  _regionCode = res.regionCode;
26
26
  resolve(res.regionCode);
27
27
  },
28
- fail: function (err) {
28
+ fail(err) {
29
29
  reject(err);
30
30
  }
31
31
  });
@@ -33,19 +33,19 @@ export function getRegionCode() {
33
33
  }
34
34
  export default function getCdnUrl(path, cdnMap, region) {
35
35
  if (!cdnMap) {
36
- console.warn('请传入cdnMap');
36
+ console.warn('Please pass in cdnMap');
37
37
  return path;
38
38
  }
39
39
  const cdnShortPath = cdnMap[path];
40
40
  if (!cdnShortPath) {
41
- console.warn('[App] cdn "' + path + '" is not exist.');
41
+ console.warn("[App] cdn \"".concat(path, "\" is not exist."));
42
42
  return path;
43
43
  }
44
- return 'https://' + regionMap[region || getInternalRegionCode()] + '/' + cdnShortPath;
44
+ return "https://".concat(regionMap[region || getInternalRegionCode()], "/").concat(cdnShortPath);
45
45
  }
46
46
  export async function getCdnUrlAsync(path, cdnMap, region) {
47
47
  if (!cdnMap) {
48
- console.warn('请传入cdnMap');
48
+ console.warn('Please pass in cdnMap');
49
49
  return path;
50
50
  }
51
51
  let _regionCode = 'EU';
@@ -60,9 +60,8 @@ export async function getCdnUrlAsync(path, cdnMap, region) {
60
60
  }
61
61
  const cdnShortPath = cdnMap[path];
62
62
  if (!cdnShortPath) {
63
- console.warn('[App] cdn "' + path + '" is not exist.');
63
+ console.warn("[App] cdn \"".concat(path, "\" is not exist."));
64
64
  return path;
65
65
  }
66
- const cdnPath = 'https://' + regionMap[_regionCode] + '/' + cdnShortPath;
67
- return cdnPath;
66
+ return "https://".concat(regionMap[_regionCode], "/").concat(cdnShortPath);
68
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -29,14 +29,14 @@
29
29
  "watch": "ray start --type=component"
30
30
  },
31
31
  "dependencies": {
32
- "@ray-js/framework": "1.6.0",
33
- "@ray-js/router": "1.6.0",
32
+ "@ray-js/framework": "1.6.1",
33
+ "@ray-js/router": "1.6.1",
34
34
  "@ray-js/wechat": "^0.2.19",
35
35
  "base64-browser": "^1.0.1",
36
36
  "query-string": "^7.1.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@ray-js/cli": "1.6.0",
39
+ "@ray-js/cli": "1.6.1",
40
40
  "art-template": "^4.13.2",
41
41
  "fs-extra": "^10.1.0",
42
42
  "miniprogram-api-typings": "^3.12.3",
@@ -46,5 +46,5 @@
46
46
  "access": "public",
47
47
  "registry": "https://registry.npmjs.com"
48
48
  },
49
- "gitHead": "b5b10947abcec036f88b73320491fb4e0a4cbe52"
49
+ "gitHead": "cb6ffc5dc0ace4c698bf12ab2102420550964a7d"
50
50
  }