Skip to content

Commit

Permalink
Use PoC from upstream of gree-hvac-client to handle new encryption (#175
Browse files Browse the repository at this point in the history
)
  • Loading branch information
aivus authored Nov 22, 2024
1 parent 435f3c0 commit 731b45c
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 86 deletions.
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
4 changes: 2 additions & 2 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/public-aes-gcm-poc",
"homey-log": "^2.1.0"
},
"devDependencies": {
Expand Down

0 comments on commit 731b45c

Please sign in to comment.