mirror of
https://github.com/parnic/node-intellicenter.git
synced 2025-06-16 18:20:14 -05:00
Initial request/response object structure
No idea if this will be the best way to represent this stuff long-term, but it's working at the moment. I have some reservations about attempting to list all the possible ResponseParam keys, but I'm already this far in and it would be nice if it worked out...
This commit is contained in:
41
dist/index.js
vendored
41
dist/index.js
vendored
@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
import { WebSocket } from "ws";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { FindUnits } from "./finder.js";
|
||||
import { GetSystemInfoRequest } from "./messages/system-info.js";
|
||||
console.log("searching...");
|
||||
const f = new FindUnits();
|
||||
const units = await f.searchAsync(1000);
|
||||
@ -31,7 +31,7 @@ client.on("close", () => {
|
||||
clearTimeout(pingTimeout);
|
||||
});
|
||||
client.on("message", (msg) => {
|
||||
const respObj = JSON.parse(msg.toString()); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
||||
const respObj = JSON.parse(msg.toString());
|
||||
console.log(JSON.stringify(respObj, null, 2));
|
||||
});
|
||||
await new Promise((resolve, reject) => {
|
||||
@ -40,42 +40,7 @@ await new Promise((resolve, reject) => {
|
||||
}).then(() => {
|
||||
console.log("connected");
|
||||
console.log("sending request...");
|
||||
const req = {
|
||||
condition: "",
|
||||
objectList: [
|
||||
{
|
||||
objnam: "_5451",
|
||||
keys: [
|
||||
"VER",
|
||||
"MODE",
|
||||
"ZIP",
|
||||
"TIMZON",
|
||||
"PROPNAME",
|
||||
"NAME",
|
||||
"ADDRESS",
|
||||
"CITY",
|
||||
"STATE",
|
||||
"PHONE",
|
||||
"PHONE2",
|
||||
"EMAIL",
|
||||
"EMAIL2",
|
||||
"COUNTRY",
|
||||
"PHONE",
|
||||
"LOCX",
|
||||
"LOCY",
|
||||
"AVAIL",
|
||||
"SERVICE",
|
||||
"UPDATE",
|
||||
"PROGRESS",
|
||||
"IN",
|
||||
"VALVE",
|
||||
"HEATING",
|
||||
],
|
||||
},
|
||||
],
|
||||
command: "GETPARAMLIST",
|
||||
messageID: uuidv4(),
|
||||
};
|
||||
const req = GetSystemInfoRequest();
|
||||
client.send(JSON.stringify(req));
|
||||
client.close();
|
||||
});
|
||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC5B,MAAM,CAAC,GAAG,IAAI,SAAS,EAAE,CAAC;AAC1B,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC,CAAC,KAAK,EAAE,CAAC;AACV,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AAExC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IACvB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAC5D,CAAC;AAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IACrB,MAAM,IAAI,KAAK,CACb,oEAAoE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAC5F,CAAC;AACJ,CAAC;AAED,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;AACrC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAE3B,IAAI,WAA0C,CAAC;AAE/C,OAAO,CAAC,GAAG,CAAC,uCAAuC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAC7E,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,QA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C,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC;AACH,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IACpC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;IACX,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACzB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,MAAM,CAAC,KAAK,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
13
dist/messages/request.d.ts
vendored
Normal file
13
dist/messages/request.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
export declare class ICRequestObj {
|
||||
objnam: string;
|
||||
keys: string[];
|
||||
}
|
||||
export declare class ICRequest {
|
||||
condition?: string;
|
||||
objectList?: ICRequestObj[];
|
||||
queryName?: string;
|
||||
arguments?: string[] | string;
|
||||
command: string;
|
||||
messageID: string;
|
||||
}
|
||||
export declare function GetRequest(): ICRequest;
|
19
dist/messages/request.js
vendored
Normal file
19
dist/messages/request.js
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
export class ICRequestObj {
|
||||
objnam = "";
|
||||
keys = [];
|
||||
}
|
||||
export class ICRequest {
|
||||
condition;
|
||||
objectList;
|
||||
queryName;
|
||||
arguments;
|
||||
command = "";
|
||||
messageID = "";
|
||||
}
|
||||
export function GetRequest() {
|
||||
const req = new ICRequest();
|
||||
req.messageID = uuidv4();
|
||||
return req;
|
||||
}
|
||||
//# sourceMappingURL=request.js.map
|
1
dist/messages/request.js.map
vendored
Normal file
1
dist/messages/request.js.map
vendored
Normal file
@ -0,0 +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"}
|
137
dist/messages/response.d.ts
vendored
Normal file
137
dist/messages/response.d.ts
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
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;
|
||||
}
|
||||
export declare class ICResponseObj {
|
||||
objnam: string;
|
||||
params?: ICResponseParam;
|
||||
}
|
||||
export declare class ICResponse {
|
||||
command: string;
|
||||
messageID: string;
|
||||
response: string;
|
||||
objectList?: ICResponseObj[];
|
||||
queryName?: string;
|
||||
answer?: ICResponseObj[];
|
||||
timeSince?: string;
|
||||
timeNow?: string;
|
||||
}
|
139
dist/messages/response.js
vendored
Normal file
139
dist/messages/response.js
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
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;
|
||||
}
|
||||
export class ICResponse {
|
||||
command = "";
|
||||
messageID = "";
|
||||
response = "";
|
||||
objectList;
|
||||
queryName;
|
||||
answer;
|
||||
timeSince;
|
||||
timeNow;
|
||||
}
|
||||
//# sourceMappingURL=response.js.map
|
1
dist/messages/response.js.map
vendored
Normal file
1
dist/messages/response.js.map
vendored
Normal file
@ -0,0 +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;IACf,MAAM,CAAU;IAChB,MAAM,CAA2B;IACjC,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,MAAM,CAAU;IAChB,GAAG,CAAU;IACb,MAAM,CAAU;IAChB,OAAO,CAA4B;IACnC,KAAK,CAAU;IACf,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,KAAK,CAAU;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AChB,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"}
|
2
dist/messages/system-info.d.ts
vendored
Normal file
2
dist/messages/system-info.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import { ICRequest } from "./request.js";
|
||||
export declare function GetSystemInfoRequest(): ICRequest;
|
38
dist/messages/system-info.js
vendored
Normal file
38
dist/messages/system-info.js
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
import { GetRequest, ICRequestObj } from "./request.js";
|
||||
export function GetSystemInfoRequest() {
|
||||
const req = GetRequest();
|
||||
req.command = "GETPARAMLIST";
|
||||
req.condition = "";
|
||||
req.objectList = [];
|
||||
const reqObj = new ICRequestObj();
|
||||
reqObj.objnam = "_5451";
|
||||
reqObj.keys = [
|
||||
"VER",
|
||||
"MODE",
|
||||
"ZIP",
|
||||
"TIMZON",
|
||||
"PROPNAME",
|
||||
"NAME",
|
||||
"ADDRESS",
|
||||
"CITY",
|
||||
"STATE",
|
||||
"PHONE",
|
||||
"PHONE2",
|
||||
"EMAIL",
|
||||
"EMAIL2",
|
||||
"COUNTRY",
|
||||
"PHONE",
|
||||
"LOCX",
|
||||
"LOCY",
|
||||
"AVAIL",
|
||||
"SERVICE",
|
||||
"UPDATE",
|
||||
"PROGRESS",
|
||||
"IN",
|
||||
"VALVE",
|
||||
"HEATING",
|
||||
];
|
||||
req.objectList.push(reqObj);
|
||||
return req;
|
||||
}
|
||||
//# sourceMappingURL=system-info.js.map
|
1
dist/messages/system-info.js.map
vendored
Normal file
1
dist/messages/system-info.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"system-info.js","sourceRoot":"","sources":["../../messages/system-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,YAAY,EAAE,MAAM,cAAc,CAAC;AAEnE,MAAM,UAAU,oBAAoB;IAClC,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,GAAG,CAAC,OAAO,GAAG,cAAc,CAAC;IAC7B,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC;IACnB,GAAG,CAAC,UAAU,GAAG,EAAE,CAAC;IAEpB,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAClC,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC;IACxB,MAAM,CAAC,IAAI,GAAG;QACZ,KAAK;QACL,MAAM;QACN,KAAK;QACL,QAAQ;QACR,UAAU;QACV,MAAM;QACN,SAAS;QACT,MAAM;QACN,OAAO;QACP,OAAO;QACP,QAAQ;QACR,OAAO;QACP,QAAQ;QACR,SAAS;QACT,OAAO;QACP,MAAM;QACN,MAAM;QACN,OAAO;QACP,SAAS;QACT,QAAQ;QACR,UAAU;QACV,IAAI;QACJ,OAAO;QACP,SAAS;KACV,CAAC;IACF,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE5B,OAAO,GAAG,CAAC;AACb,CAAC"}
|
42
index.ts
42
index.ts
@ -1,8 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
import { WebSocket } from "ws";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { FindUnits } from "./finder.js";
|
||||
import { GetSystemInfoRequest } from "./messages/system-info.js";
|
||||
import { ICResponse } from "./messages/response.js";
|
||||
|
||||
console.log("searching...");
|
||||
const f = new FindUnits();
|
||||
@ -44,7 +45,7 @@ client.on("close", () => {
|
||||
});
|
||||
|
||||
client.on("message", (msg: Buffer) => {
|
||||
const respObj = JSON.parse(msg.toString()); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
|
||||
const respObj = JSON.parse(msg.toString()) as ICResponse;
|
||||
console.log(JSON.stringify(respObj, null, 2));
|
||||
});
|
||||
await new Promise((resolve, reject) => {
|
||||
@ -53,42 +54,7 @@ await new Promise((resolve, reject) => {
|
||||
}).then(() => {
|
||||
console.log("connected");
|
||||
console.log("sending request...");
|
||||
const req = {
|
||||
condition: "",
|
||||
objectList: [
|
||||
{
|
||||
objnam: "_5451",
|
||||
keys: [
|
||||
"VER",
|
||||
"MODE",
|
||||
"ZIP",
|
||||
"TIMZON",
|
||||
"PROPNAME",
|
||||
"NAME",
|
||||
"ADDRESS",
|
||||
"CITY",
|
||||
"STATE",
|
||||
"PHONE",
|
||||
"PHONE2",
|
||||
"EMAIL",
|
||||
"EMAIL2",
|
||||
"COUNTRY",
|
||||
"PHONE",
|
||||
"LOCX",
|
||||
"LOCY",
|
||||
"AVAIL",
|
||||
"SERVICE",
|
||||
"UPDATE",
|
||||
"PROGRESS",
|
||||
"IN",
|
||||
"VALVE",
|
||||
"HEATING",
|
||||
],
|
||||
},
|
||||
],
|
||||
command: "GETPARAMLIST",
|
||||
messageID: uuidv4(),
|
||||
};
|
||||
const req = GetSystemInfoRequest();
|
||||
client.send(JSON.stringify(req));
|
||||
client.close();
|
||||
});
|
||||
|
21
messages/request.ts
Normal file
21
messages/request.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export class ICRequestObj {
|
||||
public objnam = "";
|
||||
public keys: string[] = [];
|
||||
}
|
||||
|
||||
export class ICRequest {
|
||||
public condition?: string;
|
||||
public objectList?: ICRequestObj[];
|
||||
public queryName?: string;
|
||||
public arguments?: string[] | string;
|
||||
public command = "";
|
||||
public messageID = "";
|
||||
}
|
||||
|
||||
export function GetRequest(): ICRequest {
|
||||
const req = new ICRequest();
|
||||
req.messageID = uuidv4();
|
||||
return req;
|
||||
}
|
140
messages/response.ts
Normal file
140
messages/response.ts
Normal file
@ -0,0 +1,140 @@
|
||||
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;
|
||||
}
|
||||
|
||||
export class ICResponseObj {
|
||||
public objnam = "";
|
||||
public params?: ICResponseParam;
|
||||
}
|
||||
|
||||
export class ICResponse {
|
||||
public command = "";
|
||||
public messageID = "";
|
||||
public response = "";
|
||||
public objectList?: ICResponseObj[];
|
||||
public queryName?: string;
|
||||
public answer?: ICResponseObj[];
|
||||
public timeSince?: string;
|
||||
public timeNow?: string;
|
||||
}
|
40
messages/system-info.ts
Normal file
40
messages/system-info.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import { GetRequest, ICRequest, ICRequestObj } from "./request.js";
|
||||
|
||||
export function GetSystemInfoRequest(): ICRequest {
|
||||
const req = GetRequest();
|
||||
req.command = "GETPARAMLIST";
|
||||
req.condition = "";
|
||||
req.objectList = [];
|
||||
|
||||
const reqObj = new ICRequestObj();
|
||||
reqObj.objnam = "_5451";
|
||||
reqObj.keys = [
|
||||
"VER",
|
||||
"MODE",
|
||||
"ZIP",
|
||||
"TIMZON",
|
||||
"PROPNAME",
|
||||
"NAME",
|
||||
"ADDRESS",
|
||||
"CITY",
|
||||
"STATE",
|
||||
"PHONE",
|
||||
"PHONE2",
|
||||
"EMAIL",
|
||||
"EMAIL2",
|
||||
"COUNTRY",
|
||||
"PHONE",
|
||||
"LOCX",
|
||||
"LOCY",
|
||||
"AVAIL",
|
||||
"SERVICE",
|
||||
"UPDATE",
|
||||
"PROGRESS",
|
||||
"IN",
|
||||
"VALVE",
|
||||
"HEATING",
|
||||
];
|
||||
req.objectList.push(reqObj);
|
||||
|
||||
return req;
|
||||
}
|
Reference in New Issue
Block a user