@cpzxrobot/sdk 1.1.24 → 1.1.26
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/dist/pigfarm_gateway.js +9 -5
- package/dist/project_gateway.js +1 -1
- package/package.json +1 -1
- package/pigfarm_gateway.ts +16 -5
- package/project_gateway.ts +1 -1
- package/readme.md +1 -1
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -263,15 +263,19 @@ class PigfarmGateway extends Object {
|
|
|
263
263
|
var axios = await this.context.ready;
|
|
264
264
|
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, lamp);
|
|
265
265
|
},
|
|
266
|
-
switchByUnit: async (unit, action) => {
|
|
266
|
+
switchByUnit: async (unit, action, ids = null) => {
|
|
267
267
|
var axios = await this.context.ready;
|
|
268
|
-
|
|
268
|
+
var args = {
|
|
269
269
|
action,
|
|
270
|
-
}
|
|
270
|
+
};
|
|
271
|
+
if (ids) {
|
|
272
|
+
args["ids"] = ids;
|
|
273
|
+
}
|
|
274
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/switch`, args);
|
|
271
275
|
},
|
|
272
|
-
taskStatus: async (
|
|
276
|
+
taskStatus: async (args) => {
|
|
273
277
|
var axios = await this.context.ready;
|
|
274
|
-
return axios.post(`/api/v1/pigfarm/heatLamp/task
|
|
278
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/task`, args);
|
|
275
279
|
},
|
|
276
280
|
control: async (lamp, action) => {
|
|
277
281
|
var axios = await this.context.ready;
|
package/dist/project_gateway.js
CHANGED
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -322,15 +322,26 @@ export class PigfarmGateway extends Object {
|
|
|
322
322
|
var axios = await this.context.ready;
|
|
323
323
|
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, lamp);
|
|
324
324
|
},
|
|
325
|
-
switchByUnit: async (unit: Unit, action: "on" | "off"): Promise<any> => {
|
|
325
|
+
switchByUnit: async (unit: Unit, action: "on" | "off",ids:Number[]|null = null): Promise<any> => {
|
|
326
326
|
var axios = await this.context.ready;
|
|
327
|
-
|
|
327
|
+
var args:{
|
|
328
|
+
action: "on" | "off",
|
|
329
|
+
ids?:Number[]
|
|
330
|
+
} = {
|
|
328
331
|
action,
|
|
329
|
-
}
|
|
332
|
+
}
|
|
333
|
+
if (ids) {
|
|
334
|
+
args["ids"] = ids;
|
|
335
|
+
}
|
|
336
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/switch`, args);
|
|
330
337
|
},
|
|
331
|
-
taskStatus: async (
|
|
338
|
+
taskStatus: async (args:{
|
|
339
|
+
id?:number,
|
|
340
|
+
unitId?:number,
|
|
341
|
+
type?: string
|
|
342
|
+
}): Promise<any> => {
|
|
332
343
|
var axios = await this.context.ready;
|
|
333
|
-
return axios.post(`/api/v1/pigfarm/heatLamp/task
|
|
344
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/task`,args);
|
|
334
345
|
},
|
|
335
346
|
control: async (lamp: HeatLamp | number, action: "on" | "off") => {
|
|
336
347
|
var axios = await this.context.ready;
|
package/project_gateway.ts
CHANGED
package/readme.md
CHANGED
|
@@ -125,7 +125,7 @@ baseURL: "/"
|
|
|
125
125
|
| cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
|
|
126
126
|
| cpzxrobot().pigfarm.heatlamp.switchByUnit | 按单元id开关,返回task |
|
|
127
127
|
| cpzxrobot().pigfarm.heatlamp.updateByUnit | 按单元id设置保温灯的参数,返回task |
|
|
128
|
-
| cpzxrobot().pigfarm.heatlamp.taskStatus | 获取保温灯的任务状态,传入taskId
|
|
128
|
+
| cpzxrobot().pigfarm.heatlamp.taskStatus | 获取保温灯的任务状态,传入taskId参数或者unitId和type自动查询 |
|
|
129
129
|
| cpzxrobot().pigfarm.heatlamp.template.add | 添加保温灯的模板 |
|
|
130
130
|
| cpzxrobot().pigfarm.heatlamp.template.list | 获取保温灯的模板列表 |
|
|
131
131
|
| cpzxrobot().pigfarm.threshold | 获取单元中特定类型的阈值信息 |
|