diff --git a/drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/init.lua b/drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/init.lua index a7299faca2..edd01c7553 100644 --- a/drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/aeotec-multisensor/init.lua @@ -26,7 +26,8 @@ local AEOTEC_MULTISENSOR_FINGERPRINTS = { local function can_handle_aeotec_multisensor(opts, self, device, ...) for _, fingerprint in ipairs(AEOTEC_MULTISENSOR_FINGERPRINTS) do if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true + local subdriver = require("aeotec-multisensor") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-sensor/src/aeotec-water-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/aeotec-water-sensor/init.lua index aa896c5f6e..9d883ea3c2 100644 --- a/drivers/SmartThings/zwave-sensor/src/aeotec-water-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/aeotec-water-sensor/init.lua @@ -26,14 +26,11 @@ local ZWAVE_WATER_TEMP_HUMIDITY_FINGERPRINTS = { } --- Determine whether the passed device is zwave water temperature humidiry sensor ---- ---- @param driver Driver driver instance ---- @param device Device device isntance ---- @return boolean true if the device proper, else false local function can_handle_zwave_water_temp_humidity_sensor(opts, driver, device, ...) for _, fingerprint in ipairs(ZWAVE_WATER_TEMP_HUMIDITY_FINGERPRINTS) do if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true + local subdriver = require("aeotec-water-sensor") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-sensor/src/apiv6_bugfix/init.lua b/drivers/SmartThings/zwave-sensor/src/apiv6_bugfix/init.lua index 317a876420..322333d565 100644 --- a/drivers/SmartThings/zwave-sensor/src/apiv6_bugfix/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/apiv6_bugfix/init.lua @@ -22,7 +22,8 @@ local function can_handle(opts, driver, device, cmd, ...) for _, fp in ipairs(FPS) do if device:id_match(fp.mfr, fp.prod, fp.model) then return false end end - return true + local subdriver = require("apiv6_bugfix") + return true, subdriver else return false end diff --git a/drivers/SmartThings/zwave-sensor/src/enerwave-motion-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/enerwave-motion-sensor/init.lua index f0df8d4514..6fb712e3b0 100644 --- a/drivers/SmartThings/zwave-sensor/src/enerwave-motion-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/enerwave-motion-sensor/init.lua @@ -23,7 +23,10 @@ local WakeUp = (require "st.zwave.CommandClass.WakeUp")({version=1}) local ENERWAVE_MFR = 0x011A local function can_handle_enerwave_motion_sensor(opts, driver, device, cmd, ...) - return device.zwave_manufacturer_id == ENERWAVE_MFR + if device.zwave_manufacturer_id == ENERWAVE_MFR then + local subdriver = require("enerwave-motion-sensor") + return true, subdriver + else return false end end local function wakeup_notification(driver, device, cmd) diff --git a/drivers/SmartThings/zwave-sensor/src/everspring-motion-light-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/everspring-motion-light-sensor/init.lua index 386ef0d5b9..1b11aadabe 100644 --- a/drivers/SmartThings/zwave-sensor/src/everspring-motion-light-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/everspring-motion-light-sensor/init.lua @@ -19,11 +19,14 @@ local SensorBinary = (require "st.zwave.CommandClass.SensorBinary")({version=2}) local EVERSPRING_MOTION_LIGHT_FINGERPRINT = { mfr = 0x0060, prod = 0x0012, model = 0x0001 } local function can_handle_everspring_motion_light(opts, driver, device, ...) - return device:id_match( + if device:id_match( EVERSPRING_MOTION_LIGHT_FINGERPRINT.mfr, EVERSPRING_MOTION_LIGHT_FINGERPRINT.prod, EVERSPRING_MOTION_LIGHT_FINGERPRINT.model - ) + ) then + local subdriver = require("everspring-motion-light-sensor") + return true, subdriver + else return false end end local function device_added(driver, device) diff --git a/drivers/SmartThings/zwave-sensor/src/ezmultipli-multipurpose-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/ezmultipli-multipurpose-sensor/init.lua index 40a14fd32e..1e4b3bf0ce 100644 --- a/drivers/SmartThings/zwave-sensor/src/ezmultipli-multipurpose-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/ezmultipli-multipurpose-sensor/init.lua @@ -28,17 +28,15 @@ local SwitchBinary = (require "st.zwave.CommandClass.SwitchBinary")({version=2}) local CAP_CACHE_KEY = "st.capabilities." .. capabilities.colorControl.ID -local EZMULTIPLI_MULTIPURPOSE_SENSOR_FINGERPRINTS = { - { manufacturerId = 0x001E, productType = 0x0004, productId = 0x0001 } -} +local EZMULTIPLI_MULTIPURPOSE_SENSOR_FINGERPRINTS = { manufacturerId = 0x001E, productType = 0x0004, productId = 0x0001 } local function can_handle_ezmultipli_multipurpose_sensor(opts, driver, device, ...) - for _, fingerprint in ipairs(EZMULTIPLI_MULTIPURPOSE_SENSOR_FINGERPRINTS) do - if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true - end - end - return false + if device:id_match(EZMULTIPLI_MULTIPURPOSE_SENSOR_FINGERPRINTS.manufacturerId, + EZMULTIPLI_MULTIPURPOSE_SENSOR_FINGERPRINTS.productType, + EZMULTIPLI_MULTIPURPOSE_SENSOR_FINGERPRINTS.productId) then + local subdriver = require("ezmultipli-multipurpose-sensor") + return true, subdriver + else return false end end local function basic_report_handler(driver, device, cmd) diff --git a/drivers/SmartThings/zwave-sensor/src/fibaro-door-window-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/fibaro-door-window-sensor/init.lua index 4d809567ee..86cf865348 100644 --- a/drivers/SmartThings/zwave-sensor/src/fibaro-door-window-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/fibaro-door-window-sensor/init.lua @@ -38,7 +38,8 @@ local FIBARO_DOOR_WINDOW_SENSOR_FINGERPRINTS = { local function can_handle_fibaro_door_window_sensor(opts, driver, device, ...) for _, fingerprint in ipairs(FIBARO_DOOR_WINDOW_SENSOR_FINGERPRINTS) do if device:id_match(fingerprint.manufacturerId, fingerprint.prod, fingerprint.productId) then - return true + local subdriver = require("fibaro-door-window-sensor") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-sensor/src/fibaro-flood-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/fibaro-flood-sensor/init.lua index 03d28a3453..a407322212 100644 --- a/drivers/SmartThings/zwave-sensor/src/fibaro-flood-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/fibaro-flood-sensor/init.lua @@ -31,7 +31,10 @@ local FIBARO_MFR_ID = 0x010F local FIBARO_FLOOD_PROD_TYPES = { 0x0000, 0x0B00 } local function can_handle_fibaro_flood_sensor(opts, driver, device, ...) - return device:id_match(FIBARO_MFR_ID, FIBARO_FLOOD_PROD_TYPES, nil) + if device:id_match(FIBARO_MFR_ID, FIBARO_FLOOD_PROD_TYPES, nil) then + local subdriver = require("fibaro-flood-sensor") + return true, subdriver + else return false end end diff --git a/drivers/SmartThings/zwave-sensor/src/fibaro-motion-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/fibaro-motion-sensor/init.lua index 828a8f4c8a..ae45f5a27b 100644 --- a/drivers/SmartThings/zwave-sensor/src/fibaro-motion-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/fibaro-motion-sensor/init.lua @@ -22,7 +22,10 @@ local FIBARO_MOTION_MFR = 0x010F local FIBARO_MOTION_PROD = 0x0800 local function can_handle_fibaro_motion_sensor(opts, driver, device, ...) - return device:id_match(FIBARO_MOTION_MFR, FIBARO_MOTION_PROD) + if device:id_match(FIBARO_MOTION_MFR, FIBARO_MOTION_PROD) then + local subdriver = require("fibaro-motion-sensor") + return true, subdriver + else return false end end local function sensor_alarm_report(driver, device, cmd) diff --git a/drivers/SmartThings/zwave-sensor/src/glentronics-water-leak-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/glentronics-water-leak-sensor/init.lua index 92085a1557..3dba7351d6 100644 --- a/drivers/SmartThings/zwave-sensor/src/glentronics-water-leak-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/glentronics-water-leak-sensor/init.lua @@ -18,9 +18,7 @@ local cc = require "st.zwave.CommandClass" --- @type st.zwave.CommandClass.Notification local Notification = (require "st.zwave.CommandClass.Notification")({ version = 3 }) -local GLENTRONICS_WATER_LEAK_SENSOR_FINGERPRINTS = { - { manufacturerId = 0x0084, productType = 0x0093, productId = 0x0114 } -- glentronics water leak sensor -} +local GLENTRONICS_WATER_LEAK_SENSOR_FINGERPRINTS = { manufacturerId = 0x0084, productType = 0x0093, productId = 0x0114 } -- glentronics water leak sensor --- Determine whether the passed device is glentronics water leak sensor --- @@ -28,12 +26,13 @@ local GLENTRONICS_WATER_LEAK_SENSOR_FINGERPRINTS = { --- @param device Device device isntance --- @return boolean true if the device proper, else false local function can_handle_glentronics_water_leak_sensor(opts, driver, device, ...) - for _, fingerprint in ipairs(GLENTRONICS_WATER_LEAK_SENSOR_FINGERPRINTS) do - if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true - end - end - return false + if device:id_match( + GLENTRONICS_WATER_LEAK_SENSOR_FINGERPRINTS.manufacturerId, + GLENTRONICS_WATER_LEAK_SENSOR_FINGERPRINTS.productType, + GLENTRONICS_WATER_LEAK_SENSOR_FINGERPRINTS.productId) then + local subdriver = require("glentronics-water-leak-sensor") + return true, subdriver + else return false end end local function notification_report_handler(self, device, cmd) diff --git a/drivers/SmartThings/zwave-sensor/src/homeseer-multi-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/homeseer-multi-sensor/init.lua index e74b513337..2330f28106 100644 --- a/drivers/SmartThings/zwave-sensor/src/homeseer-multi-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/homeseer-multi-sensor/init.lua @@ -22,9 +22,7 @@ local WakeUp = (require "st.zwave.CommandClass.WakeUp")({ version = 1 }) local SensorMultilevel = (require "st.zwave.CommandClass.SensorMultilevel")({version = 5}) local Battery = (require "st.zwave.CommandClass.Battery")({ version = 1}) -local HOMESEER_MULTI_SENSOR_FINGERPRINTS = { - { manufacturerId = 0x001E, productType = 0x0002, productId = 0x0001 }, -- Homeseer multi sensor HSM100 -} +local HOMESEER_MULTI_SENSOR_FINGERPRINTS = { manufacturerId = 0x001E, productType = 0x0002, productId = 0x0001 } -- Homeseer multi sensor HSM100 --- Determine whether the passed device is homeseer multi sensor --- @@ -32,12 +30,13 @@ local HOMESEER_MULTI_SENSOR_FINGERPRINTS = { --- @param device Device device instance --- @return boolean true if the device proper, else false local function can_handle_homeseer_multi_sensor(opts, driver, device, ...) - for _, fingerprint in ipairs(HOMESEER_MULTI_SENSOR_FINGERPRINTS) do - if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true - end - end - return false + if device:id_match( + HOMESEER_MULTI_SENSOR_FINGERPRINTS.manufacturerId, + HOMESEER_MULTI_SENSOR_FINGERPRINTS.productType, + HOMESEER_MULTI_SENSOR_FINGERPRINTS.productId) then + local subdriver = require("homeseer-multi-sensor") + return true, subdriver + else return false end end local function basic_set_handler(self, device, cmd) diff --git a/drivers/SmartThings/zwave-sensor/src/init.lua b/drivers/SmartThings/zwave-sensor/src/init.lua index 5f21df812c..6176a19617 100644 --- a/drivers/SmartThings/zwave-sensor/src/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/init.lua @@ -27,6 +27,19 @@ local WakeUp = (require "st.zwave.CommandClass.WakeUp")({ version = 1 }) local preferences = require "preferences" local configurations = require "configurations" +local function lazy_load_if_possible(sub_driver_name) + -- gets the current lua libs api version + local version = require "version" + + -- version 9 will include the lazy loading functions + if version.api >= 9 then + return ZwaveDriver.lazy_load_sub_driver(require(sub_driver_name)) + else + return require(sub_driver_name) + end + +end + --- Handle preference changes --- --- @param driver st.zwave.Driver @@ -122,24 +135,24 @@ local driver_template = { capabilities.smokeDetector }, sub_drivers = { - require("zooz-4-in-1-sensor"), - require("vision-motion-detector"), - require("fibaro-flood-sensor"), - require("aeotec-water-sensor"), - require("glentronics-water-leak-sensor"), - require("homeseer-multi-sensor"), - require("fibaro-door-window-sensor"), - require("sensative-strip"), - require("enerwave-motion-sensor"), - require("aeotec-multisensor"), - require("zwave-water-leak-sensor"), - require("everspring-motion-light-sensor"), - require("ezmultipli-multipurpose-sensor"), - require("fibaro-motion-sensor"), - require("v1-contact-event"), - require("timed-tamper-clear"), - require("wakeup-no-poll"), - require("apiv6_bugfix") + lazy_load_if_possible("zooz-4-in-1-sensor"), + lazy_load_if_possible("vision-motion-detector"), + lazy_load_if_possible("fibaro-flood-sensor"), + lazy_load_if_possible("aeotec-water-sensor"), + lazy_load_if_possible("glentronics-water-leak-sensor"), + lazy_load_if_possible("homeseer-multi-sensor"), + lazy_load_if_possible("fibaro-door-window-sensor"), + lazy_load_if_possible("sensative-strip"), + lazy_load_if_possible("enerwave-motion-sensor"), + lazy_load_if_possible("aeotec-multisensor"), + lazy_load_if_possible("zwave-water-leak-sensor"), + lazy_load_if_possible("everspring-motion-light-sensor"), + lazy_load_if_possible("ezmultipli-multipurpose-sensor"), + lazy_load_if_possible("fibaro-motion-sensor"), + lazy_load_if_possible("v1-contact-event"), + lazy_load_if_possible("timed-tamper-clear"), + lazy_load_if_possible("wakeup-no-poll"), + lazy_load_if_possible("apiv6_bugfix") }, lifecycle_handlers = { added = added_handler, diff --git a/drivers/SmartThings/zwave-sensor/src/sensative-strip/init.lua b/drivers/SmartThings/zwave-sensor/src/sensative-strip/init.lua index b48bd39f6c..73f1cb8459 100644 --- a/drivers/SmartThings/zwave-sensor/src/sensative-strip/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/sensative-strip/init.lua @@ -27,7 +27,10 @@ local SENSATIVE_COMFORT_PROFILE = "illuminance-temperature" local CONFIG_REPORT_RECEIVED = "configReportReceived" local function can_handle_sensative_strip(opts, driver, device, cmd, ...) - return device:id_match(SENSATIVE_MFR, nil, SENSATIVE_MODEL) + if device:id_match(SENSATIVE_MFR, nil, SENSATIVE_MODEL) then + local subdriver = require("sensative-strip") + return true, subdriver + else return false end end local function configuration_report(driver, device, cmd) diff --git a/drivers/SmartThings/zwave-sensor/src/timed-tamper-clear/init.lua b/drivers/SmartThings/zwave-sensor/src/timed-tamper-clear/init.lua index 0a0db6d905..2007bedb0d 100644 --- a/drivers/SmartThings/zwave-sensor/src/timed-tamper-clear/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/timed-tamper-clear/init.lua @@ -23,7 +23,7 @@ local TAMPER_CLEAR = 10 local FIBARO_DOOR_WINDOW_MFR_ID = 0x010F local function can_handle_tamper_event(opts, driver, device, cmd, ...) - return device.zwave_manufacturer_id ~= FIBARO_DOOR_WINDOW_MFR_ID and + if device.zwave_manufacturer_id ~= FIBARO_DOOR_WINDOW_MFR_ID and opts.dispatcher_class == "ZwaveDispatcher" and cmd ~= nil and cmd.cmd_class ~= nil and @@ -31,7 +31,11 @@ local function can_handle_tamper_event(opts, driver, device, cmd, ...) cmd.cmd_id == Notification.REPORT and cmd.args.notification_type == Notification.notification_type.HOME_SECURITY and (cmd.args.event == Notification.event.home_security.TAMPERING_PRODUCT_COVER_REMOVED or - cmd.args.event == Notification.event.home_security.TAMPERING_PRODUCT_MOVED) + cmd.args.event == Notification.event.home_security.TAMPERING_PRODUCT_MOVED) then + local subdriver = require("timed-tamper-clear") + return true, subdriver + else return false + end end -- This behavior is from zwave-door-window-sensor.groovy. We've seen this behavior diff --git a/drivers/SmartThings/zwave-sensor/src/v1-contact-event/init.lua b/drivers/SmartThings/zwave-sensor/src/v1-contact-event/init.lua index f8ed0bf0b6..40efc7633e 100644 --- a/drivers/SmartThings/zwave-sensor/src/v1-contact-event/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/v1-contact-event/init.lua @@ -19,13 +19,18 @@ local Notification = (require "st.zwave.CommandClass.Notification")({ version = local capabilities = require "st.capabilities" local function can_handle_v1_contact_event(opts, driver, device, cmd, ...) - return opts.dispatcher_class == "ZwaveDispatcher" and + if opts.dispatcher_class == "ZwaveDispatcher" and cmd ~= nil and cmd.cmd_class ~= nil and cmd.cmd_class == cc.NOTIFICATION and cmd.cmd_id == Notification.REPORT and cmd.args.notification_type == Notification.notification_type.HOME_SECURITY and - cmd.args.v1_alarm_type == 0x07 + cmd.args.v1_alarm_type == 0x07 then + local subdriver = require("v1-contact-event") + return true, subdriver + else + return false + end end -- This behavior is from zwave-door-window-sensor.groovy, where it is diff --git a/drivers/SmartThings/zwave-sensor/src/vision-motion-detector/init.lua b/drivers/SmartThings/zwave-sensor/src/vision-motion-detector/init.lua index b3be204ca4..320bf3824f 100644 --- a/drivers/SmartThings/zwave-sensor/src/vision-motion-detector/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/vision-motion-detector/init.lua @@ -22,22 +22,18 @@ local Configuration = (require "st.zwave.CommandClass.Configuration")({ version --- @type st.zwave.CommandClass.Notification local Notification = (require "st.zwave.CommandClass.Notification")({ version = 3 }) -local VISION_MOTION_DETECTOR_FINGERPRINTS = { - { manufacturerId = 0x0109, productType = 0x2002, productId = 0x0205 } -- Vision Motion Detector ZP3102 -} +local VISION_MOTION_DETECTOR_FINGERPRINTS = { manufacturerId = 0x0109, productType = 0x2002, productId = 0x0205 } -- Vision Motion Detector ZP3102 --- Determine whether the passed device is zwave-plus-motion-temp-sensor ---- ---- @param driver Driver driver instance ---- @param device Device device isntance ---- @return boolean true if the device proper, else false local function can_handle_vision_motion_detector(opts, driver, device, ...) - for _, fingerprint in ipairs(VISION_MOTION_DETECTOR_FINGERPRINTS) do - if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true - end - end - return false + if device:id_match( + VISION_MOTION_DETECTOR_FINGERPRINTS.manufacturerId, + VISION_MOTION_DETECTOR_FINGERPRINTS.productType, + VISION_MOTION_DETECTOR_FINGERPRINTS.productId + ) then + local subdriver = require("vision-motion-detector") + return true, subdriver + else return false end end --- Handler for notification report command class from sensor diff --git a/drivers/SmartThings/zwave-sensor/src/wakeup-no-poll/init.lua b/drivers/SmartThings/zwave-sensor/src/wakeup-no-poll/init.lua index 877fbb4ac5..59d298a0e4 100644 --- a/drivers/SmartThings/zwave-sensor/src/wakeup-no-poll/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/wakeup-no-poll/init.lua @@ -24,7 +24,12 @@ local Battery = (require "st.zwave.CommandClass.Battery")({ version = 1 }) local fingerprint = {manufacturerId = 0x014F, productType = 0x2001, productId = 0x0102} -- NorTek open/close sensor local function can_handle(opts, driver, device, ...) - return device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) + if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then + local subdriver = require("wakeup-no-poll") + return true, subdriver + else + return false + end end -- Nortek open/closed sensors _always_ respond with "open" when polled, and they are polled after wakeup diff --git a/drivers/SmartThings/zwave-sensor/src/zooz-4-in-1-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/zooz-4-in-1-sensor/init.lua index 64ba7bd88a..5d4570e525 100644 --- a/drivers/SmartThings/zwave-sensor/src/zooz-4-in-1-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/zooz-4-in-1-sensor/init.lua @@ -29,14 +29,11 @@ local ZOOZ_4_IN_1_FINGERPRINTS = { } --- Determine whether the passed device is zooz_4_in_1_sensor ---- ---- @param driver Driver driver instance ---- @param device Device device isntance ---- @return boolean true if the device proper, else false local function can_handle_zooz_4_in_1_sensor(opts, driver, device, ...) for _, fingerprint in ipairs(ZOOZ_4_IN_1_FINGERPRINTS) do if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true + local subdriver = require("zooz-4-in-1-sensor") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-sensor/src/zwave-water-leak-sensor/init.lua b/drivers/SmartThings/zwave-sensor/src/zwave-water-leak-sensor/init.lua index 76ee1f1969..1eefab7479 100644 --- a/drivers/SmartThings/zwave-sensor/src/zwave-water-leak-sensor/init.lua +++ b/drivers/SmartThings/zwave-sensor/src/zwave-water-leak-sensor/init.lua @@ -35,7 +35,8 @@ local WATER_LEAK_SENSOR_FINGERPRINTS = { local function can_handle_water_leak_sensor(opts, driver, device, ...) for _, fingerprint in ipairs(WATER_LEAK_SENSOR_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("zwave-water-leak-sensor") + return true, subdriver end end return false