@cpzxrobot/sdk 1.0.41 → 1.0.43
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/camera_gateway.ts +1 -0
- package/device_filter.ts +4 -0
- package/dist/camera_gateway.js +1 -0
- package/dist/device_filter.js +3 -0
- package/dist/index.js +16 -0
- package/dist/pigfarm_gateway.js +1 -1
- package/index.ts +16 -0
- package/package.json +1 -1
- package/pigfarm_gateway.ts +1 -1
- package/types.d.ts +3 -0
package/camera_gateway.ts
CHANGED
package/device_filter.ts
CHANGED
|
@@ -99,6 +99,9 @@ export abstract class DeviceFilter<T extends { id: number }> {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
//获取设备数据,和getData相同作用,为统一接口进行了重命名
|
|
102
|
+
// diffPerDay: 每天差值, 注意这个只是差值,不是开始值和结束值
|
|
103
|
+
// last: 每个周期最新, 如果需要获得每天的最新数据,需要设置start和stop,然后设置period为1d,这样可以获得每天的最后数据
|
|
104
|
+
// 如果需要查询18点到18点的数据,需要设置offset为18h
|
|
102
105
|
get data() {
|
|
103
106
|
return this.getData;
|
|
104
107
|
}
|
|
@@ -281,6 +284,7 @@ export abstract class DeviceFilter<T extends { id: number }> {
|
|
|
281
284
|
| "latest"
|
|
282
285
|
| "weekoverweek"
|
|
283
286
|
| "last"
|
|
287
|
+
| "rangeOfDay"
|
|
284
288
|
| "rangeToday"
|
|
285
289
|
| null; //如果data为null,则不获取数据,只获取设备列表,否则获取设备列表和数据
|
|
286
290
|
status?: string;
|
package/dist/camera_gateway.js
CHANGED
package/dist/device_filter.js
CHANGED
|
@@ -82,6 +82,9 @@ class DeviceFilter {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
//获取设备数据,和getData相同作用,为统一接口进行了重命名
|
|
85
|
+
// diffPerDay: 每天差值, 注意这个只是差值,不是开始值和结束值
|
|
86
|
+
// last: 每个周期最新, 如果需要获得每天的最新数据,需要设置start和stop,然后设置period为1d,这样可以获得每天的最后数据
|
|
87
|
+
// 如果需要查询18点到18点的数据,需要设置offset为18h
|
|
85
88
|
get data() {
|
|
86
89
|
return this.getData;
|
|
87
90
|
}
|
package/dist/index.js
CHANGED
|
@@ -229,6 +229,22 @@ class Cpzxrobot {
|
|
|
229
229
|
}
|
|
230
230
|
this.resolveReady(this.axios);
|
|
231
231
|
});
|
|
232
|
+
//load www.cpzxrobot.com/web_components.js as web components
|
|
233
|
+
// const script = document.createElement("script");
|
|
234
|
+
// script.src = "https://www.cpzxrobot.com/web_components.js";
|
|
235
|
+
// document.body.appendChild(script);
|
|
236
|
+
// //insert cpzxrobot_web_components into body
|
|
237
|
+
// const div = document.createElement("cpzxrobot_web_components");
|
|
238
|
+
// document.body.appendChild(div);
|
|
239
|
+
// //register onUnitChanged and onFactoryChanged on div
|
|
240
|
+
// div.addEventListener("unitChanged", function (e: any) {
|
|
241
|
+
// // @ts-ignore
|
|
242
|
+
// window._notifyUnitChanged(e.detail);
|
|
243
|
+
// });
|
|
244
|
+
// div.addEventListener("factoryChanged", function (e: any) {
|
|
245
|
+
// // @ts-ignore
|
|
246
|
+
// window._notifyFactoryChanged(e.detail);
|
|
247
|
+
// });
|
|
232
248
|
return;
|
|
233
249
|
}
|
|
234
250
|
else {
|
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -61,7 +61,7 @@ class PigfarmGateway extends Object {
|
|
|
61
61
|
},
|
|
62
62
|
update: async (lamp) => {
|
|
63
63
|
var axios = await this.context.ready;
|
|
64
|
-
return axios.
|
|
64
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
}
|
package/index.ts
CHANGED
|
@@ -264,6 +264,22 @@ export class Cpzxrobot {
|
|
|
264
264
|
}
|
|
265
265
|
this.resolveReady(this.axios);
|
|
266
266
|
});
|
|
267
|
+
//load www.cpzxrobot.com/web_components.js as web components
|
|
268
|
+
// const script = document.createElement("script");
|
|
269
|
+
// script.src = "https://www.cpzxrobot.com/web_components.js";
|
|
270
|
+
// document.body.appendChild(script);
|
|
271
|
+
// //insert cpzxrobot_web_components into body
|
|
272
|
+
// const div = document.createElement("cpzxrobot_web_components");
|
|
273
|
+
// document.body.appendChild(div);
|
|
274
|
+
// //register onUnitChanged and onFactoryChanged on div
|
|
275
|
+
// div.addEventListener("unitChanged", function (e: any) {
|
|
276
|
+
// // @ts-ignore
|
|
277
|
+
// window._notifyUnitChanged(e.detail);
|
|
278
|
+
// });
|
|
279
|
+
// div.addEventListener("factoryChanged", function (e: any) {
|
|
280
|
+
// // @ts-ignore
|
|
281
|
+
// window._notifyFactoryChanged(e.detail);
|
|
282
|
+
// });
|
|
267
283
|
return;
|
|
268
284
|
} else {
|
|
269
285
|
//if url has access_token and app_code, use it
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -73,7 +73,7 @@ export class PigfarmGateway extends Object {
|
|
|
73
73
|
},
|
|
74
74
|
update:async (lamp: HeatLamp):Promise<any>=> {
|
|
75
75
|
var axios = await this.context.ready;
|
|
76
|
-
return axios.
|
|
76
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`,lamp)
|
|
77
77
|
},
|
|
78
78
|
};
|
|
79
79
|
}
|
package/types.d.ts
CHANGED
|
@@ -151,11 +151,14 @@ export interface DataQueryArgs {
|
|
|
151
151
|
type?:
|
|
152
152
|
| "diffPerDay"
|
|
153
153
|
| "sumPerDay"
|
|
154
|
+
| "rangeOfDay"
|
|
155
|
+
| "rangeToday"
|
|
154
156
|
| "latest"
|
|
155
157
|
| "latestInRangePerDay"
|
|
156
158
|
| "last"
|
|
157
159
|
| "difference";
|
|
158
160
|
period?: "1mo" | "1d" | null;
|
|
161
|
+
offset?: string; // 可以设置统计偏移量,比如设置18h, 则统计从当天晚上6点开始
|
|
159
162
|
[key: string]: any;
|
|
160
163
|
}
|
|
161
164
|
|