From 8cb755291ecefb7d4eefd469f25ee4c021a0eb2f Mon Sep 17 00:00:00 2001 From: zhongpei-ge Date: Tue, 10 Dec 2024 17:09:06 +0800 Subject: [PATCH] fix-an-issue-of-thermostat-does-not-support-fan-speed --- ...n-speed-cooling-only-nostate-nobattery.yml | 20 ++++++++++ ...rmostat-fan-speed-cooling-only-nostate.yml | 22 +++++++++++ .../thermostat-fan-speed-cooling-only.yml | 24 ++++++++++++ ...n-speed-heating-only-nostate-nobattery.yml | 20 ++++++++++ ...rmostat-fan-speed-heating-only-nostate.yml | 22 +++++++++++ .../thermostat-fan-speed-heating-only.yml | 24 ++++++++++++ ...thermostat-fan-speed-nostate-nobattery.yml | 22 +++++++++++ .../profiles/thermostat-fan-speed-nostate.yml | 24 ++++++++++++ .../profiles/thermostat-fan-speed.yml | 26 +++++++++++++ ...n-speed-cooling-only-nostate-nobattery.yml | 22 +++++++++++ ...umidity-fan-speed-cooling-only-nostate.yml | 24 ++++++++++++ ...mostat-humidity-fan-speed-cooling-only.yml | 26 +++++++++++++ ...n-speed-heating-only-nostate-nobattery.yml | 22 +++++++++++ ...umidity-fan-speed-heating-only-nostate.yml | 24 ++++++++++++ ...mostat-humidity-fan-speed-heating-only.yml | 26 +++++++++++++ ...t-humidity-fan-speed-nostate-nobattery.yml | 24 ++++++++++++ .../thermostat-humidity-fan-speed-nostate.yml | 26 +++++++++++++ .../thermostat-humidity-fan-speed.yml | 28 ++++++++++++++ .../matter-thermostat/src/init.lua | 38 ++++++++++++++++++- 19 files changed, 462 insertions(+), 2 deletions(-) create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only-nostate-nobattery.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only-nostate.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only-nostate-nobattery.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only-nostate.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-nostate-nobattery.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-nostate.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only-nostate-nobattery.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only-nostate.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only-nostate-nobattery.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only-nostate.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-nostate-nobattery.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-nostate.yml create mode 100644 drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed.yml diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only-nostate-nobattery.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only-nostate-nobattery.yml new file mode 100644 index 0000000000..7559f7b657 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only-nostate-nobattery.yml @@ -0,0 +1,20 @@ +name: thermostat-fan-speed-cooling-only-nostate-nobattery +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only-nostate.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only-nostate.yml new file mode 100644 index 0000000000..02387dc42e --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only-nostate.yml @@ -0,0 +1,22 @@ +name: thermostat-fan-speed-cooling-only-nostate +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only.yml new file mode 100644 index 0000000000..58645889ac --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-cooling-only.yml @@ -0,0 +1,24 @@ +name: thermostat-fan-speed-cooling-only +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: thermostatOperatingState + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only-nostate-nobattery.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only-nostate-nobattery.yml new file mode 100644 index 0000000000..6181610eae --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only-nostate-nobattery.yml @@ -0,0 +1,20 @@ +name: thermostat-fan-speed-heating-only-nostate-nobattery +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only-nostate.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only-nostate.yml new file mode 100644 index 0000000000..01a6cd30dc --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only-nostate.yml @@ -0,0 +1,22 @@ +name: thermostat-fan-speed-heating-only-nostate +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only.yml new file mode 100644 index 0000000000..fa330c92a3 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-heating-only.yml @@ -0,0 +1,24 @@ +name: thermostat-fan-speed-heating-only +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: thermostatOperatingState + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-nostate-nobattery.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-nostate-nobattery.yml new file mode 100644 index 0000000000..ff6645a1dd --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-nostate-nobattery.yml @@ -0,0 +1,22 @@ +name: thermostat-fan-speed-nostate-nobattery +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-nostate.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-nostate.yml new file mode 100644 index 0000000000..a183ee91c4 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed-nostate.yml @@ -0,0 +1,24 @@ +name: thermostat-fan-speed-nostate +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed.yml new file mode 100644 index 0000000000..71603e65d0 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-fan-speed.yml @@ -0,0 +1,26 @@ +name: thermostat-fan-speed +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: thermostatOperatingState + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only-nostate-nobattery.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only-nostate-nobattery.yml new file mode 100644 index 0000000000..9210cc58a2 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only-nostate-nobattery.yml @@ -0,0 +1,22 @@ +name: thermostat-humidity-fan-speed-cooling-only-nostate-nobattery +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only-nostate.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only-nostate.yml new file mode 100644 index 0000000000..8f63dacc72 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only-nostate.yml @@ -0,0 +1,24 @@ +name: thermostat-humidity-fan-speed-cooling-only-nostate +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only.yml new file mode 100644 index 0000000000..9e5d2f39fa --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-cooling-only.yml @@ -0,0 +1,26 @@ +name: thermostat-humidity-fan-speed-cooling-only +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: thermostatOperatingState + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only-nostate-nobattery.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only-nostate-nobattery.yml new file mode 100644 index 0000000000..e82a44ae3a --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only-nostate-nobattery.yml @@ -0,0 +1,22 @@ +name: thermostat-humidity-fan-speed-heating-only-nostate-nobattery +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only-nostate.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only-nostate.yml new file mode 100644 index 0000000000..1cda8b21d7 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only-nostate.yml @@ -0,0 +1,24 @@ +name: thermostat-humidity-fan-speed-heating-only-nostate +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only.yml new file mode 100644 index 0000000000..b492742a23 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-heating-only.yml @@ -0,0 +1,26 @@ +name: thermostat-humidity-fan-speed-heating-only +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: thermostatOperatingState + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-nostate-nobattery.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-nostate-nobattery.yml new file mode 100644 index 0000000000..2d457b9eef --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-nostate-nobattery.yml @@ -0,0 +1,24 @@ +name: thermostat-humidity-fan-speed-nostate-nobattery +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-nostate.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-nostate.yml new file mode 100644 index 0000000000..7cc4718e78 --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed-nostate.yml @@ -0,0 +1,26 @@ +name: thermostat-humidity-fan-speed-nostate +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed.yml b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed.yml new file mode 100644 index 0000000000..c80a0a741f --- /dev/null +++ b/drivers/SmartThings/matter-thermostat/profiles/thermostat-humidity-fan-speed.yml @@ -0,0 +1,28 @@ +name: thermostat-humidity-fan-speed +components: +- id: main + capabilities: + - id: fanSpeedPercent + version: 1 + - id: temperatureMeasurement + version: 1 + - id: thermostatMode + version: 1 + - id: thermostatFanMode + version: 1 + - id: thermostatHeatingSetpoint + version: 1 + - id: thermostatCoolingSetpoint + version: 1 + - id: thermostatOperatingState + version: 1 + - id: relativeHumidityMeasurement + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: Thermostat diff --git a/drivers/SmartThings/matter-thermostat/src/init.lua b/drivers/SmartThings/matter-thermostat/src/init.lua index 5571326297..8223e9053a 100644 --- a/drivers/SmartThings/matter-thermostat/src/init.lua +++ b/drivers/SmartThings/matter-thermostat/src/init.lua @@ -270,6 +270,8 @@ local function component_to_endpoint(device, component_name) if device:supports_capability(capabilities.airPurifierFanMode) then -- Fan Control is mandatory for the Air Purifier device type return find_default_endpoint(device, clusters.FanControl.ID) + elseif device:supports_capability(capabilities.fanSpeedPercent) then + return find_default_endpoint(device, clusters.FanControl.ID) else -- Thermostat is mandatory for Thermostat and Room AC device type return find_default_endpoint(device, clusters.Thermostat.ID) @@ -440,6 +442,7 @@ local function do_configure(driver, device) local thermostat_eps = device:get_endpoints(clusters.Thermostat.ID) local humidity_eps = device:get_endpoints(clusters.RelativeHumidityMeasurement.ID) local battery_eps = device:get_endpoints(clusters.PowerSource.ID, {feature_bitmap = clusters.PowerSource.types.PowerSourceFeature.BATTERY}) + local fan_speed_eps = device:get_endpoints(clusters.FanControl.ID, {feature_bitmap = clusters.FanControl.types.Feature.MULTI_SPEED}) local device_type = get_device_type(driver, device) local profile_name if device_type == RAC_DEVICE_TYPE_ID then @@ -467,9 +470,36 @@ local function do_configure(driver, device) end elseif device_type == FAN_DEVICE_TYPE_ID then - profile_name = create_fan_profile(device) + if #thermostat_eps > 0 then + profile_name = "thermostat" + + if #humidity_eps > 0 then + profile_name = profile_name .. "-humidity" + end + + profile_name = profile_name .. "-fan" + + if #fan_speed_eps > 0 then + profile_name = profile_name .. "-speed" + end + + local thermostat_modes = create_thermostat_modes_profile(device) + if thermostat_modes == "No Heating nor Cooling Support" then + return + else + profile_name = profile_name .. thermostat_modes + end + + profile_name = profile_name .. "-nostate" + + if #battery_eps == 0 then + profile_name = profile_name .. "-nobattery" + end + else + profile_name = create_fan_profile(device) + profile_name = string.sub(profile_name, 2) + end -- remove leading "-" - profile_name = string.sub(profile_name, 2) if profile_name == "fan" then profile_name = "fan-generic" end @@ -515,6 +545,10 @@ local function do_configure(driver, device) if fan_name ~= "" then profile_name = profile_name .. "-fan" end + + if #fan_speed_eps > 0 then + profile_name = profile_name .. "-speed" + end local thermostat_modes = create_thermostat_modes_profile(device) if thermostat_modes == "No Heating nor Cooling Support" then