-
Notifications
You must be signed in to change notification settings - Fork 524
CHAD-17092: zwave-sensor lazy loading of sub-drivers #2646
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
+742
−1,160
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
15 changes: 15 additions & 0 deletions
15
drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/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_aeotec_multisensor(opts, self, device, ...) | ||
| local FINGERPRINTS = require("aeotec-multisensor.fingerprints") | ||
| for _, fingerprint in ipairs(FINGERPRINTS) do | ||
| if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then | ||
| local subdriver = require("aeotec-multisensor") | ||
| return true, subdriver, require("aeotec-multisensor") | ||
| end | ||
| end | ||
| return false | ||
| end | ||
|
|
||
| return can_handle_aeotec_multisensor |
9 changes: 9 additions & 0 deletions
9
drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/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 AEOTEC_MULTISENSOR_FINGERPRINTS = { | ||
| { manufacturerId = 0x0086, productId = 0x0064 }, -- MultiSensor 6 | ||
| { manufacturerId = 0x0371, productId = 0x0018 }, -- MultiSensor 7 | ||
| } | ||
|
|
||
| return AEOTEC_MULTISENSOR_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
11 changes: 11 additions & 0 deletions
11
drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/multisensor-6/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,11 @@ | ||
| -- Copyright 2025 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| local function can_handle_multisensor_6(opts, self, device, ...) | ||
| local MULTISENSOR_6_PRODUCT_ID = 0x0064 | ||
| if device.zwave_product_id == MULTISENSOR_6_PRODUCT_ID then | ||
| return true, require("aeotec-multisensor.multisensor-6") | ||
| end | ||
| return false | ||
| end | ||
| return can_handle_multisensor_6 |
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
12 changes: 12 additions & 0 deletions
12
drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/multisensor-7/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,12 @@ | ||
| -- Copyright 2025 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| local function can_handle_multisensor_7(opts, self, device, ...) | ||
| local MULTISENSOR_7_PRODUCT_ID = 0x0018 | ||
| if device.zwave_product_id == MULTISENSOR_7_PRODUCT_ID then | ||
| return true, require("aeotec-multisensor.multisensor-7") | ||
| end | ||
| return false | ||
| end | ||
|
|
||
| return can_handle_multisensor_7 |
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
9 changes: 9 additions & 0 deletions
9
drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/sub_drivers.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 lazy_load_if_possible = require "lazy_load_subdriver" | ||
| local sub_drivers = { | ||
| lazy_load_if_possible("aeotec-multisensor/multisensor-6"), | ||
| lazy_load_if_possible("aeotec-multisensor/multisensor-7"), | ||
| } | ||
| return sub_drivers |
15 changes: 15 additions & 0 deletions
15
drivers/SmartThings/zwave-sensor/src/aeotec-water-sensor/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_zwave_water_temp_humidity_sensor(opts, driver, device, ...) | ||
| local FINGERPRINTS = require("aeotec-water-sensor.fingerprints") | ||
| for _, fingerprint in ipairs(FINGERPRINTS) do | ||
| if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then | ||
| local subdriver = require("aeotec-water-sensor") | ||
| return true, subdriver, require("aeotec-water-sensor") | ||
| end | ||
| end | ||
| return false | ||
| end | ||
|
|
||
| return can_handle_zwave_water_temp_humidity_sensor |
11 changes: 11 additions & 0 deletions
11
drivers/SmartThings/zwave-sensor/src/aeotec-water-sensor/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,11 @@ | ||
| -- Copyright 2025 SmartThings, Inc. | ||
| -- Licensed under the Apache License, Version 2.0 | ||
|
|
||
| local ZWAVE_WATER_TEMP_HUMIDITY_FINGERPRINTS = { | ||
| { manufacturerId = 0x0371, productType = 0x0002, productId = 0x0013 }, -- Aeotec Water Sensor 7 Pro EU | ||
| { manufacturerId = 0x0371, productType = 0x0102, productId = 0x0013 }, -- Aeotec Water Sensor 7 Pro US | ||
| { manufacturerId = 0x0371, productType = 0x0202, productId = 0x0013 }, -- Aeotec Water Sensor 7 Pro AU | ||
| { manufacturerId = 0x0371, productId = 0x0012 } -- Aeotec Water Sensor 7 | ||
| } | ||
|
|
||
| return ZWAVE_WATER_TEMP_HUMIDITY_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
35 changes: 35 additions & 0 deletions
35
drivers/SmartThings/zwave-sensor/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,35 @@ | ||
| -- 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 }) | ||
|
|
||
| -- doing refresh would cause incorrect state for device, see comments in wakeup-no-poll | ||
| local NORTEK_FP = {mfr = 0x014F, prod = 0x2001, model = 0x0102} -- NorTek open/close sensor | ||
| local POPP_THERMOSTAT_FP = {mfr = 0x0002, prod = 0x0115, model = 0xA010} --Popp thermostat | ||
| local AEOTEC_MULTISENSOR_6_FP = {mfr = 0x0086, model = 0x0064} --Aeotec multisensor 6 | ||
| local AEOTEC_MULTISENSOR_7_FP = {mfr = 0x0371, model = 0x0018} --Aeotec multisensor 7 | ||
| local ENERWAVE_MOTION_FP = {mfr = 0x011A} --Enerwave motion sensor | ||
| local HOMESEER_MULTI_SENSOR_FP = {mfr = 0x001E, prod = 0x0002, model = 0x0001} -- Homeseer multi sensor HSM100 | ||
| local SENSATIVE_STRIP_FP = {mfr = 0x019A, model = 0x000A} | ||
| local FPS = {NORTEK_FP, POPP_THERMOSTAT_FP, | ||
| AEOTEC_MULTISENSOR_6_FP, AEOTEC_MULTISENSOR_7_FP, | ||
| ENERWAVE_MOTION_FP, HOMESEER_MULTI_SENSOR_FP, SENSATIVE_STRIP_FP} | ||
|
|
||
| local function can_handle(opts, driver, device, cmd, ...) | ||
| local version = require "version" | ||
| if version.api == 6 and | ||
| cmd.cmd_class == cc.WAKE_UP and | ||
| cmd.cmd_id == WakeUp.NOTIFICATION then | ||
|
|
||
| for _, fp in ipairs(FPS) do | ||
| if device:id_match(fp.mfr, fp.prod, fp.model) then return false end | ||
| end | ||
| local subdriver = require("apiv6_bugfix") | ||
| return true, subdriver | ||
| else | ||
| return false | ||
| end | ||
| end | ||
|
|
||
| return can_handle |
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
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.
note to self: probably safe to remove this sub-driver (does not need to be done in this PR)