Fleshing out more messages

Getting a feel for how the development experience is with this setup. With the previous idea of abstracting the request into a getSystemInfo() function on the Unit itself, the documentation for what to expect from GetSystemInfo either had to live in two places or be presented as a link to the canonical location. Neither felt great, so I think the caller can just call send(GetRequest()) themselves.

Also added the first "set" message which is capable of toggling a body or circuit.
This commit is contained in:
2025-01-03 16:01:58 -06:00
parent ceb9299d03
commit 7daf47ac18
32 changed files with 634 additions and 391 deletions

View File

@ -0,0 +1,2 @@
[OUTGOING] {"command":"SetParamList","objectList":[{"objnam":"B1101","params":{"STATUS":"ON"}}],"messageID":"B1101"}
[INCOMING] {"command":"SetParamList","messageID":"B1101","response":"200"}

20
dist/index.js vendored
View File

@ -1,5 +1,9 @@
"use strict";
import { FindUnits } from "./finder.js";
import { GetBodyStatus } from "./messages/body-status.js";
import { GetSystemConfiguration } from "./messages/configuration.js";
// import { SetItemStatus } from "./messages/set-status.js";
import { GetSystemInfoRequest } from "./messages/system-info.js";
import { Unit } from "./unit.js";
console.log("searching...");
const f = new FindUnits();
@ -14,12 +18,26 @@ if (units.length > 1) {
}
const endpoint = units[0].addressStr;
const port = units[0].port;
// const endpoint = "10.0.0.41";
// const port = 6680;
console.log("connecting to intellicenter device at", endpoint, "port", port);
const unit = new Unit(endpoint, port);
await unit.connect();
console.log("connected");
console.log("sending Get System Info request...");
const resp = await unit.getSystemInfo();
let resp = await unit.send(GetSystemInfoRequest());
console.log("got response:", JSON.stringify(resp, null, 2));
console.log("sending Get System Config request...");
resp = await unit.send(GetSystemConfiguration());
console.log("got response:", JSON.stringify(resp, null, 2));
console.log("sending Get Body Status request...");
resp = await unit.send(GetBodyStatus());
console.log("got response:", JSON.stringify(resp, null, 2));
// console.log("turning off pool...");
// resp = await unit.send(SetItemStatus("B1101", false));
// console.log("got response:", JSON.stringify(resp, null, 2));
// console.log("turning off water feature...");
// resp = await unit.send(SetItemStatus("C0003", false));
// console.log("got response:", JSON.stringify(resp, null, 2));
unit.close();
//# sourceMappingURL=index.js.map

2
dist/index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CAAC,uCAAuC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAC7E,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACtC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;AACrB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAEzB,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAClD,IAAI,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;AACnD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAE5D,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AACpD,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;AACjD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAE5D,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AAClD,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;AACxC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAE5D,sCAAsC;AACtC,yDAAyD;AACzD,+DAA+D;AAE/D,+CAA+C;AAC/C,yDAAyD;AACzD,+DAA+D;AAE/D,IAAI,CAAC,KAAK,EAAE,CAAC"}

14
dist/messages/body-status.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
import { ICRequest } from "./request.js";
/**
* Requests the status of bodies known to this controller.
*
* The response contains the list of bodies in the `params` field. Each body has
* an `objnam` that should be used to reference that body for future requests.
* When `params`.`STATUS` is `"OFF"`, use `params`.`LSTTMP` to get the temperature
* of the body the last time it was on, or `params`.`TEMP` to get the temperature
* if the `STATUS` is `"ON"`. `LSTTMP` seems to always be accurate, however, whether
* the body is currently on or off.
*
* @returns the object used to issue this request
*/
export declare function GetBodyStatus(): ICRequest;

27
dist/messages/body-status.js vendored Normal file
View File

@ -0,0 +1,27 @@
import { GetRequest, ICRequestObj } from "./request.js";
/**
* Requests the status of bodies known to this controller.
*
* The response contains the list of bodies in the `params` field. Each body has
* an `objnam` that should be used to reference that body for future requests.
* When `params`.`STATUS` is `"OFF"`, use `params`.`LSTTMP` to get the temperature
* of the body the last time it was on, or `params`.`TEMP` to get the temperature
* if the `STATUS` is `"ON"`. `LSTTMP` seems to always be accurate, however, whether
* the body is currently on or off.
*
* @returns the object used to issue this request
*/
export function GetBodyStatus() {
const req = GetRequest();
req.command = "GetParamList";
req.condition = "OBJTYP = BODY";
req.objectList = [];
const reqObj = new ICRequestObj();
reqObj.objnam = "ALL";
reqObj.keys = [
"OBJTYP: SUBTYP: SNAME: LISTORD: FILTER: LOTMP: TEMP: HITMP: HTSRC: PRIM: SEC: ACT1: ACT2: ACT3: ACT4: CIRCUIT: SPEED: BOOST: SELECT: STATUS: HTMODE : LSTTMP : HEATER : VOL : MANUAL : HNAME : MODE",
];
req.objectList.push(reqObj);
return req;
}
//# sourceMappingURL=body-status.js.map

