Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function can_handle_aeotec_radiator_thermostat(opts, driver, device, ...)
local AEOTEC_THERMOSTAT_FINGERPRINT = {mfr = 0x0371, prod = 0x0002, model = 0x0015}

if device:id_match(AEOTEC_THERMOSTAT_FINGERPRINT.mfr, AEOTEC_THERMOSTAT_FINGERPRINT.prod, AEOTEC_THERMOSTAT_FINGERPRINT.model) then
return true, require "aeotec-radiator-thermostat"
else
return false
end
end

return can_handle_aeotec_radiator_thermostat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: newline

Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
-- Copyright 2022 SmartThings
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


local capabilities = require "st.capabilities"
--- @type st.zwave.CommandClass
Expand All @@ -24,12 +14,6 @@ local SensorMultilevel = (require "st.zwave.CommandClass.SensorMultilevel")({ver
--- @type st.zwave.CommandClass.ThermostatSetpoint
local ThermostatSetpoint = (require "st.zwave.CommandClass.ThermostatSetpoint")({version=1})

local AEOTEC_THERMOSTAT_FINGERPRINT = {mfr = 0x0371, prod = 0x0002, model = 0x0015}

local function can_handle_aeotec_radiator_thermostat(opts, driver, device, ...)
return device:id_match(AEOTEC_THERMOSTAT_FINGERPRINT.mfr, AEOTEC_THERMOSTAT_FINGERPRINT.prod, AEOTEC_THERMOSTAT_FINGERPRINT.model)
end

local function thermostat_mode_report_handler(self, device, cmd)
local event = nil
if (cmd.args.mode == ThermostatMode.mode.OFF) then
Expand Down Expand Up @@ -114,7 +98,7 @@ local aeotec_radiator_thermostat = {
}
},
lifecycle_handlers = {added = device_added},
can_handle = can_handle_aeotec_radiator_thermostat
can_handle = require("aeotec-radiator-thermostat.can_handle"),
}

return aeotec_radiator_thermostat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function can_handle(opts, driver, device, cmd, ...)
local version = require "version"
local DANFOSS_LC13_THERMOSTAT_FPS = require "apiv6_bugfix.fingerprints"

if version.api == 6 and
cmd.cmd_class == cc.WAKE_UP and
cmd.cmd_id == WakeUp.NOTIFICATION and not
(device:id_match(DANFOSS_LC13_THERMOSTAT_FPS[1].manufacturerId,
DANFOSS_LC13_THERMOSTAT_FPS[1].productType,
DANFOSS_LC13_THERMOSTAT_FPS[1].productId) or
device:id_match(DANFOSS_LC13_THERMOSTAT_FPS[2].manufacturerId,
DANFOSS_LC13_THERMOSTAT_FPS[2].productType,
DANFOSS_LC13_THERMOSTAT_FPS[2].productId)) then
return true, require "apiv6_bugfix"
else
return false
end
end

return can_handle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local DANFOSS_LC13_THERMOSTAT_FPS = {
{ manufacturerId = 0x0002, productType = 0x0005, productId = 0x0003 }, -- Danfoss LC13 Thermostat
{ manufacturerId = 0x0002, productType = 0x0005, productId = 0x0004 } -- Danfoss LC13 Thermostat
}

return DANFOSS_LC13_THERMOSTAT_FPS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: newline

22 changes: 4 additions & 18 deletions drivers/SmartThings/zwave-thermostat/src/apiv6_bugfix/init.lua
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably remove this, as apiv6 was from awhile ago and there probably arent any more hubs with this version. Can you write a ticket?

Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local cc = require "st.zwave.CommandClass"
local WakeUp = (require "st.zwave.CommandClass.WakeUp")({ version = 1 })

local DANFOSS_LC13_THERMOSTAT_FPS = {
{ manufacturerId = 0x0002, productType = 0x0005, productId = 0x0003 }, -- Danfoss LC13 Thermostat
{ manufacturerId = 0x0002, productType = 0x0005, productId = 0x0004 } -- Danfoss LC13 Thermostat
}

local function can_handle(opts, driver, device, cmd, ...)
local version = require "version"
return version.api == 6 and
cmd.cmd_class == cc.WAKE_UP and
cmd.cmd_id == WakeUp.NOTIFICATION and not
(device:id_match(DANFOSS_LC13_THERMOSTAT_FPS[1].manufacturerId,
DANFOSS_LC13_THERMOSTAT_FPS[1].productType,
DANFOSS_LC13_THERMOSTAT_FPS[1].productId) or
device:id_match(DANFOSS_LC13_THERMOSTAT_FPS[2].manufacturerId,
DANFOSS_LC13_THERMOSTAT_FPS[2].productType,
DANFOSS_LC13_THERMOSTAT_FPS[2].productId))
end

local function wakeup_notification(driver, device, cmd)
device:refresh()
Expand All @@ -30,7 +16,7 @@ local apiv6_bugfix = {
}
},
NAME = "apiv6_bugfix",
can_handle = can_handle
can_handle = require("apiv6_bugfix.can_handle"),
}

