-
Notifications
You must be signed in to change notification settings - Fork 521
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: newline |
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
|---|---|---|
| @@ -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 |
| 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 |
|---|---|---|
| @@ -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 |
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.
nit: newline