mirror of
https://github.com/parnic/node-intellicenter.git
synced 2025-06-17 02:21:53 -05:00
The API all calls these objects so best to go with the flow. This is a breaking change.
30 lines
878 B
JavaScript
30 lines
878 B
JavaScript
import { ICParam } from "./param.js";
|
|
import { GetRequest, ICRequestObj } from "./request.js";
|
|
/**
|
|
* Requests to change the status of objects known to this controller.
|
|
*
|
|
* Turns one or more objects on or off. Use the `objnam` of the circuit to be set.
|
|
*
|
|
* @returns the object used to issue this request
|
|
*/
|
|
export function SetObjectStatus(object, status) {
|
|
const req = GetRequest();
|
|
req.command = "SetParamList";
|
|
req.objectList = [];
|
|
let objects;
|
|
if (Array.isArray(object)) {
|
|
objects = object;
|
|
}
|
|
else {
|
|
objects = [object];
|
|
}
|
|
for (const i of objects) {
|
|
const reqObj = new ICRequestObj();
|
|
reqObj.objnam = i;
|
|
reqObj.params = new ICParam();
|
|
reqObj.params.STATUS = status ? "ON" : "OFF";
|
|
req.objectList.push(reqObj);
|
|
}
|
|
return req;
|
|
}
|
|
//# sourceMappingURL=set-object-status.js.map
|