From 51ed60824a82e85e471d5a1bebb332792760aa6a Mon Sep 17 00:00:00 2001 From: Cooper Towns Date: Wed, 17 Jan 2024 16:13:32 -0600 Subject: [PATCH 1/4] Z-Wave Switch: lazy load sub drivers Adds the ability to lazy load sub drivers. Sub driver that are not currently used by the driver will be "lazy loaded", meaning just a smaller version of the sub driver will be loaded until a device joins that requires the entire sub driver, at which point all the sub driver handlers will be loaded. Given the high number of sub drivers in the zwave-switch driver, this should provide a good amount of memory savings in cases where many of the sub drivers go unused. Note, this will only work with the latest lua libs changes, so the lazy loading is only activated after an API version check. --- .../src/aeon-smart-strip/init.lua | 3 +- .../src/aeotec-smart-switch/init.lua | 5 +- .../src/dawon-smart-plug/init.lua | 3 +- .../src/dawon-wall-smart-switch/init.lua | 3 +- .../src/eaton-5-scene-keypad/init.lua | 3 +- .../src/eaton-accessory-dimmer/init.lua | 3 +- .../src/eaton-anyplace-switch/init.lua | 3 +- .../zwave-switch/src/ecolink-switch/init.lua | 3 +- .../src/fibaro-double-switch/init.lua | 3 +- .../src/fibaro-single-switch/init.lua | 3 +- .../src/fibaro-wall-plug-us/init.lua | 3 +- drivers/SmartThings/zwave-switch/src/init.lua | 51 ++++++++++++------- .../inovelli-2-channel-smart-plug/init.lua | 3 +- .../zwave-switch/src/inovelli-LED/init.lua | 3 +- .../src/multi-metering-switch/init.lua | 3 +- .../src/multichannel-device/init.lua | 6 ++- .../zwave-switch/src/qubino-switches/init.lua | 6 ++- .../src/zooz-power-strip/init.lua | 3 +- .../src/zooz-zen-30-dimmer-relay/init.lua | 3 +- .../src/zwave-dual-switch/init.lua | 3 +- 20 files changed, 78 insertions(+), 38 deletions(-) diff --git a/drivers/SmartThings/zwave-switch/src/aeon-smart-strip/init.lua b/drivers/SmartThings/zwave-switch/src/aeon-smart-strip/init.lua index c4036da992..f3bafc0815 100644 --- a/drivers/SmartThings/zwave-switch/src/aeon-smart-strip/init.lua +++ b/drivers/SmartThings/zwave-switch/src/aeon-smart-strip/init.lua @@ -40,7 +40,8 @@ local POWER_UNIT_WATT = "W" local function can_handle_aeon_smart_strip(opts, driver, device, ...) for _, fingerprint in ipairs(AEON_SMART_STRIP_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("aeon-smart-strip") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/aeotec-smart-switch/init.lua b/drivers/SmartThings/zwave-switch/src/aeotec-smart-switch/init.lua index c8a03817e7..fdb98705a8 100644 --- a/drivers/SmartThings/zwave-switch/src/aeotec-smart-switch/init.lua +++ b/drivers/SmartThings/zwave-switch/src/aeotec-smart-switch/init.lua @@ -24,7 +24,10 @@ local FINGERPRINTS = { local function can_handle(opts, driver, device, ...) for _, fingerprint in ipairs(FINGERPRINTS) do - if device:id_match(fingerprint.mfr, nil, fingerprint.prodId) then return true end + if device:id_match(fingerprint.mfr, nil, fingerprint.prodId) then + local subdriver = require("aeotec-smart-switch") + return true, subdriver + end end return false end diff --git a/drivers/SmartThings/zwave-switch/src/dawon-smart-plug/init.lua b/drivers/SmartThings/zwave-switch/src/dawon-smart-plug/init.lua index 0973a10de9..6280842f6b 100644 --- a/drivers/SmartThings/zwave-switch/src/dawon-smart-plug/init.lua +++ b/drivers/SmartThings/zwave-switch/src/dawon-smart-plug/init.lua @@ -31,7 +31,8 @@ local DAWON_SMART_PLUG_FINGERPRINTS = { local function can_handle_dawon_smart_plug(opts, driver, device, ...) for _, fingerprint in ipairs(DAWON_SMART_PLUG_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("dawon-smart-plug") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/dawon-wall-smart-switch/init.lua b/drivers/SmartThings/zwave-switch/src/dawon-wall-smart-switch/init.lua index fe9ff5d931..f7978ad54d 100644 --- a/drivers/SmartThings/zwave-switch/src/dawon-wall-smart-switch/init.lua +++ b/drivers/SmartThings/zwave-switch/src/dawon-wall-smart-switch/init.lua @@ -41,7 +41,8 @@ local DAWON_WALL_SMART_SWITCH_FINGERPRINTS = { local function can_handle_dawon_wall_smart_switch(opts, driver, device, ...) for _, fingerprint in ipairs(DAWON_WALL_SMART_SWITCH_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("dawon-wall-smart-switch") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/eaton-5-scene-keypad/init.lua b/drivers/SmartThings/zwave-switch/src/eaton-5-scene-keypad/init.lua index 188110c046..29fccc9261 100644 --- a/drivers/SmartThings/zwave-switch/src/eaton-5-scene-keypad/init.lua +++ b/drivers/SmartThings/zwave-switch/src/eaton-5-scene-keypad/init.lua @@ -111,7 +111,8 @@ end local function can_handle_eaton_5_scene_keypad(opts, driver, device, ...) for _, fingerprint in ipairs(EATON_5_SCENE_KEYPAD_FINGERPRINT) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("eaton-5-scene-keypad") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/eaton-accessory-dimmer/init.lua b/drivers/SmartThings/zwave-switch/src/eaton-accessory-dimmer/init.lua index 13d35f41bf..3a9d5c9a47 100644 --- a/drivers/SmartThings/zwave-switch/src/eaton-accessory-dimmer/init.lua +++ b/drivers/SmartThings/zwave-switch/src/eaton-accessory-dimmer/init.lua @@ -31,7 +31,8 @@ local EATON_ACCESSORY_DIMMER_FINGERPRINTS = { local function can_handle_eaton_accessory_dimmer(opts, driver, device, ...) for _, fingerprint in ipairs(EATON_ACCESSORY_DIMMER_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("eaton-accessory-dimmer") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/eaton-anyplace-switch/init.lua b/drivers/SmartThings/zwave-switch/src/eaton-anyplace-switch/init.lua index aa06247803..720f88b56f 100644 --- a/drivers/SmartThings/zwave-switch/src/eaton-anyplace-switch/init.lua +++ b/drivers/SmartThings/zwave-switch/src/eaton-anyplace-switch/init.lua @@ -25,7 +25,8 @@ local EATON_ANYPLACE_SWITCH_FINGERPRINTS = { local function can_handle_eaton_anyplace_switch(opts, driver, device, ...) for _, fingerprint in ipairs(EATON_ANYPLACE_SWITCH_FINGERPRINTS) do if device:id_match(fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true + local subdriver = require("eaton-anyplace-switch") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/ecolink-switch/init.lua b/drivers/SmartThings/zwave-switch/src/ecolink-switch/init.lua index fa337f3b48..3e69399801 100644 --- a/drivers/SmartThings/zwave-switch/src/ecolink-switch/init.lua +++ b/drivers/SmartThings/zwave-switch/src/ecolink-switch/init.lua @@ -27,7 +27,8 @@ local ECOLINK_FINGERPRINTS = { local function can_handle_ecolink(opts, driver, device, ...) for _, fingerprint in ipairs(ECOLINK_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("ecolink-switch") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/fibaro-double-switch/init.lua b/drivers/SmartThings/zwave-switch/src/fibaro-double-switch/init.lua index 433dd7ec64..8bccc75464 100644 --- a/drivers/SmartThings/zwave-switch/src/fibaro-double-switch/init.lua +++ b/drivers/SmartThings/zwave-switch/src/fibaro-double-switch/init.lua @@ -43,7 +43,8 @@ local FIBARO_DOUBLE_SWITCH_FINGERPRINTS = { local function can_handle_fibaro_double_switch(opts, driver, device, ...) for _, fingerprint in ipairs(FIBARO_DOUBLE_SWITCH_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("fibaro-double-switch") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/fibaro-single-switch/init.lua b/drivers/SmartThings/zwave-switch/src/fibaro-single-switch/init.lua index afcdf98a5e..e36703ccd6 100644 --- a/drivers/SmartThings/zwave-switch/src/fibaro-single-switch/init.lua +++ b/drivers/SmartThings/zwave-switch/src/fibaro-single-switch/init.lua @@ -37,7 +37,8 @@ local FIBARO_SINGLE_SWITCH_FINGERPRINTS = { local function can_handle_fibaro_single_switch(opts, driver, device, ...) for _, fingerprint in ipairs(FIBARO_SINGLE_SWITCH_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("fibaro-single-switch") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/fibaro-wall-plug-us/init.lua b/drivers/SmartThings/zwave-switch/src/fibaro-wall-plug-us/init.lua index 5bfd137b65..6224421c75 100644 --- a/drivers/SmartThings/zwave-switch/src/fibaro-wall-plug-us/init.lua +++ b/drivers/SmartThings/zwave-switch/src/fibaro-wall-plug-us/init.lua @@ -20,7 +20,8 @@ local FIBARO_WALL_PLUG_FINGERPRINTS = { local function can_handle_fibaro_wall_plug(opts, driver, device, ...) for _, fingerprint in ipairs(FIBARO_WALL_PLUG_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("fibaro-wall-plug-us") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/init.lua b/drivers/SmartThings/zwave-switch/src/init.lua index 9246aa3f4e..e27ec98a0e 100644 --- a/drivers/SmartThings/zwave-switch/src/init.lua +++ b/drivers/SmartThings/zwave-switch/src/init.lua @@ -103,6 +103,19 @@ local function switch_multilevel_stop_level_change_handler(driver, device, cmd) device:send(SwitchMultilevel:Get({})) end +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 + ------------------------------------------------------------------------------------------- -- Register message handlers and run driver ------------------------------------------------------------------------------------------- @@ -130,25 +143,25 @@ local driver_template = { } }, sub_drivers = { - require("eaton-accessory-dimmer"), - require("inovelli-LED"), - require("dawon-smart-plug"), - require("inovelli-2-channel-smart-plug"), - require("zwave-dual-switch"), - require("eaton-anyplace-switch"), - require("fibaro-wall-plug-us"), - require("dawon-wall-smart-switch"), - require("zooz-power-strip"), - require("aeon-smart-strip"), - require("qubino-switches"), - require("fibaro-double-switch"), - require("fibaro-single-switch"), - require("eaton-5-scene-keypad"), - require("ecolink-switch"), - require("multi-metering-switch"), - require("zooz-zen-30-dimmer-relay"), - require("multichannel-device"), - require("aeotec-smart-switch") + lazy_load_if_possible("eaton-accessory-dimmer"), + lazy_load_if_possible("inovelli-LED"), + lazy_load_if_possible("dawon-smart-plug"), + lazy_load_if_possible("inovelli-2-channel-smart-plug"), + lazy_load_if_possible("zwave-dual-switch"), + lazy_load_if_possible("eaton-anyplace-switch"), + lazy_load_if_possible("fibaro-wall-plug-us"), + lazy_load_if_possible("dawon-wall-smart-switch"), + lazy_load_if_possible("zooz-power-strip"), + lazy_load_if_possible("aeon-smart-strip"), + lazy_load_if_possible("qubino-switches"), + lazy_load_if_possible("fibaro-double-switch"), + lazy_load_if_possible("fibaro-single-switch"), + lazy_load_if_possible("eaton-5-scene-keypad"), + lazy_load_if_possible("ecolink-switch"), + lazy_load_if_possible("multi-metering-switch"), + lazy_load_if_possible("zooz-zen-30-dimmer-relay"), + lazy_load_if_possible("multichannel-device"), + lazy_load_if_possible("aeotec-smart-switch") }, lifecycle_handlers = { init = device_init, diff --git a/drivers/SmartThings/zwave-switch/src/inovelli-2-channel-smart-plug/init.lua b/drivers/SmartThings/zwave-switch/src/inovelli-2-channel-smart-plug/init.lua index 2321065771..d97f85063c 100644 --- a/drivers/SmartThings/zwave-switch/src/inovelli-2-channel-smart-plug/init.lua +++ b/drivers/SmartThings/zwave-switch/src/inovelli-2-channel-smart-plug/init.lua @@ -38,7 +38,8 @@ local INOVELLI_2_CHANNEL_SMART_PLUG_FINGERPRINTS = { local function can_handle_inovelli_2_channel_smart_plug(opts, driver, device, ...) for _, fingerprint in ipairs(INOVELLI_2_CHANNEL_SMART_PLUG_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("inovelli-2-channel-smart-plug") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/inovelli-LED/init.lua b/drivers/SmartThings/zwave-switch/src/inovelli-LED/init.lua index a03d9ccacc..36bf1e0716 100644 --- a/drivers/SmartThings/zwave-switch/src/inovelli-LED/init.lua +++ b/drivers/SmartThings/zwave-switch/src/inovelli-LED/init.lua @@ -84,7 +84,8 @@ local function can_handle_inovelli_led(opts, driver, device, ...) {INOVELLI_LZW31SN_PRODUCT_TYPE, INOVELLI_LZW31_PRODUCT_TYPE}, INOVELLI_DIMMER_PRODUCT_ID ) then - return true + local subdriver = require("inovelli-LED") + return true, subdriver end return false end diff --git a/drivers/SmartThings/zwave-switch/src/multi-metering-switch/init.lua b/drivers/SmartThings/zwave-switch/src/multi-metering-switch/init.lua index 282aecf260..a4113ad851 100644 --- a/drivers/SmartThings/zwave-switch/src/multi-metering-switch/init.lua +++ b/drivers/SmartThings/zwave-switch/src/multi-metering-switch/init.lua @@ -47,7 +47,8 @@ local MULTI_METERING_SWITCH_FINGERPRINTS = { local function can_handle_multi_metering_switch(opts, driver, device, ...) for _, fingerprint in ipairs(MULTI_METERING_SWITCH_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("multi-metering-switch") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/multichannel-device/init.lua b/drivers/SmartThings/zwave-switch/src/multichannel-device/init.lua index bf49f44f35..54349673e8 100644 --- a/drivers/SmartThings/zwave-switch/src/multichannel-device/init.lua +++ b/drivers/SmartThings/zwave-switch/src/multichannel-device/init.lua @@ -28,7 +28,11 @@ local map_device_class_to_profile = { } local function can_handle_multichannel_device(opts, driver, device, ...) - return device:supports_capability(capabilities.zwMultichannel) + if device:supports_capability(capabilities.zwMultichannel) then + local subdriver = require("multichannel-device") + return true, subdriver + end + return false end local function find_child(device, src_channel) diff --git a/drivers/SmartThings/zwave-switch/src/qubino-switches/init.lua b/drivers/SmartThings/zwave-switch/src/qubino-switches/init.lua index 49852397db..d883aa4821 100644 --- a/drivers/SmartThings/zwave-switch/src/qubino-switches/init.lua +++ b/drivers/SmartThings/zwave-switch/src/qubino-switches/init.lua @@ -52,7 +52,11 @@ local function getDeviceProfile(device, isTemperatureSensorOnboard) end local function can_handle_qubino_flush_relay(opts, driver, device, cmd, ...) - return device:id_match(constants.QUBINO_MFR) + if device:id_match(constants.QUBINO_MFR) then + local subdriver = require("qubino-switches") + return true, subdriver + end + return false end local function add_temperature_sensor_if_needed(device) diff --git a/drivers/SmartThings/zwave-switch/src/zooz-power-strip/init.lua b/drivers/SmartThings/zwave-switch/src/zooz-power-strip/init.lua index 56172994ba..24b969d13e 100644 --- a/drivers/SmartThings/zwave-switch/src/zooz-power-strip/init.lua +++ b/drivers/SmartThings/zwave-switch/src/zooz-power-strip/init.lua @@ -27,7 +27,8 @@ local ZOOZ_POWER_STRIP_FINGERPRINTS = { local function can_handle_zooz_power_strip(opts, driver, device, ...) for _, fingerprint in ipairs(ZOOZ_POWER_STRIP_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("zooz-power-strip") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/zooz-zen-30-dimmer-relay/init.lua b/drivers/SmartThings/zwave-switch/src/zooz-zen-30-dimmer-relay/init.lua index bde623a43b..c92c485e43 100644 --- a/drivers/SmartThings/zwave-switch/src/zooz-zen-30-dimmer-relay/init.lua +++ b/drivers/SmartThings/zwave-switch/src/zooz-zen-30-dimmer-relay/init.lua @@ -77,7 +77,8 @@ local ZOOZ_ZEN_30_DIMMER_RELAY_FINGERPRINTS = { local function can_handle_zooz_zen_30_dimmer_relay_double_switch(opts, driver, device, ...) for _, fingerprint in ipairs(ZOOZ_ZEN_30_DIMMER_RELAY_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("zooz-zen-30-dimmer-relay") + return true, subdriver end end return false diff --git a/drivers/SmartThings/zwave-switch/src/zwave-dual-switch/init.lua b/drivers/SmartThings/zwave-switch/src/zwave-dual-switch/init.lua index 5e8ffbdb54..3ec8868bcd 100644 --- a/drivers/SmartThings/zwave-switch/src/zwave-dual-switch/init.lua +++ b/drivers/SmartThings/zwave-switch/src/zwave-dual-switch/init.lua @@ -41,7 +41,8 @@ local ZWAVE_DUAL_SWITCH_FINGERPRINTS = { local function can_handle_zwave_dual_switch(opts, driver, device, ...) for _, fingerprint in ipairs(ZWAVE_DUAL_SWITCH_FINGERPRINTS) do if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then - return true + local subdriver = require("zwave-dual-switch") + return true, subdriver end end return false From 47dbcad4c935aa835a6a1fd12b67e5b1cd39db24 Mon Sep 17 00:00:00 2001 From: hdlee27 <54927573+hdlee27@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:30:32 +0900 Subject: [PATCH 2/4] BUG2-1182-fix: hide non functional attribute update (#1216) * BUG2-1182-fix: hide non functional attribute update Signed-off-by: hdlee27 <54927573+hdlee27@users.noreply.github.com> * hide supportedWindowShadeCommand attribute update Signed-off-by: hdlee27 <54927573+hdlee27@users.noreply.github.com> * modify test for display=false window treatement event Signed-off-by: hdlee27 <54927573+hdlee27@users.noreply.github.com> * hide supportedWindowShadeCommand attribute update for matter Signed-off-by: hdlee27 <54927573+hdlee27@users.noreply.github.com> --------- Signed-off-by: hdlee27 <54927573+hdlee27@users.noreply.github.com> --- drivers/SmartThings/matter-window-covering/src/init.lua | 2 +- .../src/test/test_matter_window_covering.lua | 1 + .../SmartThings/zigbee-window-treatment/src/aqara/init.lua | 4 ++-- .../zigbee-window-treatment/src/aqara/roller-shade/init.lua | 2 +- .../SmartThings/zigbee-window-treatment/src/hanssem/init.lua | 2 +- .../src/test/test_zigbee_window_treatment_aqara.lua | 5 +++-- ...est_zigbee_window_treatment_aqara_roller_shade_rotate.lua | 2 +- .../src/test/test_zigbee_window_treatment_hanssem.lua | 2 +- 8 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/SmartThings/matter-window-covering/src/init.lua b/drivers/SmartThings/matter-window-covering/src/init.lua index 9b964c786f..6f438a7dcf 100644 --- a/drivers/SmartThings/matter-window-covering/src/init.lua +++ b/drivers/SmartThings/matter-window-covering/src/init.lua @@ -74,7 +74,7 @@ end local function device_added(driver, device) device:emit_event( - capabilities.windowShade.supportedWindowShadeCommands({"open", "close", "pause"}) + capabilities.windowShade.supportedWindowShadeCommands({"open", "close", "pause"}, {visibility = {displayed = false}}) ) end diff --git a/drivers/SmartThings/matter-window-covering/src/test/test_matter_window_covering.lua b/drivers/SmartThings/matter-window-covering/src/test/test_matter_window_covering.lua index 9e7cc65c02..99aab47403 100644 --- a/drivers/SmartThings/matter-window-covering/src/test/test_matter_window_covering.lua +++ b/drivers/SmartThings/matter-window-covering/src/test/test_matter_window_covering.lua @@ -390,6 +390,7 @@ test.register_coroutine_test( component_id = "main", attribute_id = "supportedWindowShadeCommands", state = {value = {"open", "close", "pause"}}, + visibility = {displayed = false} }, } ) diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/init.lua index 53f8b35601..0eab6bb66f 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/aqara/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/init.lua @@ -166,8 +166,8 @@ local function do_configure(self, device) end local function device_added(driver, device) - device:emit_event(capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" })) - device:emit_event(deviceInitialization.supportedInitializedState({ "notInitialized", "initializing", "initialized" })) + device:emit_event(capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" }, {visibility = {displayed = false}})) + device:emit_event(deviceInitialization.supportedInitializedState({ "notInitialized", "initializing", "initialized" }, {visibility = {displayed = false}})) device:emit_event(capabilities.windowShadeLevel.shadeLevel(0)) device:emit_event(capabilities.windowShade.windowShade.closed()) device:emit_event(deviceInitialization.initializedState.notInitialized()) diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/roller-shade/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/roller-shade/init.lua index 431c4b040c..e88d76d517 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/aqara/roller-shade/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/roller-shade/init.lua @@ -92,7 +92,7 @@ local function device_info_changed(driver, device, event, args) end local function device_added(driver, device) - device:emit_event(capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" })) + device:emit_event(capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" }, {visibility = {displayed = false}})) device:emit_event(capabilities.windowShadeLevel.shadeLevel(0)) device:emit_event(capabilities.windowShade.windowShade.closed()) device:emit_event(initializedStateWithGuide.initializedStateWithGuide.notInitialized()) diff --git a/drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua index d1553255ba..bc974706b6 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua @@ -187,7 +187,7 @@ end -------------------- Lifecycle Handlers ------------------- local function device_added(driver, device) - device:emit_event(capabilities.windowShade.supportedWindowShadeCommands({"open", "close", "pause"})) + device:emit_event(capabilities.windowShade.supportedWindowShadeCommands({"open", "close", "pause"}, {visibility = {displayed = false}})) if getLatestLevel(device) == 0 then emit_event_final_position(device, getLatestLevel(device)) device.thread:call_with_delay(3, function(d) diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara.lua index a2123adc2b..71885fe291 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara.lua @@ -86,14 +86,15 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", - capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" })) + capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" }, {visibility = {displayed = false}})) ) test.socket.capability:__expect_send({ mock_device.id, { capability_id = "stse.deviceInitialization", component_id = "main", attribute_id = "supportedInitializedState", - state = { value = { "notInitialized", "initializing", "initialized" } } + state = { value = { "notInitialized", "initializing", "initialized" } }, + visibility = { displayed = false } } }) test.socket.capability:__expect_send( diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara_roller_shade_rotate.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara_roller_shade_rotate.lua index 582badc66f..9da4ffe60f 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara_roller_shade_rotate.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara_roller_shade_rotate.lua @@ -72,7 +72,7 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", - capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" })) + capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" }, {visibility = {displayed = false}})) ) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_hanssem.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_hanssem.lua index 74f56be609..73be8ebabf 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_hanssem.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_hanssem.lua @@ -86,7 +86,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.capability:__expect_send( - mock_device:generate_test_message("main", capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" })) + mock_device:generate_test_message("main", capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" }, {visibility = {displayed = false}})) ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closed())) From 7fc4d8ceba6f525b4679806cc5daa0482b95d193 Mon Sep 17 00:00:00 2001 From: Steven Green Date: Thu, 15 Feb 2024 11:53:54 -0800 Subject: [PATCH 3/4] BUG2-1112 Correct enabled values for aeotec multisensor power source --- .../SmartThings/zwave-sensor/profiles/aeotec-multisensor-6.yml | 2 +- .../SmartThings/zwave-sensor/profiles/aeotec-multisensor-7.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/SmartThings/zwave-sensor/profiles/aeotec-multisensor-6.yml b/drivers/SmartThings/zwave-sensor/profiles/aeotec-multisensor-6.yml index 773bd7b987..3815287fcf 100644 --- a/drivers/SmartThings/zwave-sensor/profiles/aeotec-multisensor-6.yml +++ b/drivers/SmartThings/zwave-sensor/profiles/aeotec-multisensor-6.yml @@ -33,7 +33,7 @@ components: - key: "powerSource.value" enabledValues: - battery - - mains + - dc categories: - name: MotionSensor preferences: diff --git a/drivers/SmartThings/zwave-sensor/profiles/aeotec-multisensor-7.yml b/drivers/SmartThings/zwave-sensor/profiles/aeotec-multisensor-7.yml index 7e2c306561..0e9ca408dd 100644 --- a/drivers/SmartThings/zwave-sensor/profiles/aeotec-multisensor-7.yml +++ b/drivers/SmartThings/zwave-sensor/profiles/aeotec-multisensor-7.yml @@ -33,7 +33,7 @@ components: - key: "powerSource.value" enabledValues: - battery - - mains + - dc categories: - name: MultiFunctionalSensor preferences: From babe6fb38f8487708a5d5d3d87b1ef3769c02daf Mon Sep 17 00:00:00 2001 From: lcheng33775823 <47738738+lcheng33775823@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:20:29 +0800 Subject: [PATCH 4/4] add neo zigbee water leak sensor (#1134) Co-authored-by: lelandblue <79465613+lelandblue@users.noreply.github.com> --- .../SmartThings/zigbee-water-leak-sensor/fingerprints.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/fingerprints.yml b/drivers/SmartThings/zigbee-water-leak-sensor/fingerprints.yml index 3a494274b9..b3992988d1 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/fingerprints.yml +++ b/drivers/SmartThings/zigbee-water-leak-sensor/fingerprints.yml @@ -104,3 +104,8 @@ zigbeeManufacturer: manufacturer: THIRDREALITY model: 3RWS18BZ deviceProfileName: water-battery + - id: NEO/NAS_WS11 + deviceLabel: NEO Water Leak Sensor + manufacturer: NEO + model: NAS_WS11 + deviceProfileName: water-battery