Skip to content

Commit

Permalink
add new state sendJSONNoSync
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucky-ESA committed Apr 25, 2024
1 parent 95a7c81 commit 6c05a1d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
14 changes: 14 additions & 0 deletions lib/heat_pump.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,19 @@ module.exports = {
},
native: {},
});
await this.setObjectNotExistsAsync(device.deviceId + ".remote.sendJSONNoSync", {
type: "state",
common: {
name: "sendJSONNoSync",
type: "string",
write: true,
read: true,
role: "json",
desc: "sendJSON",
def: "",
},
native: {},
});
},
async addHeat(device) {
const obj = await this.getObjectAsync(
Expand Down Expand Up @@ -337,6 +350,7 @@ module.exports = {
"dataValue": null
};
const response = await this.sendCommandToDevice(device, data);
this.log.debug(`response update: ${JSON.stringify(response)}`);
if (
response &&
response.result &&
Expand Down
11 changes: 8 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class LgThinq extends utils.Adapter {
try {
if (!this.jsessionId) {
const jsessionId = await this.getJSessionId();
this.log.debug(JSON.stringify(`jsessionId: ${this.jsessionId}`));
this.log.debug(`jsessionId: ${JSON.stringify(jsessionId)}`);
if (jsessionId && jsessionId.jsessionId) {
this.jsessionId = jsessionId.jsessionId;
}
Expand Down Expand Up @@ -2170,6 +2170,7 @@ class LgThinq extends utils.Adapter {
data = values;
}
this.log.debug("sendCommandToDevice: " + JSON.stringify(data));
this.log.debug("sendCommandToDevice URL: " + JSON.stringify(controlUrl));

return this.requestClient
.post(controlUrl, data, { headers })
Expand Down Expand Up @@ -2255,11 +2256,15 @@ class LgThinq extends utils.Adapter {
return;
}
let no_for = false;
if (lastsplit === "sendJSON") {
if (lastsplit === "sendJSON" || lastsplit === "sendJSONNoSync") {
let controlsync = "/control-sync";
if (lastsplit === "sendJSONNoSync") {
controlsync = "/control";
}
const headers = this.defaultHeaders;
const controlUrl = this.resolveUrl(
this.gateway.thinq2Uri + "/",
"service/devices/" + deviceId + "/control-sync",
"service/devices/" + deviceId + controlsync,
);
const js = state.val != null ? state.val.toString() : "";
let sendData;
Expand Down

0 comments on commit 6c05a1d

Please sign in to comment.