From 067e8bec9dc071452f3274b95969378203b53649 Mon Sep 17 00:00:00 2001 From: Illia Antypenko Date: Fri, 20 Sep 2024 22:58:54 +0200 Subject: [PATCH] Migrate class for existing devices --- drivers/gree_cooper_hunter_hvac/device.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gree_cooper_hunter_hvac/device.js b/drivers/gree_cooper_hunter_hvac/device.js index 3a067b9..931bde4 100644 --- a/drivers/gree_cooper_hunter_hvac/device.js +++ b/drivers/gree_cooper_hunter_hvac/device.js @@ -45,6 +45,7 @@ class GreeHVACDevice extends Homey.Device { this._flowTriggerQuietModeChanged = this.homey.flow.getDeviceTriggerCard('quiet_mode_changed'); await this._executeCapabilityMigrations(); + await this._executeDeviceClassMigration(); this._registerCapabilityListeners(); this._markOffline(); @@ -616,6 +617,12 @@ class GreeHVACDevice extends Homey.Device { } } + async _executeDeviceClassMigration() { + if (this.getClass() !== 'airconditioning') { + await this.setClass('airconditioning').catch(this.error); + } + } + /** * Set value for the specific property of the HVAC _client *