From 58877c27575e5a2e337abff7f7970b33d09273bf Mon Sep 17 00:00:00 2001 From: HunsupJung <59987061+HunsupJung@users.noreply.github.com> Date: Wed, 13 Nov 2024 15:54:42 +0900 Subject: [PATCH] Set setpoint to original value (#1743) Signed-off-by: Hunsup Jung --- drivers/SmartThings/matter-thermostat/src/init.lua | 8 ++++---- .../src/test/test_matter_thermo_setpoint_limits.lua | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/SmartThings/matter-thermostat/src/init.lua b/drivers/SmartThings/matter-thermostat/src/init.lua index 62596cb072..746ebe4702 100644 --- a/drivers/SmartThings/matter-thermostat/src/init.lua +++ b/drivers/SmartThings/matter-thermostat/src/init.lua @@ -1122,7 +1122,7 @@ local function set_setpoint(setpoint) "Invalid setpoint (%s) outside the min (%s) and the max (%s)", value, min, max )) - device:emit_event(capabilities.thermostatHeatingSetpoint.heatingSetpoint(heating_setpoint)) + device:emit_event(capabilities.thermostatHeatingSetpoint.heatingSetpoint(heating_setpoint, {state_change = true})) return end if is_auto_capable and value > (cached_cooling_val - deadband) then @@ -1130,7 +1130,7 @@ local function set_setpoint(setpoint) "Invalid setpoint (%s) is greater than the cooling setpoint (%s) with the deadband (%s)", value, cooling_setpoint, deadband )) - device:emit_event(capabilities.thermostatHeatingSetpoint.heatingSetpoint(heating_setpoint)) + device:emit_event(capabilities.thermostatHeatingSetpoint.heatingSetpoint(heating_setpoint, {state_change = true})) return end else @@ -1141,7 +1141,7 @@ local function set_setpoint(setpoint) "Invalid setpoint (%s) outside the min (%s) and the max (%s)", value, min, max )) - device:emit_event(capabilities.thermostatCoolingSetpoint.coolingSetpoint(cooling_setpoint)) + device:emit_event(capabilities.thermostatCoolingSetpoint.coolingSetpoint(cooling_setpoint, {state_change = true})) return end if is_auto_capable and value < (cached_heating_val + deadband) then @@ -1149,7 +1149,7 @@ local function set_setpoint(setpoint) "Invalid setpoint (%s) is less than the heating setpoint (%s) with the deadband (%s)", value, heating_setpoint, deadband )) - device:emit_event(capabilities.thermostatCoolingSetpoint.coolingSetpoint(cooling_setpoint)) + device:emit_event(capabilities.thermostatCoolingSetpoint.coolingSetpoint(cooling_setpoint, {state_change = true})) return end end diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua index cd046f9347..976e9a78b2 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua @@ -87,8 +87,8 @@ local function test_init() end test.set_test_init_function(test_init) -local cached_heating_setpoint = capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 24.44, unit = "C" }) -local cached_cooling_setpoint = capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 26.67, unit = "C" }) +local cached_heating_setpoint = capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 24.44, unit = "C" }, {state_change = true}) +local cached_cooling_setpoint = capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 26.67, unit = "C" }, {state_change = true}) local function configure(device) test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) @@ -106,10 +106,10 @@ local function configure(device) clusters.Thermostat.attributes.OccupiedCoolingSetpoint:build_test_report_data(mock_device, 1, 2667) --26.67 celcius }) test.socket.capability:__expect_send( - device:generate_test_message("main", cached_heating_setpoint) + device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 24.44, unit = "C" })) ) test.socket.capability:__expect_send( - device:generate_test_message("main", cached_cooling_setpoint) + device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 26.67, unit = "C" })) ) test.wait_for_events() end