mirror of
https://github.com/parnic/node-intellicenter.git
synced 2025-06-17 02:21:53 -05:00
This adds a bunch of messages to retrieve and set various things on the controller. It also groups the messages under one export to simplify the process of using and discovering many of them from one location. Some of these are WIP/probably not portable to other systems. This also adds the ability to set multiple circuits at once.
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { ICParam } from "./param.js";
|
|
import { GetRequest, ICRequest, ICRequestObj } from "./request.js";
|
|
|
|
/**
|
|
* Requests to turn a body's heater on or off.
|
|
*
|
|
* This is very WIP. For my pool and my heater configuration, the MODE needs to be 11 to enable my
|
|
* heater and 1 to disable all heaters. I have a feeling 11 is unique to my system's configuration,
|
|
* but I can't yet determine how to know what 11 maps to in order to make this more generic.
|
|
*
|
|
* Note that this doesn't necessarily start heating the body by itself - if the body's pump is
|
|
* currently off, enabling the heater will not turn it on. If the pump/body is on, then this will
|
|
* enable the heater and no further action is required.
|
|
*
|
|
* @returns the object used to issue this request
|
|
*/
|
|
export function SetHeatMode(bodyObjnam: string, enabled: boolean): ICRequest {
|
|
const req = GetRequest();
|
|
req.command = "SetParamList";
|
|
req.objectList = [];
|
|
|
|
const reqObj = new ICRequestObj();
|
|
reqObj.objnam = bodyObjnam;
|
|
reqObj.params = new ICParam();
|
|
reqObj.params.MODE = enabled ? "11" : "1";
|
|
req.objectList.push(reqObj);
|
|
|
|
return req;
|
|
}
|