return apiv6_bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function can_handle_ct100_thermostat(opts, driver, device)
local CT100_THERMOSTAT_FINGERPRINTS = require "ct100-thermostat.fingerprints"
for _, fingerprint in ipairs(CT100_THERMOSTAT_FINGERPRINTS) do
if device:id_match( fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then
return true, require "ct100-thermostat"
end
end

return false
end

return can_handle_ct100_thermostat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local CT100_THERMOSTAT_FINGERPRINTS = {
{ manufacturerId = 0x0098, productType = 0x6401, productId = 0x0107 }, -- 2Gig CT100 Programmable Thermostat
{ manufacturerId = 0x0098, productType = 0x6501, productId = 0x000C }, -- Iris Thermostat
}

return CT100_THERMOSTAT_FINGERPRINTS
33 changes: 4 additions & 29 deletions drivers/SmartThings/zwave-thermostat/src/ct100-thermostat/init.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
-- Copyright 2022 SmartThings
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


local capabilities = require "st.capabilities"
local cc = require "st.zwave.CommandClass"
Expand All @@ -33,11 +23,6 @@ local cooling_setpoint_defaults = require "st.zwave.defaults.thermostatCoolingSe
local constants = require "st.zwave.constants"
local utils = require "st.utils"

local CT100_THERMOSTAT_FINGERPRINTS = {
{ manufacturerId = 0x0098, productType = 0x6401, productId = 0x0107 }, -- 2Gig CT100 Programmable Thermostat
{ manufacturerId = 0x0098, productType = 0x6501, productId = 0x000C }, -- Iris Thermostat
}

-- This old device uses separate endpoints to get values of temp and humidity
-- DTH actually uses the old mutliInstance encap, but multichannel should be back-compat
local TEMPERATURE_ENDPOINT = 1
Expand Down Expand Up @@ -75,16 +60,6 @@ local function set_setpoint_factory(setpoint_type)
end
end

local function can_handle_ct100_thermostat(opts, driver, device)
for _, fingerprint in ipairs(CT100_THERMOSTAT_FINGERPRINTS) do
if device:id_match( fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then
return true
end
end

return false
end

local function thermostat_mode_report_handler(self, device, cmd)
local event = nil

Expand Down Expand Up @@ -210,7 +185,7 @@ local ct100_thermostat = {
[capabilities.refresh.commands.refresh.NAME] = do_refresh
}
},
can_handle = can_handle_ct100_thermostat,
can_handle = require("ct100-thermostat.can_handle"),
}

return ct100_thermostat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function can_handle_fibaro_heat_controller(opts, driver, device, ...)
local FINGERPRINTS = require("fibaro-heat-controller.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then
return true, require("fibaro-heat-controller")
end
end

return false
end

return can_handle_fibaro_heat_controller
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local FIBARO_HEAT_FINGERPRINTS = {
{mfr = 0x010F, prod = 0x1301, model = 0x1000}, -- Fibaro Heat Controller
{mfr = 0x010F, prod = 0x1301, model = 0x1001} -- Fibaro Heat Controller
}

return FIBARO_HEAT_FINGERPRINTS
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
-- Copyright 2022 SmartThings
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


local capabilities = require "st.capabilities"
--- @type st.zwave.CommandClass
Expand All @@ -30,22 +20,9 @@ local ApplicationStatus = (require "st.zwave.CommandClass.ApplicationStatus")({v

local utils = require "st.utils"

local FIBARO_HEAT_FINGERPRINTS = {
{mfr = 0x010F, prod = 0x1301, model = 0x1000}, -- Fibaro Heat Controller
{mfr = 0x010F, prod = 0x1301, model = 0x1001} -- Fibaro Heat Controller
}

local FORCED_REFRESH_THREAD = "forcedRefreshThread"

local function can_handle_fibaro_heat_controller(opts, driver, device, ...)
for _, fingerprint in ipairs(FIBARO_HEAT_FINGERPRINTS) do
if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then
return true
end
end

return false
end

local function thermostat_mode_report_handler(self, device, cmd)
local event = nil
Expand Down Expand Up @@ -189,7 +166,7 @@ local fibaro_heat_controller = {
added = device_added,
init = map_components
},
can_handle = can_handle_fibaro_heat_controller
can_handle = require("fibaro-heat-controller.can_handle"),
}

return fibaro_heat_controller
27 changes: 4 additions & 23 deletions drivers/SmartThings/zwave-thermostat/src/init.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
-- Copyright 2022 SmartThings
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


local capabilities = require "st.capabilities"
--- @type st.zwave.Driver
Expand Down Expand Up @@ -115,16 +105,7 @@ local driver_template = {
lifecycle_handlers = {
added = device_added
},
sub_drivers = {
require("aeotec-radiator-thermostat"),
require("popp-radiator-thermostat"),
require("ct100-thermostat"),
require("fibaro-heat-controller"),
require("stelpro-ki-thermostat"),
require("qubino-flush-thermostat"),
require("thermostat-heating-battery"),
require("apiv6_bugfix"),
}
sub_drivers = require("sub_drivers"),
}

defaults.register_for_default_handlers(driver_template, driver_template.supported_capabilities, {native_capability_attrs_enabled = true})
Expand Down
18 changes: 18 additions & 0 deletions drivers/SmartThings/zwave-thermostat/src/lazy_load_subdriver.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


return function(sub_driver_name)
-- gets the current lua libs api version
local ZwaveDriver = require "st.zwave.driver"
local version = require "version"

if version.api >= 16 then
return ZwaveDriver.lazy_load_sub_driver_v2(sub_driver_name)
elseif version.api >= 9 then
return ZwaveDriver.lazy_load_sub_driver(require(sub_driver_name))
else
return require(sub_driver_name)
end

end
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function can_handle_popp_radiator_thermostat(opts, driver, device, ...)
local POPP_THERMOSTAT_FINGERPRINT = {mfr = 0x0002, prod = 0x0115, model = 0xA010}

if device:id_match(POPP_THERMOSTAT_FINGERPRINT.mfr, POPP_THERMOSTAT_FINGERPRINT.prod, POPP_THERMOSTAT_FINGERPRINT.model) then
return true, require "popp-radiator-thermostat"
else
return false
end
end

return can_handle_popp_radiator_thermostat
Loading
Loading