Skip to content

Commit

Permalink
Fixed single control switch and outlet control issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanh94 committed Sep 29, 2021
1 parent d74448d commit e00de41
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
7 changes: 6 additions & 1 deletion lib/outlet_accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class OutletAccessory extends BaseAccessory {
let service
if (this.subTypeArr.length == 1) {
service = this.service;
this.switchValue = status;
}else{
service = this.homebridgeAccessory.getService(subType);
}
Expand Down Expand Up @@ -83,7 +84,11 @@ class OutletAccessory extends BaseAccessory {
var code;
var value;
const isOn = value ? true : false;
code = name;
if (this.subTypeArr.length == 1) {
code = this.switchValue.code;
}else{
code = name;
}
value = isOn;
return {
"commands": [
Expand Down
7 changes: 6 additions & 1 deletion lib/switch_accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class SwitchAccessory extends BaseAccessory {
let service
if (this.subTypeArr.length == 1) {
service = this.service;
this.switchValue = status;
}else{
service = this.homebridgeAccessory.getService(subType);
}
Expand Down Expand Up @@ -78,7 +79,11 @@ class SwitchAccessory extends BaseAccessory {
var code;
var value;
const isOn = value ? true : false;
code = name;
if (this.subTypeArr.length == 1) {
code = this.switchValue.code;
}else{
code = name;
}
value = isOn;
return {
"commands": [
Expand Down
2 changes: 1 addition & 1 deletion lib/tuyaopenapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class TuyaOpenAPI {
'lang': this.lang,
'dev_lang': 'javascript',
'dev_channel': 'homebridge',
'devVersion': '1.4.1',
'devVersion': '1.4.2',

};
this.log.log(`TuyaOpenAPI request: method = ${method}, endpoint = ${this.endpoint}, path = ${path}, params = ${JSON.stringify(params)}, body = ${JSON.stringify(body)}, headers = ${JSON.stringify(headers)}`);
Expand Down
2 changes: 1 addition & 1 deletion lib/tuyashopenapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class TuyaSHOpenAPI {
'lang': this.lang,
'dev_lang': 'javascript',
'dev_channel': 'homebridge',
'devVersion': '1.4.1',
'devVersion': '1.4.2',

};
this.log.log(`TuyaOpenAPI request: method = ${method}, endpoint = ${this.endpoint}, path = ${path}, params = ${JSON.stringify(params)}, body = ${JSON.stringify(body)}, headers = ${JSON.stringify(headers)}`);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-tuya-platform",
"version": "1.4.1",
"version": "1.4.2",
"description": "Official Homebridge plugin for Tuya Open API, maintained by the Tuya Developer Team.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e00de41

Please sign in to comment.