Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gree-hvac-client to allow autodetect of encryption mode #171

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -1479,37 +1479,6 @@
"hint": {
"en": "Enable debug in case the application is crashing. It allows developer to investigate the issue"
}
},
{
"id": "encryption_mode",
"type": "dropdown",
"value": "auto",
"label": {
"en": "Encryption mode"
},
"hint": {
"en": "Encryption mode used by the HVAC. Most recent firmwares use V2"
},
"values": [
{
"id": "auto",
"label": {
"en": "Autodetect (not implemented yet, V1 used instead)"
}
},
{
"id": "v1",
"label": {
"en": "V1 (HVAC Firmware versions <1.21)"
}
},
{
"id": "v2",
"label": {
"en": "V2 (HVAC Firmware versions >=1.21)"
}
}
]
}
],
"images": {
Expand Down
21 changes: 0 additions & 21 deletions drivers/gree_cooper_hunter_hvac/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class GreeHVACDevice extends Homey.Device {

const deviceData = this.getData();
const settings = this.getSettings();
const encryptionVersion = this.mapEncryptionModeSetting(settings.encryption_mode);

this.log('[find devices]', 'Finding device with mac:', deviceData.mac);

Expand All @@ -104,7 +103,6 @@ class GreeHVACDevice extends Homey.Device {
pollingInterval: POLLING_INTERVAL,
pollingTimeout: POLLING_TIMEOUT,
connectTimeout: CONNECT_TIMEOUT,
encryptionVersion,
});

this._registerClientListeners();
Expand Down Expand Up @@ -676,28 +674,9 @@ class GreeHVACDevice extends Homey.Device {
}
}

if (changedKeys.indexOf('encryption_mode') > -1) {
this.log('Changing the encryption mode setting from', oldSettings.encryption_mode, 'to', newSettings.encryption_mode);
this.homey.setTimeout(this.reconnect.bind(this), 1000);
}

return Promise.resolve();
}

mapEncryptionModeSetting(encryptionMode) {
switch (encryptionMode) {
// not implemented yet
case 'auto':
case 'v1':
default:
// AES-ECB
return 1;
case 'v2':
// AES-GCM
return 2;
}
}

reconnect() {
this.log('Reconnecting to the HVAC');
this._markOffline();
Expand Down
31 changes: 0 additions & 31 deletions drivers/gree_cooper_hunter_hvac/driver.compose.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,37 +106,6 @@
"hint": {
"en": "Enable debug in case the application is crashing. It allows developer to investigate the issue"
}
},
{
"id": "encryption_mode",
"type": "dropdown",
"value": "auto",
"label": {
"en": "Encryption mode"
},
"hint": {
"en": "Encryption mode used by the HVAC. Most recent firmwares use V2"
},
"values": [
{
"id": "auto",
"label": {
"en": "Autodetect (not implemented yet, V1 used instead)"
}
},
{
"id": "v1",
"label": {
"en": "V1 (HVAC Firmware versions <1.21)"
}
},
{
"id": "v2",
"label": {
"en": "V2 (HVAC Firmware versions >=1.21)"
}
}
]
}
],
"images": {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"homepage": "https://github.com/aivus/com.gree#readme",
"dependencies": {
"gree-hvac-client": "github:aivus/gree-hvac-client#com.gree/encryption",
"gree-hvac-client": "github:aivus/gree-hvac-client#com.gree/gcm",
"homey-log": "^2.1.0"
},
"devDependencies": {
Expand Down