1
dist/messages/body-status.js.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"body-status.js","sourceRoot":"","sources":["../../messages/body-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,GAAG,CAAC,OAAO,GAAG,cAAc,CAAC;IAC7B,GAAG,CAAC,SAAS,GAAG,eAAe,CAAC;IAChC,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC;IAEpB,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAClC,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,MAAM,CAAC,IAAI,GAAG;QACZ,qMAAqM;KACtM,CAAC;IACF,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE5B,OAAO,GAAG,CAAC;AACb,CAAC"}

15
dist/messages/configuration.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
import { ICRequest } from "./request.js";
/**
* Requests the configuration of bodies and circuits available to this controller.
*
* The response contains the list of bodies and circuits under the `answer` field.
* Each item has an `objnam` that should be used to reference that item for future requests,
* and `params`.`SNAME` is the user-entered friendly name that can be displayed for the item.
* `params`.`OBJTYP` will be either BODY or CIRCUIT depending on the item it's describing.
*
* Some items, such as the Pool body, will have the `params`.`OBJLIST` array populated with
* a series of attached items such as a chlorinator device.
*
* @returns the object used to issue this request
*/
export declare function GetSystemConfiguration(): ICRequest;

22
dist/messages/configuration.js vendored Normal file
View File

@ -0,0 +1,22 @@
import { GetRequest } from "./request.js";
/**
* Requests the configuration of bodies and circuits available to this controller.
*
* The response contains the list of bodies and circuits under the `answer` field.
* Each item has an `objnam` that should be used to reference that item for future requests,
* and `params`.`SNAME` is the user-entered friendly name that can be displayed for the item.
* `params`.`OBJTYP` will be either BODY or CIRCUIT depending on the item it's describing.
*
* Some items, such as the Pool body, will have the `params`.`OBJLIST` array populated with
* a series of attached items such as a chlorinator device.
*
* @returns the object used to issue this request
*/
export function GetSystemConfiguration() {
const req = GetRequest();
req.command = "GetQuery";
req.queryName = "GetConfiguration";
req.arguments = "";
return req;
}
//# sourceMappingURL=configuration.js.map

1
dist/messages/configuration.js.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../messages/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,GAAG,CAAC,OAAO,GAAG,UAAU,CAAC;IACzB,GAAG,CAAC,SAAS,GAAG,kBAAkB,CAAC;IACnC,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC;IAEnB,OAAO,GAAG,CAAC;AACb,CAAC"}

123
dist/messages/param.d.ts vendored Normal file
View File

@ -0,0 +1,123 @@
export declare class ICParam {
ABSMAX?: string;
ABSMIN?: string;
ACT?: string;
ACT1?: string;
ACT2?: string;
ACT3?: string;
ACT4?: string;
ADDRESS?: string;
ALK?: string;
AVAIL?: "AVAIL" | "ON" | "OFF";
BADGE?: string;
BODY?: string;
BOOST?: string;
CALC?: string;
CALIB?: string;
CHILD?: string;
CIRCUIT?: string;
CITY?: string;
CLK24A?: string;
COMUART?: string;
COOL?: string;
COUNT?: string;
COUNTRY?: string;
CYACID?: string;
DAY?: string;
DLSTIM?: "DLSTIM" | "ON" | "OFF";
DLY?: string;
DNTSTP?: string;
EMAIL?: string;
EMAIL2?: string;
ENABLE?: "ENABLE" | "ON" | "OFF";
FEATR?: string;
FILTER?: string;
FREEZE?: string;
GPM?: string;
HEATER?: string;
HEATING?: "HEATING" | "ON" | "OFF";
HITMP?: string;
HNAME?: string;
HTMODE?: string;
HTSRC?: string;
IN?: string;
LIMIT?: string;
LISTORD?: string;
LOCX?: string;
LOCY?: string;
LOTMP?: string;
LSTTMP?: string;
MANHT?: "MANHT" | "ON" | "OFF";
MANOVR?: "MANOVR" | "ON" | "OFF";
MANUAL?: string;
MAX?: string;
MAXF?: string;
MIN?: string;
MINF?: string;
MODE?: string;
NAME?: string;
OBJLIST?: ICParam[];
OBJNAM?: string;
OBJTYP?: string;
OFFSET?: string;
ORPSET?: string;
ORPTNK?: string;
ORPVAL?: string;
PARENT?: string;
PARTY?: string;
PASSWRD?: string;
PERMIT?: string;
PHONE?: string;
PHONE2?: string;
PHSET?: string;
PHTNK?: string;
PHVAL?: string;
PRIM?: string;
PRIMFLO?: string;
PRIMTIM?: string;
PRIOR?: string;
PROBE?: string;
PROPNAME?: string;
PWR?: string;
QUALTY?: string;
READY?: string;
RLY?: string;
RPM?: string;
SALT?: string;
SEC?: string;
SELECT?: string;
SERVICE?: "SERVICE" | "AUTO" | "TIMEOUT";
SETTMP?: string;
SETTMPNC?: string;
SHARE?: string;
SHOMNU?: string;
SINDEX?: string;
SNAME?: string;
SOURCE?: string;
SPEED?: string;
SRIS?: string;
SSET?: string;
START?: string;
STATE?: string;
STATIC?: string;
STATUS?: "STATUS" | "ON" | "OFF";
STOP?: string;
SUBTYP?: string;
SUPER?: "SUPER" | "ON" | "OFF";
SWIM?: string;
SYNC?: string;
SYSTIM?: string;
TEMP?: string;
TIME?: string;
TIMOUT?: string;
TIMZON?: string;
UPDATE?: string;
USAGE?: string;
USE?: string;
VACFLO?: "VACFLO" | "ON" | "OFF";
VACTIM?: "VACTIM" | "ON" | "OFF";
VALVE?: "VALVE" | "ON" | "OFF";
VER?: string;
VOL?: string;
ZIP?: string;
}

