-
Notifications
You must be signed in to change notification settings - Fork 521
CHAD-17040: Zwave thermostat lazy load subdrivers #2582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
drivers/SmartThings/zwave-thermostat/src/aeotec-radiator-thermostat/can_handle.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
drivers/SmartThings/zwave-thermostat/src/apiv6_bugfix/can_handle.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| -- 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 cc = require "st.zwave.CommandClass" | ||
| local WakeUp = (require "st.zwave.CommandClass.WakeUp")({ version = 1 }) | ||
| 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 |
9 changes: 9 additions & 0 deletions
9
drivers/SmartThings/zwave-thermostat/src/apiv6_bugfix/fingerprints.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
drivers/SmartThings/zwave-thermostat/src/ct100-thermostat/can_handle.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
9 changes: 9 additions & 0 deletions
9
drivers/SmartThings/zwave-thermostat/src/ct100-thermostat/fingerprints.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
drivers/SmartThings/zwave-thermostat/src/fibaro-heat-controller/can_handle.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
9 changes: 9 additions & 0 deletions
9
drivers/SmartThings/zwave-thermostat/src/fibaro-heat-controller/fingerprints.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
drivers/SmartThings/zwave-thermostat/src/lazy_load_subdriver.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
14 changes: 14 additions & 0 deletions
14
drivers/SmartThings/zwave-thermostat/src/popp-radiator-thermostat/can_handle.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?