125
dist/messages/param.js vendored Normal file
View File

@ -0,0 +1,125 @@
export class ICParam {
// "": "PROGRESS";
ABSMAX;
ABSMIN;
ACT;
ACT1;
ACT2;
ACT3;
ACT4;
ADDRESS;
ALK;
AVAIL;
BADGE;
BODY;
BOOST;
CALC;
CALIB;
CHILD;
CIRCUIT;
CITY;
CLK24A;
COMUART;
COOL;
COUNT;
COUNTRY;
CYACID;
DAY;
DLSTIM;
DLY;
DNTSTP;
EMAIL;
EMAIL2;
ENABLE;
FEATR;
FILTER;
FREEZE;
GPM;
HEATER;
HEATING;
HITMP;
HNAME;
HTMODE;
HTSRC;
IN;
LIMIT;
LISTORD;
LOCX;
LOCY;
LOTMP;
LSTTMP;
MANHT;
MANOVR;
MANUAL;
MAX;
MAXF;
MIN;
MINF;
MODE;
NAME;
OBJLIST;
OBJNAM;
OBJTYP;
OFFSET;
ORPSET;
ORPTNK;
ORPVAL;
PARENT;
PARTY;
PASSWRD;
PERMIT;
PHONE;
PHONE2;
PHSET;
PHTNK;
PHVAL;
PRIM;
PRIMFLO;
PRIMTIM;
PRIOR;
PROBE;
PROPNAME;
PWR;
QUALTY;
READY;
RLY;
RPM;
SALT;
SEC;
SELECT;
SERVICE;
SETTMP;
SETTMPNC;
SHARE;
SHOMNU;
SINDEX;
SNAME;
SOURCE;
SPEED;
SRIS;
SSET;
START;
STATE;
STATIC;
STATUS;
STOP;
SUBTYP;
SUPER;
SWIM;
SYNC;
SYSTIM;
TEMP;
TIME;
TIMOUT;
TIMZON;
UPDATE;
USAGE;
USE;
VACFLO;
VACTIM;
VALVE;
VER;
VOL;
ZIP;
}
//# sourceMappingURL=param.js.map

1
dist/messages/param.js.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"param.js","sourceRoot":"","sources":["../../messages/param.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,OAAO;IAClB,kBAAkB;IACX,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,GAAG,CAAU;IACb,IAAI,CAAU;IACd,IAAI,CAAU;IACd,IAAI,CAAU;IACd,IAAI,CAAU;IACd,OAAO,CAAU;IACjB,GAAG,CAAU;IACb,KAAK,CAA0B;IAC/B,KAAK,CAAU;IACf,IAAI,CAAU;IACd,KAAK,CAAU;IACf,IAAI,CAAU;IACd,KAAK,CAAU;IACf,KAAK,CAAU;IACf,OAAO,CAAU;IACjB,IAAI,CAAU;IACd,MAAM,CAAU;IAChB,OAAO,CAAU;IACjB,IAAI,CAAU;IACd,KAAK,CAAU;IACf,OAAO,CAAU;IACjB,MAAM,CAAU;IAChB,GAAG,CAAU;IACb,MAAM,CAA2B;IACjC,GAAG,CAAU;IACb,MAAM,CAAU;IAChB,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,MAAM,CAA2B;IACjC,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,GAAG,CAAU;IACb,MA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AAI,CAAU;IACd,IAAI,CAAU;IACd,MAAM,CAAU;IAChB,IAAI,CAAU;IACd,IAAI,CAAU;IACd,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,KAAK,CAAU;IACf,GAAG,CAAU;IACb,MAAM,CAA2B;IACjC,MAAM,CAA2B;IACjC,KAAK,CAA0B;IAC/B,GAAG,CAAU;IACb,GAAG,CAAU;IACb,GAAG,CAAU;CACrB"}

View File

@ -1,6 +1,8 @@
import { ICParam } from "./param.js";
export declare class ICRequestObj {
objnam: string;
keys: string[];
params?: ICParam;
}
export declare class ICRequest {
condition?: string;

View File

@ -2,6 +2,7 @@ import { v4 as uuidv4 } from "uuid";
export class ICRequestObj {
objnam = "";
keys = [];
params;
}
export class ICRequest {
condition;

View File

@ -1 +1 @@
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../messages/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,OAAO,YAAY;IAChB,MAAM,GAAG,EAAE,CAAC;IACZ,IAAI,GAAa,EAAE,CAAC;CAC5B;AAED,MAAM,OAAO,SAAS;IACb,SAAS,CAAU;IACnB,UAAU,CAAkB;IAC5B,SAAS,CAAU;IACnB,SAAS,CAAqB;IAC9B,OAAO,GAAG,EAAE,CAAC;IACb,SAAS,GAAG,EAAE,CAAC;CACvB;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC;IAC5B,GAAG,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;IACzB,OAAO,GAAG,CAAC;AACb,CAAC"}
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../messages/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAGpC,MAAM,OAAO,YAAY;IAChB,MAAM,GAAG,EAAE,CAAC;IACZ,IAAI,GAAa,EAAE,CAAC;IACpB,MAAM,CAAW;CACzB;AAED,MAAM,OAAO,SAAS;IACb,SAAS,CAAU;IACnB,UAAU,CAAkB;IAC5B,SAAS,CAAU;IACnB,SAAS,CAAqB;IAC9B,OAAO,GAAG,EAAE,CAAC;IACb,SAAS,GAAG,EAAE,CAAC;CACvB;AAED,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC;IAC5B,GAAG,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;IACzB,OAAO,GAAG,CAAC;AACb,CAAC"}

View File

@ -1,129 +1,7 @@
export declare class ICResponseParam {
ABSMAX?: string;
ABSMIN?: string;
ACT?: string;
ACT1?: string;
ACT2?: string;
ACT3?: string;
ACT4?: string;
ADDRESS?: string;
ALK?: string;
AVAIL?: "AVAIL" | "ON" | "OFF";
BADGE?: string;
BODY?: string;
BOOST?: string;
CALC?: string;
CALIB?: string;
CHILD?: string;
CIRCUIT?: string;
CITY?: string;
CLK24A?: string;
COMUART?: string;
COOL?: string;
COUNT?: string;
COUNTRY?: string;
CYACID?: string;
DAY?: string;
DLSTIM?: "DLSTIM" | "ON" | "OFF";
DLY?: string;
DNTSTP?: string;
EMAIL?: string;
EMAIL2?: string;
ENABLE?: "ENABLE" | "ON" | "OFF";
FEATR?: string;
FILTER?: string;
FREEZE?: string;
GPM?: string;
HEATER?: string;
HEATING?: "HEATING" | "ON" | "OFF";
HITMP?: string;
HNAME?: string;
HTMODE?: string;
HTSRC?: string;
IN?: string;
LIMIT?: string;
LISTORD?: string;
LOCX?: string;
LOCY?: string;
LOTMP?: string;
LSTTMP?: string;
MANHT?: "MANHT" | "ON" | "OFF";
MANOVR?: "MANOVR" | "ON" | "OFF";
MANUAL?: string;
MAX?: string;
MAXF?: string;
MIN?: string;
MINF?: string;
MODE?: string;
NAME?: string;
OBJLIST?: ICResponseParam[];
OBJNAM?: string;
OBJTYP?: string;
OFFSET?: string;
ORPSET?: string;
ORPTNK?: string;
ORPVAL?: string;
PARENT?: string;
PARTY?: string;
PASSWRD?: string;
PERMIT?: string;
PHONE?: string;
PHONE2?: string;
PHSET?: string;
PHTNK?: string;
PHVAL?: string;
PRIM?: string;
PRIMFLO?: string;
PRIMTIM?: string;
PRIOR?: string;
PROBE?: string;
PROPNAME?: string;
PWR?: string;
QUALTY?: string;
READY?: string;
RLY?: string;
RPM?: string;
SALT?: string;
SEC?: string;
SELECT?: string;
SERVICE?: "SERVICE" | "AUTO" | "TIMEOUT";
SETTMP?: string;
SETTMPNC?: string;
SHARE?: string;
SHOMNU?: string;
SINDEX?: string;
SNAME?: string;
SOURCE?: string;
SPEED?: string;
SRIS?: string;
SSET?: string;
START?: string;
STATE?: string;
STATIC?: string;
STATUS?: string;
STOP?: string;
SUBTYP?: string;
SUPER?: "SUPER" | "ON" | "OFF";
SWIM?: string;
SYNC?: string;
SYSTIM?: string;
TEMP?: string;
TIME?: string;
TIMOUT?: string;
TIMZON?: string;
UPDATE?: string;
USAGE?: string;
USE?: string;
VACFLO?: "VACFLO" | "ON" | "OFF";
VACTIM?: "VACTIM" | "ON" | "OFF";
VALVE?: "VALVE" | "ON" | "OFF";
VER?: string;
VOL?: string;
ZIP?: string;
}
import { ICParam } from "./param.js";
export declare class ICResponseObj {
objnam: string;
params?: ICResponseParam;
params?: ICParam;
}
export declare class ICResponse {
command: string;

View File

@ -1,127 +1,3 @@
export class ICResponseParam {
// "": "PROGRESS";
ABSMAX;
ABSMIN;
ACT;
ACT1;
ACT2;
ACT3;
ACT4;
ADDRESS;
ALK;
AVAIL;
BADGE;
BODY;
BOOST;
CALC;
CALIB;
CHILD;
CIRCUIT;
CITY;
CLK24A;
COMUART;
COOL;
COUNT;
COUNTRY;
CYACID;
DAY;
DLSTIM;
DLY;
DNTSTP;
EMAIL;
EMAIL2;
ENABLE;
FEATR;
FILTER;
FREEZE;
GPM;
HEATER;
HEATING;
HITMP;
HNAME;
HTMODE;
HTSRC;
IN;
LIMIT;
LISTORD;
LOCX;
LOCY;
LOTMP;
LSTTMP;
MANHT;
MANOVR;
MANUAL;
MAX;
MAXF;
MIN;
MINF;
MODE;
NAME;
OBJLIST;
OBJNAM;
OBJTYP;
OFFSET;
ORPSET;
ORPTNK;
ORPVAL;
PARENT;
PARTY;
PASSWRD;
PERMIT;
PHONE;
PHONE2;
PHSET;
PHTNK;
PHVAL;
PRIM;
PRIMFLO;
PRIMTIM;
PRIOR;
PROBE;
PROPNAME;
PWR;
QUALTY;
READY;
RLY;
RPM;
SALT;
SEC;
SELECT;
SERVICE;
SETTMP;
SETTMPNC;
SHARE;
SHOMNU;
SINDEX;
SNAME;
SOURCE;
SPEED;
SRIS;
SSET;
START;
STATE;
STATIC;
STATUS;
STOP;
SUBTYP;
SUPER;
SWIM;
SYNC;
SYSTIM;
TEMP;
TIME;
TIMOUT;
TIMZON;
UPDATE;
USAGE;
USE;
VACFLO;
VACTIM;
VALVE;
VER;
VOL;
ZIP;
}
export class ICResponseObj {
objnam = "";
params;

View File

@ -1 +1 @@
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../messages/response.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAe;IAC1B,kBAAkB;IACX,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,GAAG,CAAU;IACb,IAAI,CAAU;IACd,IAAI,CAAU;IACd,IAAI,CAAU;IACd,IAAI,CAAU;IACd,OAAO,CAAU;IACjB,GAAG,CAAU;IACb,KAAK,CAA0B;IAC/B,KAAK,CAAU;IACf,IAAI,CAAU;IACd,KAAK,CAAU;IACf,IAAI,CAAU;IACd,KAAK,CAAU;IACf,KAAK,CAAU;IACf,OAAO,CAAU;IACjB,IAAI,CAAU;IACd,MAAM,CAAU;IAChB,OAAO,CAAU;IACjB,IAAI,CAAU;IACd,KAAK,CAAU;IACf,OAAO,CAAU;IACjB,MAAM,CAAU;IAChB,GAAG,CAAU;IACb,MAAM,CAA2B;IACjC,GAAG,CAAU;IACb,MAAM,CAAU;IAChB,KAAK,CAAU;IAC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ACf,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,IAAI,CAAU;IACd,MAAM,CAAU;IAChB,KAAK,CAA0B;IAC/B,IAAI,CAAU;IACd,IAAI,CAAU;IACd,MAAM,CAAU;IAChB,IAAI,CAAU;IACd,IAAI,CAAU;IACd,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,KAAK,CAAU;IACf,GAAG,CAAU;IACb,MAAM,CAA2B;IACjC,MAAM,CAA2B;IACjC,KAAK,CAA0B;IAC/B,GAAG,CAAU;IACb,GAAG,CAAU;IACb,GAAG,CAAU;CACrB;AAED,MAAM,OAAO,aAAa;IACjB,MAAM,GAAG,EAAE,CAAC;IACZ,MAAM,CAAmB;CACjC;AAED,MAAM,OAAO,UAAU;IACd,OAAO,GAAG,EAAE,CAAC;IACb,SAAS,GAAG,EAAE,CAAC;IACf,QAAQ,GAAG,EAAE,CAAC;IACd,UAAU,CAAmB;IAC7B,SAAS,CAAU;IACnB,MAAM,CAAmB;IACzB,SAAS,CAAU;IACnB,OAAO,CAAU;CACzB"}
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../messages/response.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IACjB,MAAM,GAAG,EAAE,CAAC;IACZ,MAAM,CAAW;CACzB;AAED,MAAM,OAAO,UAAU;IACd,OAAO,GAAG,EAAE,CAAC;IACb,SAAS,GAAG,EAAE,CAAC;IACf,QAAQ,GAAG,EAAE,CAAC;IACd,UAAU,CAAmB;IAC7B,SAAS,CAAU;IACnB,MAAM,CAAmB;IACzB,SAAS,CAAU;IACnB,OAAO,CAAU;CACzB"}

14
dist/messages/set-status.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
import { ICRequest } from "./request.js";
/**
* Requests the status of bodies known to this controller.
*
* The response contains the list of bodies in the `params` field. Each body has
* an `objnam` that should be used to reference that body for future requests.
* When `params`.`STATUS` is `"OFF"`, use `params`.`LSTTMP` to get the temperature
* of the body the last time it was on, or `params`.`TEMP` to get the temperature
* if the `STATUS` is `"ON"`. `LSTTMP` seems to always be accurate, however, whether
* the body is currently on or off.
*
* @returns the object used to issue this request
*/
export declare function SetItemStatus(item: string, status: boolean): ICRequest;

26
dist/messages/set-status.js vendored Normal file
View File

@ -0,0 +1,26 @@
import { ICParam } from "./param.js";
import { GetRequest, ICRequestObj } from "./request.js";
/**
* Requests the status of bodies known to this controller.
*
* The response contains the list of bodies in the `params` field. Each body has
* an `objnam` that should be used to reference that body for future requests.
* When `params`.`STATUS` is `"OFF"`, use `params`.`LSTTMP` to get the temperature
* of the body the last time it was on, or `params`.`TEMP` to get the temperature
* if the `STATUS` is `"ON"`. `LSTTMP` seems to always be accurate, however, whether
* the body is currently on or off.
*
* @returns the object used to issue this request
*/
export function SetItemStatus(item, status) {
const req = GetRequest();
req.command = "SetParamList";
req.objectList = [];
const reqObj = new ICRequestObj();
reqObj.objnam = item;
reqObj.params = new ICParam();
reqObj.params.STATUS = status ? "ON" : "OFF";
req.objectList.push(reqObj);
return req;
}
//# sourceMappingURL=set-status.js.map

1
dist/messages/set-status.js.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"set-status.js","sourceRoot":"","sources":["../../messages/set-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAa,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAe;IACzD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,GAAG,CAAC,OAAO,GAAG,cAAc,CAAC;IAC7B,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC;IAEpB,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAClC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7C,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE5B,OAAO,GAAG,CAAC;AACb,CAAC"}

1
dist/unit.d.ts vendored
View File

@ -12,5 +12,4 @@ export declare class Unit extends EventEmitter {
private heartbeat;
private onClientMessage;
send(request: ICRequest): Promise<ICResponse>;
getSystemInfo(): Promise<ICResponse>;
}

5
dist/unit.js vendored
View File

@ -1,6 +1,5 @@
import { EventEmitter } from "events";
import { WebSocket } from "ws";
import { GetSystemInfoRequest } from "./messages/system-info.js";
export class Unit extends EventEmitter {
endpoint;
port;
@ -54,9 +53,5 @@ export class Unit extends EventEmitter {
});
});
}
async getSystemInfo() {
const req = GetSystemInfoRequest();
return await this.send(req);
}
}
//# sourceMappingURL=unit.js.map

2
dist/unit.js.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"unit.js","sourceRoot":"","sources":["../unit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAG/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,IAAK,SAAQ,YAAY;IAK3B;IACA;IALD,MAAM,CAAa;IACnB,WAAW,CAAiC;IAEpD,YACS,QAAgB,EAChB,OAAO,IAAI;QAElB,KAAK,EAAE,CAAC;QAHD,aAAQ,GAAR,QAAQ,CAAQ;QAChB,SAAI,GAAJ,IAAI,CAAO;QAIlB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,I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,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;IAEO,SAAS,GAAG,GAAG,EAAE;QACvB,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAE/B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE;YACjC,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC;IAEM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAe,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC,CAAC;IAEK,KAAK,CAAC,IAAI,CAAC,OAAkB;QAClC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3C,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,YAAY,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,IAAgB,EAAE,EAAE;gBAC9D,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}

View File

@ -1,6 +1,10 @@
"use strict";
import { FindUnits } from "./finder.js";
import { GetBodyStatus } from "./messages/body-status.js";
import { GetSystemConfiguration } from "./messages/configuration.js";
// import { SetItemStatus } from "./messages/set-status.js";
import { GetSystemInfoRequest } from "./messages/system-info.js";
import { Unit } from "./unit.js";
console.log("searching...");
@ -22,11 +26,32 @@ if (units.length > 1) {
const endpoint = units[0].addressStr;
const port = units[0].port;
// const endpoint = "10.0.0.41";
// const port = 6680;
console.log("connecting to intellicenter device at", endpoint, "port", port);
const unit = new Unit(endpoint, port);
await unit.connect();
console.log("connected");
console.log("sending Get System Info request...");
const resp = await unit.getSystemInfo();
let resp = await unit.send(GetSystemInfoRequest());
console.log("got response:", JSON.stringify(resp, null, 2));
console.log("sending Get System Config request...");
resp = await unit.send(GetSystemConfiguration());
console.log("got response:", JSON.stringify(resp, null, 2));
console.log("sending Get Body Status request...");
resp = await unit.send(GetBodyStatus());
console.log("got response:", JSON.stringify(resp, null, 2));
// console.log("turning off pool...");
// resp = await unit.send(SetItemStatus("B1101", false));
// console.log("got response:", JSON.stringify(resp, null, 2));
// console.log("turning off water feature...");
// resp = await unit.send(SetItemStatus("C0003", false));
// console.log("got response:", JSON.stringify(resp, null, 2));
unit.close();

29
messages/body-status.ts Normal file
View File

@ -0,0 +1,29 @@
import { GetRequest, ICRequest, ICRequestObj } from "./request.js";
/**
* Requests the status of bodies known to this controller.
*
* The response contains the list of bodies in the `params` field. Each body has
* an `objnam` that should be used to reference that body for future requests.
* When `params`.`STATUS` is `"OFF"`, use `params`.`LSTTMP` to get the temperature
* of the body the last time it was on, or `params`.`TEMP` to get the temperature
* if the `STATUS` is `"ON"`. `LSTTMP` seems to always be accurate, however, whether
* the body is currently on or off.
*
* @returns the object used to issue this request
*/
export function GetBodyStatus(): ICRequest {
const req = GetRequest();
req.command = "GetParamList";
req.condition = "OBJTYP = BODY";
req.objectList = [];
const reqObj = new ICRequestObj();
reqObj.objnam = "ALL";
reqObj.keys = [
"OBJTYP: SUBTYP: SNAME: LISTORD: FILTER: LOTMP: TEMP: HITMP: HTSRC: PRIM: SEC: ACT1: ACT2: ACT3: ACT4: CIRCUIT: SPEED: BOOST: SELECT: STATUS: HTMODE : LSTTMP : HEATER : VOL : MANUAL : HNAME : MODE",
];
req.objectList.push(reqObj);
return req;
}

23
messages/configuration.ts Normal file
View File

@ -0,0 +1,23 @@
import { GetRequest, ICRequest } from "./request.js";
/**
* Requests the configuration of bodies and circuits available to this controller.
*
* The response contains the list of bodies and circuits under the `answer` field.
* Each item has an `objnam` that should be used to reference that item for future requests,
* and `params`.`SNAME` is the user-entered friendly name that can be displayed for the item.
* `params`.`OBJTYP` will be either BODY or CIRCUIT depending on the item it's describing.
*
* Some items, such as the Pool body, will have the `params`.`OBJLIST` array populated with
* a series of attached items such as a chlorinator device.
*
* @returns the object used to issue this request
*/
export function GetSystemConfiguration(): ICRequest {
const req = GetRequest();
req.command = "GetQuery";
req.queryName = "GetConfiguration";
req.arguments = "";
return req;
}

124
messages/param.ts Normal file
View File

@ -0,0 +1,124 @@
export class ICParam {
// "": "PROGRESS";
public ABSMAX?: string;
public ABSMIN?: string;
public ACT?: string;
public ACT1?: string;
public ACT2?: string;
public ACT3?: string;
public ACT4?: string;
public ADDRESS?: string;
public ALK?: string;
public AVAIL?: "AVAIL" | "ON" | "OFF";
public BADGE?: string;
public BODY?: string;
public BOOST?: string;
public CALC?: string;
public CALIB?: string;
public CHILD?: string;
public CIRCUIT?: string;
public CITY?: string;
public CLK24A?: string;
public COMUART?: string;
public COOL?: string;
public COUNT?: string;
public COUNTRY?: string;
public CYACID?: string;
public DAY?: string;
public DLSTIM?: "DLSTIM" | "ON" | "OFF";
public DLY?: string;
public DNTSTP?: string;
public EMAIL?: string;
public EMAIL2?: string;
public ENABLE?: "ENABLE" | "ON" | "OFF";
public FEATR?: string;
public FILTER?: string;
public FREEZE?: string;
public GPM?: string;
public HEATER?: string;
public HEATING?: "HEATING" | "ON" | "OFF";
public HITMP?: string;
public HNAME?: string;
public HTMODE?: string;
public HTSRC?: string;
public IN?: string;
public LIMIT?: string;
public LISTORD?: string;
public LOCX?: string;
public LOCY?: string;
public LOTMP?: string;
public LSTTMP?: string;
public MANHT?: "MANHT" | "ON" | "OFF";
public MANOVR?: "MANOVR" | "ON" | "OFF";
public MANUAL?: string;
public MAX?: string;
public MAXF?: string;
public MIN?: string;
public MINF?: string;
public MODE?: string;
public NAME?: string;
public OBJLIST?: ICParam[];
public OBJNAM?: string;
public OBJTYP?: string;
public OFFSET?: string;
public ORPSET?: string;
public ORPTNK?: string;
public ORPVAL?: string;
public PARENT?: string;
public PARTY?: string;
public PASSWRD?: string;
public PERMIT?: string;
public PHONE?: string;
public PHONE2?: string;
public PHSET?: string;
public PHTNK?: string;
public PHVAL?: string;
public PRIM?: string;
public PRIMFLO?: string;
public PRIMTIM?: string;
public PRIOR?: string;
public PROBE?: string;
public PROPNAME?: string;
public PWR?: string;
public QUALTY?: string;
public READY?: string;
public RLY?: string;
public RPM?: string;
public SALT?: string;
public SEC?: string;
public SELECT?: string;
public SERVICE?: "SERVICE" | "AUTO" | "TIMEOUT";
public SETTMP?: string;
public SETTMPNC?: string;
public SHARE?: string;
public SHOMNU?: string;
public SINDEX?: string;
public SNAME?: string;
public SOURCE?: string;
public SPEED?: string;
public SRIS?: string;
public SSET?: string;
public START?: string;
public STATE?: string;
public STATIC?: string;
public STATUS?: "STATUS" | "ON" | "OFF";
public STOP?: string;
public SUBTYP?: string;
public SUPER?: "SUPER" | "ON" | "OFF";
public SWIM?: string;
public SYNC?: string;
public SYSTIM?: string;
public TEMP?: string;
public TIME?: string;
public TIMOUT?: string;
public TIMZON?: string;
public UPDATE?: string;
public USAGE?: string;
public USE?: string;
public VACFLO?: "VACFLO" | "ON" | "OFF";
public VACTIM?: "VACTIM" | "ON" | "OFF";
public VALVE?: "VALVE" | "ON" | "OFF";
public VER?: string;
public VOL?: string;
public ZIP?: string;
}

View File

@ -1,8 +1,10 @@
import { v4 as uuidv4 } from "uuid";
import { ICParam } from "./param.js";
export class ICRequestObj {
public objnam = "";
public keys: string[] = [];
public params?: ICParam;
}
export class ICRequest {

View File

@ -1,131 +1,8 @@
export class ICResponseParam {
// "": "PROGRESS";
public ABSMAX?: string;
public ABSMIN?: string;
public ACT?: string;
public ACT1?: string;
public ACT2?: string;
public ACT3?: string;
public ACT4?: string;
public ADDRESS?: string;
public ALK?: string;
public AVAIL?: "AVAIL" | "ON" | "OFF";
public BADGE?: string;
public BODY?: string;
public BOOST?: string;
public CALC?: string;
public CALIB?: string;
public CHILD?: string;
public CIRCUIT?: string;
public CITY?: string;
public CLK24A?: string;
public COMUART?: string;
public COOL?: string;
public COUNT?: string;
public COUNTRY?: string;
public CYACID?: string;
public DAY?: string;
public DLSTIM?: "DLSTIM" | "ON" | "OFF";
public DLY?: string;
public DNTSTP?: string;
public EMAIL?: string;
public EMAIL2?: string;
public ENABLE?: "ENABLE" | "ON" | "OFF";
public FEATR?: string;
public FILTER?: string;
public FREEZE?: string;
public GPM?: string;
public HEATER?: string;
public HEATING?: "HEATING" | "ON" | "OFF";
public HITMP?: string;
public HNAME?: string;
public HTMODE?: string;
public HTSRC?: string;
public IN?: string;
public LIMIT?: string;
public LISTORD?: string;
public LOCX?: string;
public LOCY?: string;
public LOTMP?: string;
public LSTTMP?: string;
public MANHT?: "MANHT" | "ON" | "OFF";
public MANOVR?: "MANOVR" | "ON" | "OFF";
public MANUAL?: string;
public MAX?: string;
public MAXF?: string;
public MIN?: string;
public MINF?: string;
public MODE?: string;
public NAME?: string;
public OBJLIST?: ICResponseParam[];
public OBJNAM?: string;
public OBJTYP?: string;
public OFFSET?: string;
public ORPSET?: string;
public ORPTNK?: string;
public ORPVAL?: string;
public PARENT?: string;
public PARTY?: string;
public PASSWRD?: string;
public PERMIT?: string;
public PHONE?: string;
public PHONE2?: string;
public PHSET?: string;
public PHTNK?: string;
public PHVAL?: string;
public PRIM?: string;
public PRIMFLO?: string;
public PRIMTIM?: string;
public PRIOR?: string;
public PROBE?: string;
public PROPNAME?: string;
public PWR?: string;
public QUALTY?: string;
public READY?: string;
public RLY?: string;
public RPM?: string;
public SALT?: string;
public SEC?: string;
public SELECT?: string;
public SERVICE?: "SERVICE" | "AUTO" | "TIMEOUT";
public SETTMP?: string;
public SETTMPNC?: string;
public SHARE?: string;
public SHOMNU?: string;
public SINDEX?: string;
public SNAME?: string;
public SOURCE?: string;
public SPEED?: string;
public SRIS?: string;
public SSET?: string;
public START?: string;
public STATE?: string;
public STATIC?: string;
public STATUS?: string;
public STOP?: string;
public SUBTYP?: string;
public SUPER?: "SUPER" | "ON" | "OFF";
public SWIM?: string;
public SYNC?: string;
public SYSTIM?: string;
public TEMP?: string;
public TIME?: string;
public TIMOUT?: string;
public TIMZON?: string;
public UPDATE?: string;
public USAGE?: string;
public USE?: string;
public VACFLO?: "VACFLO" | "ON" | "OFF";
public VACTIM?: "VACTIM" | "ON" | "OFF";
public VALVE?: "VALVE" | "ON" | "OFF";
public VER?: string;
public VOL?: string;
public ZIP?: string;
}
import { ICParam } from "./param.js";
export class ICResponseObj {
public objnam = "";
public params?: ICResponseParam;
public params?: ICParam;
}
export class ICResponse {

28
messages/set-status.ts Normal file
View File

@ -0,0 +1,28 @@
import { ICParam } from "./param.js";
import { GetRequest, ICRequest, ICRequestObj } from "./request.js";
/**
* Requests the status of bodies known to this controller.
*
* The response contains the list of bodies in the `params` field. Each body has
* an `objnam` that should be used to reference that body for future requests.
* When `params`.`STATUS` is `"OFF"`, use `params`.`LSTTMP` to get the temperature
* of the body the last time it was on, or `params`.`TEMP` to get the temperature
* if the `STATUS` is `"ON"`. `LSTTMP` seems to always be accurate, however, whether
* the body is currently on or off.
*
* @returns the object used to issue this request
*/
export function SetItemStatus(item: string, status: boolean): ICRequest {
const req = GetRequest();
req.command = "SetParamList";
req.objectList = [];
const reqObj = new ICRequestObj();
reqObj.objnam = item;
reqObj.params = new ICParam();
reqObj.params.STATUS = status ? "ON" : "OFF";
req.objectList.push(reqObj);
return req;
}

View File

@ -2,7 +2,6 @@ import { EventEmitter } from "events";
import { WebSocket } from "ws";
import { ICRequest } from "./messages/request.js";
import { ICResponse } from "./messages/response.js";
import { GetSystemInfoRequest } from "./messages/system-info.js";
export class Unit extends EventEmitter {
private client?: WebSocket;
@ -69,9 +68,4 @@ export class Unit extends EventEmitter {
});
});
}
public async getSystemInfo(): Promise<ICResponse> {
const req = GetSystemInfoRequest();
return await this.send(req);
}
}