diff --git a/.github/workflows/jenkins-driver-tests.yml b/.github/workflows/jenkins-driver-tests.yml new file mode 100644 index 0000000000..ec96330d39 --- /dev/null +++ b/.github/workflows/jenkins-driver-tests.yml @@ -0,0 +1,44 @@ +name: Run Jenkins driver tests +on: + pull_request: + paths: + - 'drivers/**' + +jobs: + trigger-driver-test: + strategy: + matrix: + version: + [ 60 ] + + runs-on: ubuntu-latest + steps: + + - name: Create Commit Status (Pending) + id: status + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd + with: + script: | + core.setOutput('status_url', (await github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: 'pending', + description: 'Jenkins job triggered...', + context: 'Driver Tests (${{ matrix.version }})' + })).data.url); + - name: Trigger Jenkins Generic Webhook + env: + JENKINS_WEBHOOK_TOKEN: ${{ secrets.JENKINS_WEBHOOK_TOKEN }} + JENKINS_WEBHOOK_URL: ${{ secrets.JENKINS_WEBHOOK_URL }} + STATUS_URL: ${{ steps.status.outputs.status_url }} + run: | + set +x + curl -s -o /dev/null -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${JENKINS_WEBHOOK_TOKEN}" \ + -d "{\"status_url\": \"$STATUS_URL\", + \"version\": ${{ matrix.version }}, + \"commit\": ${{ github.event.pull_request.head.sha }} }" \ + "${JENKINS_WEBHOOK_URL}" + set -x diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e58afd5178..f6a03154cb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -39,51 +39,10 @@ jobs: id: cache_key run: echo "CACHE_KEY=${{ steps.lib-version.outputs.url }}-v1" >> $GITHUB_OUTPUT - get-dev-artifact: - runs-on: ubuntu-latest - outputs: - cache_key: ${{ steps.cache_key.outputs.CACHE_KEY }} - if: ${{ contains(join(github.event.pull_request.labels.*.name), 'release-') && github.event.pull_request.head.repo.fork != 'true' }} - steps: - - name: Get the version from the label - id: label-version - run: | - echo "${{ join(github.event.pull_request.labels.*.name) }}" | grep -oP "release-\d+.\d+" | xargs > out - echo "LIBRARY_VERSION=$(cat out)" >> $GITHUB_OUTPUT - mkdir /home/runner/work/lua_libs - - name: Find latest artifact - id: latest - env: - ARTIFACTORY_URL: ${{ format('https://smartthings.jfrog.io/artifactory/edge-driver-libs/{0}/', steps.label-version.outputs.LIBRARY_VERSION) }} - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - run: | - wget --user=$ARTIFACTORY_USERNAME --password=$ARTIFACTORY_PASSWORD $ARTIFACTORY_URL -q -O - | grep '.zip' | awk -F' ' '{print $3"-"$4"\t"$2}' | sort -t - -k3n -k2M -k1n -k4n | tail -1 | grep -o 'lua_libs_[a-z0-9_]*.zip' | head -1 > out - echo "ZIP_FILE=$(cat out)" >> $GITHUB_OUTPUT - - name: Try to retrieve cache - id: cached-libs - uses: actions/cache@v3 - with: - path: '/home/runner/work/lua_libs' - key: ${{ steps.latest.outputs.ZIP_FILE }}-v1 - - name: Download and unpack specified version - if: steps.cached-libs.outputs.cache-hit != 'true' - env: - ARTIFACTORY_URL: ${{ format('https://smartthings.jfrog.io/artifactory/edge-driver-libs/{0}/{1}', steps.label-version.outputs.LIBRARY_VERSION, steps.latest.outputs.ZIP_FILE) }} - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - working-directory: '/home/runner/work/lua_libs' - run: | - wget --user=$ARTIFACTORY_USERNAME --password=$ARTIFACTORY_PASSWORD $ARTIFACTORY_URL -O lua_libs.zip - unzip lua_libs.zip - - name: Set output - id: cache_key - run: echo "CACHE_KEY=${{ steps.latest.outputs.ZIP_FILE }}-v1" >> $GITHUB_OUTPUT - run-driver-tests: runs-on: ubuntu-latest needs: - [ get-latest-release-artifact, get-dev-artifact ] + [ get-latest-release-artifact ] if: ${{ always() && contains(needs.*.result, 'success') && !contains(needs.*.result, 'failure') }} steps: - name: Set cache key diff --git a/drivers/SmartThings/matter-appliance/src/test/test_cook_top.lua b/drivers/SmartThings/matter-appliance/src/test/test_cook_top.lua index 4a65f8e882..99d56a5869 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_cook_top.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_cook_top.lua @@ -89,7 +89,10 @@ test.register_coroutine_test( local component_to_endpoint_map = mock_device:get_field("__component_to_endpoint_map") assert(component_to_endpoint_map["cookSurfaceOne"] == COOK_SURFACE_ONE_ENDPOINT, "Cook Surface One Endpoint must be 2") assert(component_to_endpoint_map["cookSurfaceTwo"] == COOK_SURFACE_TWO_ENDPOINT, "Cook Surface Two Endpoint must be 3") - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -112,6 +115,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, COOK_TOP_ENDPOINT) } } + }, + { + min_api_version = 19 } ) @@ -149,6 +155,9 @@ test.register_message_test( clusters.TemperatureControl.server.commands.SetTemperature(mock_device, COOK_SURFACE_TWO_ENDPOINT, nil, 0) --0 is the index where Level1 is stored. } }, + }, + { + min_api_version = 19 } ) @@ -181,6 +190,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("cookSurfaceTwo", capabilities.temperatureMeasurement.temperature({ value = 20.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-appliance/src/test/test_dishwasher.lua b/drivers/SmartThings/matter-appliance/src/test/test_dishwasher.lua index f446d1149b..0cfeb19f07 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_dishwasher.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_dishwasher.lua @@ -101,6 +101,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, APPLICATION_ENDPOINT) } } + }, + { + min_api_version = 19 } ) @@ -166,6 +169,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -231,6 +237,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -296,6 +305,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -372,6 +384,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -433,6 +448,9 @@ test.register_message_test( clusters.DishwasherMode.server.commands.ChangeToMode(mock_device, APPLICATION_ENDPOINT, 1) --1 is the index where Super Dry is stored. } } + }, + { + min_api_version = 19 } ) @@ -470,6 +488,9 @@ test.register_message_test( clusters.TemperatureControl.server.commands.SetTemperature(mock_device, APPLICATION_ENDPOINT, nil, 0) --0 is the index where Level1 is stored. } }, + }, + { + min_api_version = 19 } ) @@ -526,6 +547,9 @@ test.register_message_test( clusters.TemperatureControl.commands.SetTemperature(mock_device, APPLICATION_ENDPOINT, 40 * 100, nil) } }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-appliance/src/test/test_extractor_hood.lua b/drivers/SmartThings/matter-appliance/src/test/test_extractor_hood.lua index b8d18a3ab4..ca85e49214 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_extractor_hood.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_extractor_hood.lua @@ -174,6 +174,9 @@ test.register_message_test( clusters.FanControl.attributes.PercentSetting:write(mock_device, 1, 50) } } + }, + { + min_api_version = 19 } ) @@ -245,6 +248,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.fanMode.fanMode("auto")) } + }, + { + min_api_version = 19 } ) @@ -331,6 +337,9 @@ test.register_message_test( clusters.FanControl.attributes.FanMode:write(mock_device, 1, clusters.FanControl.types.FanModeEnum.AUTO) } } + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -441,6 +450,9 @@ test.register_message_test( capabilities.fanMode.fanMode.high.NAME }, {visibility={displayed=false}})) } + }, + { + min_api_version = 19 } ) @@ -476,6 +488,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.windMode.windMode.naturalWind()) } + }, + { + min_api_version = 19 } ) @@ -514,6 +529,9 @@ test.register_message_test( clusters.FanControl.attributes.WindSetting:write(mock_device, 1, clusters.FanControl.types.WindSettingMask.NATURAL_WIND) } } + }, + { + min_api_version = 19 } ) @@ -572,6 +590,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("hepaFilter", capabilities.filterStatus.filterStatus.replace()) }, + }, + { + min_api_version = 19 } ) @@ -630,6 +651,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("activatedCarbonFilter", capabilities.filterStatus.filterStatus.replace()) }, + }, + { + min_api_version = 19 } ) @@ -640,7 +664,10 @@ test.register_coroutine_test( mock_device_onoff:expect_metadata_update({ profile = "extractor-hood-wind-light" }) mock_device_onoff:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end, - { test_init = test_init_onoff } + { + test_init = test_init_onoff, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -663,7 +690,10 @@ test.register_coroutine_test( clusters.OnOff.server.commands.Off(mock_device_onoff, 2) }) end, - { test_init = test_init_onoff } + { + test_init = test_init_onoff, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -684,7 +714,10 @@ test.register_coroutine_test( mock_device_onoff:generate_test_message("light", capabilities.switch.switch.off()) ) end, - { test_init = test_init_onoff } + { + test_init = test_init_onoff, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-appliance/src/test/test_laundry_dryer.lua b/drivers/SmartThings/matter-appliance/src/test/test_laundry_dryer.lua index 9049b5f64e..5c01970d7b 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_laundry_dryer.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_laundry_dryer.lua @@ -100,6 +100,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, APPLICATION_ENDPOINT) } } + }, + { + min_api_version = 19 } ) @@ -165,6 +168,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -230,6 +236,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -295,6 +304,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -371,6 +383,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -432,6 +447,9 @@ test.register_message_test( clusters.LaundryWasherMode.server.commands.ChangeToMode(mock_device, APPLICATION_ENDPOINT, 1) --1 is the index where Super Dry is stored. } } + }, + { + min_api_version = 19 } ) @@ -469,6 +487,9 @@ test.register_message_test( clusters.TemperatureControl.server.commands.SetTemperature(mock_device, APPLICATION_ENDPOINT, nil, 0) --0 is the index where Level1 is stored. } }, + }, + { + min_api_version = 19 } ) @@ -525,6 +546,9 @@ test.register_message_test( clusters.TemperatureControl.commands.SetTemperature(mock_device, APPLICATION_ENDPOINT, 40 * 100, nil) } }, + }, + { + min_api_version = 19 } ) @@ -565,6 +589,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureSetpoint.temperatureSetpoint({value = 50.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-appliance/src/test/test_laundry_washer.lua b/drivers/SmartThings/matter-appliance/src/test/test_laundry_washer.lua index 6f7ef3ee5c..a0df2e229b 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_laundry_washer.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_laundry_washer.lua @@ -133,6 +133,9 @@ test.register_message_test( clusters.TemperatureControl.commands.SetTemperature(mock_device_washer, APPLICATION_ENDPOINT, 25 * 100, nil) } }, + }, + { + min_api_version = 19 } ) @@ -173,6 +176,9 @@ test.register_message_test( direction = "send", message = mock_device_washer:generate_test_message("main", capabilities.temperatureSetpoint.temperatureSetpoint({value = 30.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-appliance/src/test/test_matter_appliance_rpc_5.lua b/drivers/SmartThings/matter-appliance/src/test/test_matter_appliance_rpc_5.lua index d8faa1e5ee..4df43c94fc 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_matter_appliance_rpc_5.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_matter_appliance_rpc_5.lua @@ -456,7 +456,10 @@ test.register_coroutine_test( { mock_device_dishwasher.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_dishwasher, dishwasher_ep, 40 * 100, nil) } ) end, - { test_init = test_init_dishwasher } + { + test_init = test_init_dishwasher, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -495,7 +498,10 @@ test.register_coroutine_test( { mock_device_dishwasher.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_dishwasher, dishwasher_ep, 50 * 100, nil) } ) end, - { test_init = test_init_dishwasher } + { + test_init = test_init_dishwasher, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -534,7 +540,10 @@ test.register_coroutine_test( { mock_device_washer.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_washer, washer_ep, 28 * 100, nil) } ) end, - { test_init = test_init_washer } + { + test_init = test_init_washer, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -573,7 +582,10 @@ test.register_coroutine_test( { mock_device_washer.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_washer, washer_ep, 50 * 100, nil) } ) end, - { test_init = test_init_washer } + { + test_init = test_init_washer, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -612,7 +624,10 @@ test.register_coroutine_test( { mock_device_dryer.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_dryer, dryer_ep, 40 * 100, nil) } ) end, - { test_init = test_init_dryer } + { + test_init = test_init_dryer, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -651,7 +666,10 @@ test.register_coroutine_test( { mock_device_dryer.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_dryer, dryer_ep, 40 * 100, nil) } ) end, - { test_init = test_init_dryer } + { + test_init = test_init_dryer, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -690,7 +708,10 @@ test.register_coroutine_test( { mock_device_oven.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_oven, oven_tcc_one_ep, 140 * 100, nil) } ) end, - { test_init = test_init_oven } + { + test_init = test_init_oven, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -729,7 +750,10 @@ test.register_coroutine_test( { mock_device_oven.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_oven, oven_tcc_one_ep, 140 * 100, nil) } ) end, - { test_init = test_init_oven } + { + test_init = test_init_oven, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -768,7 +792,10 @@ test.register_coroutine_test( { mock_device_refrigerator.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_refrigerator, refrigerator_ep, 4 * 100, nil) } ) end, - { test_init = test_init_refrigerator } + { + test_init = test_init_refrigerator, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -807,7 +834,10 @@ test.register_coroutine_test( { mock_device_refrigerator.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_refrigerator, refrigerator_ep, 10 * 100, nil) } ) end, - { test_init = test_init_refrigerator } + { + test_init = test_init_refrigerator, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -846,7 +876,10 @@ test.register_coroutine_test( { mock_device_refrigerator.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_refrigerator, freezer_ep, -15 * 100, nil) } ) end, - { test_init = test_init_refrigerator } + { + test_init = test_init_refrigerator, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -885,7 +918,10 @@ test.register_coroutine_test( { mock_device_refrigerator.id, clusters.TemperatureControl.commands.SetTemperature(mock_device_refrigerator, freezer_ep, -20 * 100, nil) } ) end, - { test_init = test_init_refrigerator } + { + test_init = test_init_refrigerator, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-appliance/src/test/test_microwave_oven.lua b/drivers/SmartThings/matter-appliance/src/test/test_microwave_oven.lua index 624f1751f6..14402c5157 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_microwave_oven.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_microwave_oven.lua @@ -172,6 +172,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -254,7 +257,8 @@ test.register_message_test( test_init = function() test_init() init_supported_microwave_oven_modes() - end + end, + min_api_version = 19 } ) @@ -332,6 +336,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -444,6 +451,9 @@ test.register_message_test( })) } }, -- on receiving NO ERROR we don't do anything. + }, + { + min_api_version = 19 } ) @@ -467,6 +477,9 @@ test.register_message_test( maximum = 900 },{visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -557,6 +570,9 @@ test.register_message_test( 300) } }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-appliance/src/test/test_oven.lua b/drivers/SmartThings/matter-appliance/src/test/test_oven.lua index 76a23a0f44..8c146f2bd5 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_oven.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_oven.lua @@ -141,7 +141,10 @@ test.register_coroutine_test( "Cook Surface One Endpoint must be 5") assert(component_to_endpoint_map["cookSurfaceTwo"] == COOK_SURFACE_TWO_ENDPOINT, "Cook Surface Two Endpoint must be 6") - end + end, + { + min_api_version = 19 + } ) @@ -201,6 +204,9 @@ test.register_message_test( clusters.OvenMode.commands.ChangeToMode(mock_device, OVEN_TCC_ONE_ENDPOINT, 0) --Index where Grill is stored) } } + }, + { + min_api_version = 19 } ) @@ -220,6 +226,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("tccOne", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -276,6 +285,9 @@ test.register_message_test( clusters.TemperatureControl.commands.SetTemperature(mock_device, OVEN_TCC_ONE_ENDPOINT, 130 * 100, nil) } }, + }, + { + min_api_version = 19 } ) @@ -335,6 +347,9 @@ test.register_message_test( clusters.OvenMode.commands.ChangeToMode(mock_device, OVEN_TCC_TWO_ENDPOINT, 1) --Index where Pre Heat is stored } } + }, + { + min_api_version = 19 } ) @@ -354,6 +369,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("tccTwo", capabilities.temperatureMeasurement.temperature({ value = 50.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -391,6 +409,9 @@ test.register_message_test( clusters.TemperatureControl.server.commands.SetTemperature(mock_device, OVEN_TCC_TWO_ENDPOINT, nil, 0) --0 is the index where Level1 is stored. } }, + }, + { + min_api_version = 19 } ) @@ -414,6 +435,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, COOK_TOP_ENDPOINT) } } + }, + { + min_api_version = 19 } ) @@ -449,6 +473,9 @@ test.register_message_test( clusters.TemperatureControl.server.commands.SetTemperature(mock_device, COOK_SURFACE_ONE_ENDPOINT, nil, 2) -- 2 is the index where Level 5 is stored. } }, + }, + { + min_api_version = 19 } ) @@ -484,6 +511,9 @@ test.register_message_test( clusters.TemperatureControl.server.commands.SetTemperature(mock_device, COOK_SURFACE_TWO_ENDPOINT, nil, 1) -- 1 is the index where Level 4 is stored. } }, + }, + { + min_api_version = 19 } ) @@ -503,6 +533,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("cookSurfaceOne", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -522,6 +555,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("cookSurfaceTwo", capabilities.temperatureMeasurement.temperature({ value = 20.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-appliance/src/test/test_refrigerator.lua b/drivers/SmartThings/matter-appliance/src/test/test_refrigerator.lua index 0ac94856e3..3158f69298 100644 --- a/drivers/SmartThings/matter-appliance/src/test/test_refrigerator.lua +++ b/drivers/SmartThings/matter-appliance/src/test/test_refrigerator.lua @@ -145,6 +145,9 @@ test.register_message_test( clusters.RefrigeratorAndTemperatureControlledCabinetMode.server.commands.ChangeToMode(mock_device, refrigerator_ep, 1) --1 is the index where Super Dry is stored. } } + }, + { + min_api_version = 19 } ) @@ -201,6 +204,9 @@ test.register_message_test( clusters.TemperatureControl.commands.SetTemperature(mock_device, refrigerator_ep, 4 * 100, nil) } }, + }, + { + min_api_version = 19 } ) @@ -241,6 +247,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("refrigerator", capabilities.temperatureSetpoint.temperatureSetpoint({value = 7.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -297,6 +306,9 @@ test.register_message_test( clusters.TemperatureControl.commands.SetTemperature(mock_device, freezer_ep, -15 * 100, nil) } }, + }, + { + min_api_version = 19 } ) @@ -337,6 +349,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("freezer", capabilities.temperatureSetpoint.temperatureSetpoint({value = -15.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-button/src/test/skip_test_latching_switch.lua b/drivers/SmartThings/matter-button/src/test/skip_test_latching_switch.lua index 58475ae0cc..084dc9048a 100644 --- a/drivers/SmartThings/matter-button/src/test/skip_test_latching_switch.lua +++ b/drivers/SmartThings/matter-button/src/test/skip_test_latching_switch.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" local t_utils = require "integration_test.utils" @@ -81,7 +84,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -116,7 +122,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -135,7 +144,10 @@ test.register_coroutine_test( ) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) -- run the tests diff --git a/drivers/SmartThings/matter-button/src/test/test_matter_button.lua b/drivers/SmartThings/matter-button/src/test/test_matter_button.lua index c18daeab98..0c703c642d 100644 --- a/drivers/SmartThings/matter-button/src/test/test_matter_button.lua +++ b/drivers/SmartThings/matter-button/src/test/test_matter_button.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" local t_utils = require "integration_test.utils" @@ -66,6 +69,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) --should send initial press } +}, +{ + min_api_version = 19 } ) @@ -101,6 +107,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.held({state_change = true})) } +}, +{ + min_api_version = 19 } ) @@ -137,6 +146,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -182,6 +194,9 @@ test.register_message_test( ) } }, + }, + { + min_api_version = 19 } ) @@ -203,6 +218,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -224,6 +242,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "pushed_3x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -245,6 +266,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "pushed_3x", "pushed_4x", "pushed_5x", "pushed_6x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -282,6 +306,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", button_attr.double({state_change = true})) }, +}, +{ + min_api_version = 19 } ) @@ -319,6 +346,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", button_attr.pushed_4x({state_change = true})) }, +}, +{ + min_api_version = 19 } ) @@ -341,6 +371,9 @@ test.register_message_test( "main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5)) ), }, + }, + { + min_api_version = 19 } ) -- run the tests diff --git a/drivers/SmartThings/matter-button/src/test/test_matter_button_parent_child.lua b/drivers/SmartThings/matter-button/src/test/test_matter_button_parent_child.lua index a9d2629803..64396e46f4 100644 --- a/drivers/SmartThings/matter-button/src/test/test_matter_button_parent_child.lua +++ b/drivers/SmartThings/matter-button/src/test/test_matter_button_parent_child.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" local t_utils = require "integration_test.utils" @@ -131,6 +134,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) --should send initial press } +}, +{ + min_api_version = 19 } ) @@ -162,6 +168,9 @@ test.register_message_test( direction = "send", message = mock_children[3]:generate_test_message("main", button_attr.pushed({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -202,6 +211,9 @@ test.register_message_test( ) } }, + }, + { + min_api_version = 19 } ) @@ -223,6 +235,9 @@ test.register_message_test( message = mock_children[4]:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "held", "pushed_3x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -244,6 +259,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "pushed_3x", "pushed_4x", "pushed_5x", "pushed_6x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -275,6 +293,9 @@ test.register_message_test( message = mock_children[4]:generate_test_message("main", button_attr.double({state_change = true})) }, +}, +{ + min_api_version = 19 } ) @@ -306,6 +327,9 @@ test.register_message_test( message = mock_children[4]:generate_test_message("main", button_attr.pushed_4x({state_change = true})) }, +}, +{ + min_api_version = 19 } ) @@ -328,6 +352,9 @@ test.register_message_test( "main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5)) ), }, + }, + { + min_api_version = 19 } ) -- run the tests diff --git a/drivers/SmartThings/matter-button/src/test/test_matter_multi_button.lua b/drivers/SmartThings/matter-button/src/test/test_matter_multi_button.lua index 2ecf083ba7..2549698c61 100644 --- a/drivers/SmartThings/matter-button/src/test/test_matter_multi_button.lua +++ b/drivers/SmartThings/matter-button/src/test/test_matter_multi_button.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" local t_utils = require "integration_test.utils" @@ -131,6 +134,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) --should send initial press } +}, +{ + min_api_version = 19 } ) @@ -161,6 +167,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("button2", button_attr.pushed({state_change = true})) --should send initial press } +}, +{ + min_api_version = 19 } ) @@ -183,7 +192,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button2", button_attr.held({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -205,7 +217,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button3", button_attr.pushed({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -226,7 +241,10 @@ test.register_coroutine_test( mock_device, 50, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -263,7 +281,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button4", button_attr.double({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -288,7 +309,10 @@ test.register_coroutine_test( mock_device, 30, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -313,7 +337,10 @@ test.register_coroutine_test( mock_device, 50, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -348,6 +375,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.held({state_change = true})) } +}, +{ + min_api_version = 19 } ) @@ -384,6 +414,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -429,6 +462,9 @@ test.register_message_test( ) } }, + }, + { + min_api_version = 19 } ) @@ -450,6 +486,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -471,6 +510,9 @@ test.register_message_test( message = mock_device:generate_test_message("button4", capabilities.button.supportedButtonValues({"pushed", "double", "held", "pushed_3x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -492,6 +534,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "pushed_3x", "pushed_4x", "pushed_5x", "pushed_6x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -529,6 +574,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", button_attr.double({state_change = true})) }, +}, +{ + min_api_version = 19 } ) @@ -566,6 +614,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", button_attr.pushed_4x({state_change = true})) }, +}, +{ + min_api_version = 19 } ) @@ -588,6 +639,9 @@ test.register_message_test( "main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5)) ), }, + }, + { + min_api_version = 19 } ) @@ -630,6 +684,9 @@ test.register_message_test( } } -- no double event +}, +{ + min_api_version = 19 } ) @@ -685,6 +742,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("button4", button_attr.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) -- run the tests diff --git a/drivers/SmartThings/matter-energy/src/test/test_battery_storage.lua b/drivers/SmartThings/matter-energy/src/test/test_battery_storage.lua index 5b5734acf5..a9c652f661 100644 --- a/drivers/SmartThings/matter-energy/src/test/test_battery_storage.lua +++ b/drivers/SmartThings/matter-energy/src/test/test_battery_storage.lua @@ -102,7 +102,10 @@ test.register_coroutine_test( "main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5)) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Battery charge state must reported properly", @@ -157,7 +160,10 @@ test.register_coroutine_test( mock_device:generate_test_message( "main", capabilities.chargingState.chargingState.error()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +177,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 30.0, unit = "W" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -185,7 +194,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 30.0, unit = "W" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -288,7 +300,8 @@ test.register_coroutine_test( { test_init = function() test_init() - end + end, + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-energy/src/test/test_evse.lua b/drivers/SmartThings/matter-energy/src/test/test_evse.lua index 6add71bde9..0aeed44209 100644 --- a/drivers/SmartThings/matter-energy/src/test/test_evse.lua +++ b/drivers/SmartThings/matter-energy/src/test/test_evse.lua @@ -118,7 +118,10 @@ test.register_coroutine_test( assert(component_to_endpoint_map["electricalSensor"] == ELECTRICAL_SENSOR_EP, "Electrical Sensor Endpoint must be 2") assert(component_to_endpoint_map["deviceEnergyManagement"] == DEVICE_ENERGY_MANAGEMENT_DEVICE_EP, "Device Energy Management Endpoint must be 3") - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -145,6 +148,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.evseChargingSession.chargingState.charging({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -193,6 +199,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.evseChargingSession.chargingState.charging({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -214,6 +223,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.evseState.faultState.groundFault()) } + }, + { + min_api_version = 19 } ) @@ -234,6 +246,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.evseChargingSession.targetEndTime("2024-08-23T07:47:22Z")) } + }, + { + min_api_version = 19 } ) @@ -254,6 +269,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.evseChargingSession.minCurrent(0)) } + }, + { + min_api_version = 19 } ) @@ -274,6 +292,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.evseChargingSession.maxCurrent(10000)) } + }, + { + min_api_version = 19 } ) @@ -294,6 +315,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.evseChargingSession.sessionTime(9000)) } + }, + { + min_api_version = 19 } ) @@ -314,6 +338,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.evseChargingSession.energyDelivered(900000)) } + }, + { + min_api_version = 19 } ) @@ -335,6 +362,9 @@ test.register_message_test( message = mock_device:generate_test_message("electricalSensor", capabilities.powerSource.powerSource.mains()) } + }, + { + min_api_version = 19 } ) @@ -406,6 +436,9 @@ test.register_message_test( clusters.EnergyEvseMode.commands.ChangeToMode(mock_device, EVSE_EP, 0) --Index is Auto-Scheduled } } + }, + { + min_api_version = 19 } ) @@ -506,6 +539,9 @@ test.register_message_test( clusters.DeviceEnergyManagementMode.commands.ChangeToMode(mock_device, DEVICE_ENERGY_MANAGEMENT_DEVICE_EP, 0) --Index is Grid Energy Management } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-energy/src/test/test_evse_energy_meas.lua b/drivers/SmartThings/matter-energy/src/test/test_evse_energy_meas.lua index 610c443625..ba5d6d6101 100644 --- a/drivers/SmartThings/matter-energy/src/test/test_evse_energy_meas.lua +++ b/drivers/SmartThings/matter-energy/src/test/test_evse_energy_meas.lua @@ -116,7 +116,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) mock_device:expect_metadata_update({ profile = "evse-energy-meas" }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -148,7 +151,8 @@ test.register_coroutine_test( { test_init = function() test_init() - end + end, + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-energy/src/test/test_solar_power.lua b/drivers/SmartThings/matter-energy/src/test/test_solar_power.lua index c7446af44b..0e248624d9 100644 --- a/drivers/SmartThings/matter-energy/src/test/test_solar_power.lua +++ b/drivers/SmartThings/matter-energy/src/test/test_solar_power.lua @@ -122,7 +122,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 35.0, unit = "W" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -168,7 +171,8 @@ test.register_coroutine_test( { test_init = function() test_init() - end + end, + min_api_version = 19 } ) @@ -191,7 +195,10 @@ test.register_coroutine_test( .CumulativeEnergyImported:build_test_report_data(mock_device, SOLAR_POWER_EP_ONE, clusters.ElectricalEnergyMeasurement.types.EnergyMeasurementStruct({ energy = 100000, start_timestamp = 0, end_timestamp = 0, start_systime = 0, end_systime = 0, apparent_energy = 0, reactive_energy = 0 })) }) --100Wh - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-hrap/src/test/test_thread_border_router_network.lua b/drivers/SmartThings/matter-hrap/src/test/test_thread_border_router_network.lua index 0467e19de3..f4d2450c58 100644 --- a/drivers/SmartThings/matter-hrap/src/test/test_thread_border_router_network.lua +++ b/drivers/SmartThings/matter-hrap/src/test/test_thread_border_router_network.lua @@ -106,7 +106,10 @@ test.register_coroutine_test( mock_device, 1, 6 ) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -138,6 +141,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.threadBorderRouter.threadInterfaceState("disabled")) } + }, + { + min_api_version = 19 } ) @@ -183,6 +189,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.threadBorderRouter.borderRouterName({ value = "john foo no suffix"})) }, + }, + { + min_api_version = 19 } ) @@ -202,6 +211,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.wifiInformation.ssid({ value = "test name for ssid!" })) } + }, + { + min_api_version = 19 } ) @@ -216,6 +228,9 @@ test.register_message_test( clusters.WifiNetworkMangement.attributes.Ssid:build_test_report_data(mock_device, 1, string.char(data_types.Null.ID)) } } + }, + { + min_api_version = 19 } ) @@ -230,6 +245,9 @@ test.register_message_test( clusters.WifiNetworkMangement.attributes.Ssid:build_test_report_data(mock_device, 1, string.char(0xC0)) -- 0xC0 never appears in utf8 } } + }, + { + min_api_version = 19 } ) @@ -336,7 +354,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.threadNetwork.panId({ value = 55672 })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/new-matter-lock/init.lua b/drivers/SmartThings/matter-lock/src/new-matter-lock/init.lua index cca7a56b27..1e7d461eda 100644 --- a/drivers/SmartThings/matter-lock/src/new-matter-lock/init.lua +++ b/drivers/SmartThings/matter-lock/src/new-matter-lock/init.lua @@ -324,15 +324,15 @@ local function deep_equals(a, b, opts, seen) end -- Compare keys/values from a - for k, v in next, a do - if not deep_equals(v, rawget(b, k), opts, seen) then + for k, v in pairs(a) do + if not deep_equals(v, b[k], opts, seen) then return false end end -- Ensure b doesn't have extra keys - for k in next, b do - if rawget(a, k) == nil then + for k in pairs(b) do + if a[k] == nil then return false end end diff --git a/drivers/SmartThings/matter-lock/src/test/test_aqara_matter_lock.lua b/drivers/SmartThings/matter-lock/src/test/test_aqara_matter_lock.lua index dec8911484..fa55d37774 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_aqara_matter_lock.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_aqara_matter_lock.lua @@ -93,6 +93,9 @@ test.register_message_test( direction = "send", message = {mock_device.id, clusters.DoorLock.server.commands.LockDoor(mock_device, 1)}, }, + }, + { + min_api_version = 19 } ) @@ -114,6 +117,9 @@ test.register_message_test( clusters.DoorLock.server.commands.UnlockDoor(mock_device, 1), }, }, + }, + { + min_api_version = 19 } ) @@ -133,7 +139,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.locked()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -152,7 +161,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +183,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.not_fully_locked()) ) - end + end, + { + min_api_version = 19 + } ) local function refresh_commands(dev) @@ -194,6 +209,9 @@ test.register_message_test( direction = "send", message = {mock_device.id, refresh_commands(mock_device)}, }, + }, + { + min_api_version = 19 } ) @@ -290,6 +308,9 @@ test.register_message_test( capabilities.lockAlarm.alarm.forcedOpeningAttempt({state_change = true}) ), }, + }, + { + min_api_version = 19 } ) @@ -304,7 +325,10 @@ test.register_coroutine_test( capabilities.lockAlarm.alarm.clear({state_change = true}) ) ) -end +end, +{ + min_api_version = 19 +} ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_bridged_matter_lock.lua b/drivers/SmartThings/matter-lock/src/test/test_bridged_matter_lock.lua index eb8ec9fa98..12872290e0 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_bridged_matter_lock.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_bridged_matter_lock.lua @@ -91,7 +91,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) mock_device:expect_metadata_update({ profile = "base-lock-nobattery" }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -99,7 +102,10 @@ test.register_coroutine_test( function() test.socket.device_lifecycle:__queue_receive({ mock_device_level.id, "doConfigure" }) mock_device_level:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_matter_lock.lua b/drivers/SmartThings/matter-lock/src/test/test_matter_lock.lua index 8fd0cc0574..da6a13ecad 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_matter_lock.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_matter_lock.lua @@ -69,6 +69,9 @@ test.register_message_test( direction = "send", message = {mock_device.id, clusters.DoorLock.server.commands.LockDoor(mock_device, 10)}, }, + }, + { + min_api_version = 19 } ) @@ -90,6 +93,9 @@ test.register_message_test( clusters.DoorLock.server.commands.UnlockDoor(mock_device, 10), }, }, + }, + { + min_api_version = 19 } ) @@ -110,6 +116,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked()), }, + }, + { + min_api_version = 19 } ) @@ -130,6 +139,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()), }, + }, + { + min_api_version = 19 } ) @@ -150,6 +162,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.not_fully_locked()), }, + }, + { + min_api_version = 19 } ) @@ -170,6 +185,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()), }, + }, + { + min_api_version = 19 } ) @@ -192,6 +210,9 @@ test.register_message_test( "main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5)) ), }, + }, + { + min_api_version = 19 } ) @@ -216,6 +237,9 @@ test.register_message_test( direction = "send", message = {mock_device.id, refresh_commands(mock_device)}, }, + }, + { + min_api_version = 19 } ) @@ -282,6 +306,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()), }, + }, + { + min_api_version = 19 } ) @@ -319,6 +346,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()), }, + }, + { + min_api_version = 19 } ) @@ -331,7 +361,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) ) -end +end, +{ + min_api_version = 19 +} ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_battery.lua b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_battery.lua index a8f7506798..135cb84c37 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_battery.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_battery.lua @@ -119,7 +119,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ profile = "base-lock" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -144,13 +147,19 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ profile = "base-lock-batteryLevel" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Test that profile changes to base-lock-no-battery when battery feature is not available", function() end, - { test_init = test_init_no_battery } + { + test_init = test_init_no_battery, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_batteryLevel.lua b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_batteryLevel.lua index 990bff8b60..16787f10e5 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_batteryLevel.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_batteryLevel.lua @@ -92,6 +92,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.batteryLevel.battery.normal()), }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_codes.lua b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_codes.lua index a3e05c9634..6bfc5e5bfb 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_codes.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_codes.lua @@ -223,7 +223,10 @@ test.register_coroutine_test( req:merge(DoorLock.attributes.NumberOfPINUsersSupported:read(mock_device, 10)) test.socket.matter:__expect_send({mock_device.id, req}) expect_reload_all_codes_messages(mock_device) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -236,7 +239,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -257,6 +263,9 @@ test.register_message_test( capabilities.lockCodes.minCodeLength(4, {visibility = {displayed = false}}) ), }, + }, + { + min_api_version = 19 } ) @@ -278,6 +287,9 @@ test.register_message_test( capabilities.lockCodes.maxCodeLength(4, {visibility = {displayed = false}}) ), }, + }, + { + min_api_version = 19 } ) @@ -299,6 +311,9 @@ test.register_message_test( capabilities.lockCodes.maxCodes(16, {visibility = {displayed = false}}) ), }, + }, + { + min_api_version = 19 } ) @@ -318,6 +333,9 @@ test.register_message_test( ), }, } + }, + { + min_api_version = 19 } ) @@ -340,6 +358,9 @@ test.register_message_test( ), }, } + }, + { + min_api_version = 19 } ) @@ -352,7 +373,10 @@ test.register_coroutine_test( } ) expect_reload_all_codes_messages(mock_device) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -394,7 +418,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -429,7 +456,10 @@ test.register_coroutine_test( .codeChanged("1 unset", {data = {codeName = "Code 1"}, state_change = true}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -532,7 +562,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -578,7 +611,10 @@ test.register_coroutine_test( capabilities.lockCodes.lockCodes(json.encode({}), {visibility = {displayed = false}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -635,7 +671,10 @@ test.register_coroutine_test( .lockCodes(json.encode({["1"] = "test"}), {visibility = {displayed = false}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -667,7 +706,10 @@ test.register_coroutine_test( .lockCodes(json.encode({["1"] = "foo"}), {visibility = {displayed = false}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Setting a user code name via setCode should be handled", function() @@ -698,7 +740,10 @@ test.register_coroutine_test( .lockCodes(json.encode({["1"] = "foo"}), {visibility = {displayed = false}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -737,6 +782,9 @@ test.register_message_test( ) ), }, + }, + { + min_api_version = 19 } ) @@ -777,7 +825,10 @@ test.register_coroutine_test( capabilities.lockCodes.lockCodes(json.encode({}), {visibility = {displayed = false}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -853,7 +904,10 @@ test.register_coroutine_test( ) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_cota.lua b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_cota.lua index c41d911881..143c04763e 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_cota.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_cota.lua @@ -143,7 +143,10 @@ test.register_coroutine_test( "Added should kick off cota cred process", function() test.socket.matter:__set_channel_ordering("relaxed") expect_kick_off_cota_process(mock_device) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -157,7 +160,10 @@ test.register_coroutine_test( mock_device.id, clusters.DoorLock.server.commands.UnlockDoor(mock_device, 10, "1111"), }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +177,10 @@ test.register_coroutine_test( mock_device.id, clusters.DoorLock.server.commands.LockDoor(mock_device, 10, "1111"), }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -203,7 +212,10 @@ test.register_coroutine_test( DoorLock.types.DlUserType.REMOTE_ONLY_USER -- user_type ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -224,7 +236,10 @@ test.register_coroutine_test( profile = "nonfunctional-lock", provisioning_state = "NONFUNCTIONAL" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -323,7 +338,10 @@ test.register_coroutine_test( ) local read_attribute_list = clusters.PowerSource.attributes.AttributeList:read() test.socket.matter:__expect_send({mock_device.id, read_attribute_list}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -418,7 +436,10 @@ test.register_coroutine_test( ) local read_attribute_list = clusters.PowerSource.attributes.AttributeList:read() test.socket.matter:__expect_send({mock_device.id, read_attribute_list}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -506,7 +527,10 @@ test.register_coroutine_test( ) local read_attribute_list = clusters.PowerSource.attributes.AttributeList:read() test.socket.matter:__expect_send({mock_device.id, read_attribute_list}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -563,7 +587,10 @@ test.register_coroutine_test( DoorLock.types.DlUserType.REMOTE_ONLY_USER -- user_type ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -600,7 +627,10 @@ test.register_coroutine_test( ) }) test.mock_time.advance_time(2) - end + end, + { + min_api_version = 19 + } ) @@ -678,7 +708,10 @@ test.register_coroutine_test( DoorLock.types.DlUserType.REMOTE_ONLY_USER -- user_type ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -710,12 +743,18 @@ test.register_coroutine_test( DoorLock.types.DlUserType.REMOTE_ONLY_USER -- user_type ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Delay setting COTA cred if another cred is already being set.", function() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_modular.lua b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_modular.lua index bb217dcdae..3ac725ea9b 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_modular.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_modular.lua @@ -359,7 +359,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({"lock", "unlock"}, {visibility = {displayed = false}})) ) mock_device:expect_metadata_update({ profile = "lock-modular", optional_component_capabilities = {{"main", {"batteryLevel"}}} }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -391,7 +394,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({"lock", "unlock"}, {visibility = {displayed = false}})) ) mock_device:expect_metadata_update({ profile = "lock-modular", optional_component_capabilities = {{"main", {"battery"}}} }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -423,7 +429,10 @@ test.register_coroutine_test( ) mock_device_unlatch:expect_metadata_update({ profile = "lock-modular-embedded-unlatch", optional_component_capabilities = {{"main", {"batteryLevel"}}} }) end, - { test_init = test_init_unlatch } + { + test_init = test_init_unlatch, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -456,7 +465,10 @@ test.register_coroutine_test( ) mock_device_unlatch:expect_metadata_update({ profile = "lock-modular-embedded-unlatch", optional_component_capabilities = {{"main", {"battery"}}} }) end, - { test_init = test_init_unlatch } + { + test_init = test_init_unlatch, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -489,7 +501,10 @@ test.register_coroutine_test( ) mock_device_user_pin:expect_metadata_update({ profile = "lock-modular", optional_component_capabilities = {{"main", {"lockUsers", "lockCredentials", "battery"}}} }) end, - { test_init = test_init_user_pin } + { + test_init = test_init_user_pin, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -523,7 +538,10 @@ test.register_coroutine_test( mock_device_user_pin_schedule_unlatch:expect_metadata_update({ profile = "lock-modular-embedded-unlatch", optional_component_capabilities = {{"main", {"lockUsers", "lockCredentials", "lockSchedules", "battery"}}} }) end, - { test_init = test_init_user_pin_schedule_unlatch } + { + test_init = test_init_user_pin_schedule_unlatch, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -599,7 +617,10 @@ test.register_coroutine_test( mock_device_modular:generate_test_message("main", capabilities.lockAlarm.supportedAlarmValues({"unableToLockTheDoor"}, {visibility = {displayed = false}})) ) end, - { test_init = test_init_modular } + { + test_init = test_init_modular, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_unlatch.lua b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_unlatch.lua index 0a8c9acb09..56f6da5e41 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_matter_lock_unlatch.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_matter_lock_unlatch.lua @@ -104,7 +104,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({"lock", "unlock", "unlatch"}, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -152,7 +155,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({}, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -170,6 +176,9 @@ test.register_message_test( direction = "send", message = {mock_device.id, DoorLock.server.commands.LockDoor(mock_device, 1)}, }, + }, + { + min_api_version = 19 } ) @@ -191,6 +200,9 @@ test.register_message_test( DoorLock.server.commands.UnboltDoor(mock_device, 1), }, }, + }, + { + min_api_version = 19 } ) @@ -212,6 +224,9 @@ test.register_message_test( DoorLock.server.commands.UnlockDoor(mock_device, 1), }, }, + }, + { + min_api_version = 19 } ) @@ -231,7 +246,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.locked()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -250,7 +268,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -269,7 +290,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.unlatched()) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -355,6 +379,9 @@ test.register_message_test( ) ), } + }, + { + min_api_version = 19 } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_new_matter_lock.lua b/drivers/SmartThings/matter-lock/src/test/test_new_matter_lock.lua index dbdb4f246c..19cc296e34 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_new_matter_lock.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_new_matter_lock.lua @@ -113,7 +113,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({"lock", "unlock"}, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -161,7 +164,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({}, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -178,7 +184,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockUsers.totalUsersSupported(10, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -195,7 +204,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockCredentials.pinUsersSupported(10, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -212,7 +224,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockCredentials.minPinCodeLen(6, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -229,7 +244,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockCredentials.maxPinCodeLen(8, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -246,7 +264,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockSchedules.weekDaySchedulesPerUser(5, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -263,7 +284,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockSchedules.yearDaySchedulesPerUser(5, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -331,7 +355,10 @@ test.register_coroutine_test( ), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -409,7 +436,10 @@ function() ) test.mock_time.advance_time(1) test.wait_for_events() -end +end, +{ + min_api_version = 19 +} ) test.register_coroutine_test( @@ -423,7 +453,10 @@ test.register_coroutine_test( ), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -440,7 +473,10 @@ test.register_coroutine_test( mock_device.id, clusters.DoorLock.server.commands.UnlockDoor(mock_device, 1, "654123"), }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -456,7 +492,10 @@ test.register_coroutine_test( mock_device.id, clusters.DoorLock.server.commands.LockDoor(mock_device, 1, "654123"), }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -474,6 +513,9 @@ test.register_message_test( direction = "send", message = {mock_device.id, DoorLock.server.commands.LockDoor(mock_device, 1)}, }, + }, + { + min_api_version = 19 } ) @@ -495,6 +537,9 @@ test.register_message_test( DoorLock.server.commands.UnlockDoor(mock_device, 1), }, }, + }, + { + min_api_version = 19 } ) @@ -514,7 +559,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.locked()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -533,7 +581,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -552,7 +603,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lock.lock.not_fully_locked()) ) - end + end, + { + min_api_version = 19 + } ) local function refresh_commands(dev) @@ -575,6 +629,9 @@ test.register_message_test( direction = "send", message = {mock_device.id, refresh_commands(mock_device)}, }, + }, + { + min_api_version = 19 } ) @@ -671,6 +728,9 @@ test.register_message_test( capabilities.lockAlarm.alarm.forcedOpeningAttempt({state_change = true}) ), }, + }, + { + min_api_version = 19 } ) @@ -895,6 +955,9 @@ test.register_message_test( ) ), } + }, + { + min_api_version = 19 } ) @@ -909,7 +972,10 @@ test.register_coroutine_test( capabilities.lockAlarm.alarm.clear({state_change = true}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -975,7 +1041,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -999,7 +1068,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1040,7 +1112,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1086,7 +1161,10 @@ test.register_coroutine_test( ) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1110,7 +1188,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1173,7 +1254,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1197,7 +1281,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1260,7 +1347,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1284,7 +1374,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1346,7 +1439,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1372,7 +1468,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1425,7 +1524,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1485,7 +1587,10 @@ test.register_coroutine_test( ), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1538,7 +1643,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1591,7 +1699,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1617,7 +1728,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1668,7 +1782,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1694,7 +1811,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1763,7 +1883,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1789,7 +1912,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1857,7 +1983,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1883,7 +2012,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1930,7 +2062,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1959,7 +2094,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-lock/src/test/test_new_matter_lock_battery.lua b/drivers/SmartThings/matter-lock/src/test/test_new_matter_lock_battery.lua index 64e93165c3..8b31a80b0c 100644 --- a/drivers/SmartThings/matter-lock/src/test/test_new_matter_lock_battery.lua +++ b/drivers/SmartThings/matter-lock/src/test/test_new_matter_lock_battery.lua @@ -299,7 +299,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({"lock", "unlock"}, {visibility = {displayed = false}})) ) mock_device:expect_metadata_update({ profile = "lock" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -327,7 +330,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({"lock", "unlock"}, {visibility = {displayed = false}})) ) mock_device:expect_metadata_update({ profile = "lock-batteryLevel" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -356,7 +362,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.lock.supportedLockCommands({"lock", "unlock"}, {visibility = {displayed = false}})) ) mock_device:expect_metadata_update({ profile = "lock-battery" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -384,7 +393,10 @@ test.register_coroutine_test( ) mock_device_unlatch:expect_metadata_update({ profile = "lock-unlatch" }) end, - { test_init = test_init_unlatch } + { + test_init = test_init_unlatch, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -413,7 +425,10 @@ test.register_coroutine_test( ) mock_device_unlatch:expect_metadata_update({ profile = "lock-unlatch-batteryLevel" }) end, - { test_init = test_init_unlatch } + { + test_init = test_init_unlatch, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -443,7 +458,10 @@ test.register_coroutine_test( ) mock_device_unlatch:expect_metadata_update({ profile = "lock-unlatch-battery" }) end, - { test_init = test_init_unlatch } + { + test_init = test_init_unlatch, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -471,7 +489,10 @@ test.register_coroutine_test( ) mock_device_user_pin:expect_metadata_update({ profile = "lock-user-pin" }) end, - { test_init = test_init_user_pin } + { + test_init = test_init_user_pin, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -500,7 +521,10 @@ test.register_coroutine_test( ) mock_device_user_pin:expect_metadata_update({ profile = "lock-user-pin-batteryLevel" }) end, - { test_init = test_init_user_pin } + { + test_init = test_init_user_pin, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -530,7 +554,10 @@ test.register_coroutine_test( ) mock_device_user_pin:expect_metadata_update({ profile = "lock-user-pin-battery" }) end, - { test_init = test_init_user_pin } + { + test_init = test_init_user_pin, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -558,7 +585,10 @@ test.register_coroutine_test( ) mock_device_user_pin_schedule_unlatch:expect_metadata_update({ profile = "lock-user-pin-schedule-unlatch" }) end, - { test_init = test_init_user_pin_schedule_unlatch } + { + test_init = test_init_user_pin_schedule_unlatch, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -587,7 +617,10 @@ test.register_coroutine_test( ) mock_device_user_pin_schedule_unlatch:expect_metadata_update({ profile = "lock-user-pin-schedule-unlatch-batteryLevel" }) end, - { test_init = test_init_user_pin_schedule_unlatch } + { + test_init = test_init_user_pin_schedule_unlatch, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -617,7 +650,10 @@ test.register_coroutine_test( ) mock_device_user_pin_schedule_unlatch:expect_metadata_update({ profile = "lock-user-pin-schedule-unlatch-battery" }) end, - { test_init = test_init_user_pin_schedule_unlatch } + { + test_init = test_init_user_pin_schedule_unlatch, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-media/src/test/test_matter_media_speaker.lua b/drivers/SmartThings/matter-media/src/test/test_matter_media_speaker.lua index cf5bc44648..80b0c33ff8 100644 --- a/drivers/SmartThings/matter-media/src/test/test_matter_media_speaker.lua +++ b/drivers/SmartThings/matter-media/src/test/test_matter_media_speaker.lua @@ -124,6 +124,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.audioMute.mute.muted()) } + }, + { + min_api_version = 19 } ) @@ -162,6 +165,9 @@ test.register_message_test( clusters.OnOff.server.commands.On(mock_device, 10) } } + }, + { + min_api_version = 19 } ) @@ -205,6 +211,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.audioVolume.volume(20)) } + }, + { + min_api_version = 19 } ) @@ -324,6 +333,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.audioVolume.volume(20)) }, + }, + { + min_api_version = 19 } ) @@ -352,6 +364,9 @@ test.register_message_test( refresh_commands(mock_device) } }, + }, + { + min_api_version = 19 } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-media/src/test/test_matter_media_video_player.lua b/drivers/SmartThings/matter-media/src/test/test_matter_media_video_player.lua index ebae93ca53..296d203b41 100644 --- a/drivers/SmartThings/matter-media/src/test/test_matter_media_video_player.lua +++ b/drivers/SmartThings/matter-media/src/test/test_matter_media_video_player.lua @@ -238,6 +238,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) }, + }, + { + min_api_version = 19 } ) @@ -273,6 +276,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.mediaPlayback.playbackStatus.playing()) }, + }, + { + min_api_version = 19 } ) @@ -308,6 +314,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.mediaPlayback.playbackStatus.paused()) }, + }, + { + min_api_version = 19 } ) @@ -343,6 +352,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.mediaPlayback.playbackStatus.stopped()) }, + }, + { + min_api_version = 19 } ) @@ -381,6 +393,9 @@ test.register_message_test( clusters.MediaPlayback.server.commands.FastForward(mock_device, 10) } }, + }, + { + min_api_version = 19 } ) @@ -419,6 +434,9 @@ test.register_message_test( clusters.MediaPlayback.server.commands.Next(mock_device, 10) } }, + }, + { + min_api_version = 19 } ) @@ -585,6 +603,9 @@ test.register_message_test( clusters.KeypadInput.server.commands.SendKey(mock_device, 10, clusters.KeypadInput.types.CecKeyCode.ROOT_MENU) } } + }, + { + min_api_version = 19 } ) @@ -615,7 +636,10 @@ test.register_coroutine_test( ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -645,7 +669,10 @@ test.register_coroutine_test( ) mock_device_variable_speed:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-rvc/src/test/test_matter_rvc.lua b/drivers/SmartThings/matter-rvc/src/test/test_matter_rvc.lua index e8d91fd1ca..431a6e1c8e 100644 --- a/drivers/SmartThings/matter-rvc/src/test/test_matter_rvc.lua +++ b/drivers/SmartThings/matter-rvc/src/test/test_matter_rvc.lua @@ -228,7 +228,10 @@ test.register_coroutine_test( mock_device.id, clusters.RvcOperationalState.attributes.AcceptedCommandList:read() }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -256,7 +259,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -281,7 +287,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -306,7 +315,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -330,7 +342,10 @@ test.register_coroutine_test( ) ) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -348,7 +363,10 @@ test.register_coroutine_test( clusters.RvcCleanMode.server.commands.ChangeToMode(mock_device, APPLICATION_ENDPOINT, cleanMode.mode) }) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -386,7 +404,10 @@ test.register_coroutine_test( mock_device.id, clusters.RvcRunMode.server.commands.ChangeToMode(mock_device, APPLICATION_ENDPOINT, CLEANING_MODE.mode) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -421,7 +442,10 @@ test.register_coroutine_test( mock_device.id, clusters.RvcOperationalState.commands.GoHome(mock_device, APPLICATION_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -482,7 +506,10 @@ test.register_coroutine_test( mock_device.id, clusters.RvcOperationalState.commands.Pause(mock_device, APPLICATION_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -533,7 +560,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -587,7 +617,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -641,7 +674,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -692,7 +728,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -743,7 +782,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -975,7 +1017,10 @@ test.register_coroutine_test( capabilities.robotCleanerOperatingState.operatingState.mopCleaningPadMissing() ) ) - end + end, + { + min_api_version = 19 + } ) local locationDescriptorStruct = require "Global.types.LocationDescriptorStruct" @@ -1008,6 +1053,9 @@ test.register_message_test( {["areaId"] = 1, ["areaName"] = "0F Balcony" }, }, { visibility = { displayed = false } })) }, + }, + { + min_api_version = 19 } ) @@ -1031,6 +1079,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.serviceArea.selectedAreas({ 1,2,5 }, { visibility = { displayed = false } })) }, + }, + { + min_api_version = 19 } ) @@ -1054,6 +1105,9 @@ test.register_message_test( clusters.ServiceArea.server.commands.SelectAreas(mock_device, APPLICATION_ENDPOINT, {uint32_dt(1),uint32_dt(2)}) } }, + }, + { + min_api_version = 19 } ) @@ -1136,6 +1190,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.serviceArea.selectedAreas({ 1,2,5 },{ state_change=true})) }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-sensor/fingerprints.yml b/drivers/SmartThings/matter-sensor/fingerprints.yml index 4295c87a93..e3b483cad5 100644 --- a/drivers/SmartThings/matter-sensor/fingerprints.yml +++ b/drivers/SmartThings/matter-sensor/fingerprints.yml @@ -86,27 +86,27 @@ matterManufacturer: deviceProfileName: temperature-humidity-battery # Ikea - id: "4476/32773" - deviceLabel: TIMMERFLOTTE temp/hmd sensor + deviceLabel: TIMMERFLOTTE Temperature/Humidity Sensor vendorId: 0x117C productId: 0x8005 deviceProfileName: temperature-humidity-battery - id: "4476/32774" - deviceLabel: KLIPPBOK Matter water leak sensor smart + deviceLabel: KLIPPBOK Water Leak Sensor vendorId: 0x117C productId: 0x8006 deviceProfileName: leak-battery - id: "4476/12288" - deviceLabel: MYGGSPRAY wrlss mtn sensor + deviceLabel: MYGGSPRAY Motion Sensor vendorId: 0x117C productId: 0x3000 deviceProfileName: motion-illuminance-battery - id: "4476/12289" - deviceLabel: ALPSTUGA Matter air quality sensor smart + deviceLabel: ALPSTUGA Air Quality Sensor vendorId: 0x117C productId: 0x3001 deviceProfileName: aqs-modular-temp-humidity - id: "4476/32775" - deviceLabel: MYGGBETT Matter door/window sensor smart + deviceLabel: MYGGBETT Door/Window Sensor vendorId: 0x117C productId: 0x8007 deviceProfileName: contact-battery diff --git a/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_utils/utils.lua b/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_utils/utils.lua index e23b9f7eeb..c11ac46605 100644 --- a/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_utils/utils.lua +++ b/drivers/SmartThings/matter-sensor/src/sub_drivers/air_quality_sensor/air_quality_sensor_utils/utils.lua @@ -102,15 +102,15 @@ function AirQualitySensorUtils.deep_equals(a, b, opts, seen) end -- Compare keys/values from a - for k, v in next, a do - if not AirQualitySensorUtils.deep_equals(v, rawget(b, k), opts, seen) then + for k, v in pairs(a) do + if not AirQualitySensorUtils.deep_equals(v, b[k], opts, seen) then return false end end -- Ensure b doesn't have extra keys - for k in next, b do - if rawget(a, k) == nil then + for k in pairs(b) do + if a[k] == nil then return false end end diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_air_quality_sensor.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_air_quality_sensor.lua index 1988563bc8..734aaad66b 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_air_quality_sensor.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_air_quality_sensor.lua @@ -497,7 +497,10 @@ test.register_coroutine_test( "Configure should read units from device and profile change as needed", function() test_aqs_device_type_do_configure(mock_device, "aqs-temp-humidity-all-level-all-meas") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -505,7 +508,10 @@ test.register_coroutine_test( function() test_aqs_device_type_do_configure(mock_device_common, "aqs-temp-humidity-co2-pm25-tvoc-meas") end, - { test_init = test_init_common } + { + test_init = test_init_common, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -513,7 +519,10 @@ test.register_coroutine_test( function() test_aqs_device_type_do_configure(mock_device_level, "aqs-temp-humidity-all-level") end, - { test_init = test_init_level } + { + test_init = test_init_level, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -522,7 +531,10 @@ test.register_coroutine_test( test_aqs_device_type_do_configure(mock_device_co, "aqs-temp-humidity-all-meas") test_aqs_device_type_do_configure(mock_device_co2, "aqs-temp-humidity-co2-pm25-tvoc-meas") end, - { test_init = test_init_co_co2 } + { + test_init = test_init_co_co2, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -530,7 +542,10 @@ test.register_coroutine_test( function() test_aqs_device_type_do_configure(mock_device_tvoc, "aqs-temp-humidity-tvoc-meas") end, - { test_init = test_init_tvoc } + { + test_init = test_init_tvoc, + min_api_version = 19 + } ) @@ -551,6 +566,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -570,6 +588,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 40 })) } + }, + { + min_api_version = 19 } ) @@ -602,6 +623,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.airQualityHealthConcern.airQualityHealthConcern.hazardous()) }, + }, + { + min_api_version = 19 } ) @@ -669,7 +693,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.tvocMeasurement.tvocLevel({value = 750, unit = "ppb"})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -691,7 +718,10 @@ test.register_coroutine_test( mock_device_common:generate_test_message("main", capabilities.fineDustSensor.fineDustLevel({value = 18, unit = "μg/m^3"})) ) end, - { test_init = test_init_common } + { + test_init = test_init_common, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -796,7 +826,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.tvocHealthConcern.tvocHealthConcern.hazardous()) ) - end + end, + { + min_api_version = 19 + } ) -- run tests diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_air_quality_sensor_modular.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_air_quality_sensor_modular.lua index 9f2c4c636a..57e54fb2ec 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_air_quality_sensor_modular.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_air_quality_sensor_modular.lua @@ -385,7 +385,10 @@ test.register_coroutine_test( local subscribe_request_all = get_subscribe_request_all() test_aqs_device_type_update_modular_profile(mock_device_all, expected_metadata_all, subscribe_request_all, expected_supported_values_setters) end, - { test_init = test_init_all } + { + test_init = test_init_all, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -412,7 +415,45 @@ test.register_coroutine_test( local subscribe_request_common = get_subscribe_request_common() test_aqs_device_type_update_modular_profile(mock_device_common, expected_metadata_common, subscribe_request_common, expected_supported_values_setters) end, - { test_init = test_init_common } + { + test_init = test_init_common, + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Component-capability update without profile ID update should cause re-subscribe in infoChanged handler", + function() + local expected_metadata_modular_disabled = { + optional_component_capabilities={ + { + "main", + { + "tvocMeasurement", + }, + }, + }, + profile="aqs-modular", + } + local subscribe_request_tvoc = get_subscribe_request_tvoc() + local updated_device_profile = t_utils.get_profile_definition("aqs-modular.yml", + {enabled_optional_capabilities = expected_metadata_modular_disabled.optional_component_capabilities} + ) + updated_device_profile.id = "00000000-1111-2222-3333-000000000006" + test.socket.device_lifecycle:__queue_receive(mock_device_modular_fingerprint:generate_info_changed({ profile = updated_device_profile })) + test.socket.capability:__expect_send(mock_device_modular_fingerprint:generate_test_message("main", capabilities.airQualityHealthConcern.supportedAirQualityValues({"unknown", "good", "unhealthy", "moderate", "slightlyUnhealthy"}, {visibility={displayed=false}}))) + test.socket.matter:__expect_send({mock_device_modular_fingerprint.id, subscribe_request_tvoc}) + end, + { test_init = test_init_modular_fingerprint } +) + +test.register_coroutine_test( + "No component-capability update and no profile ID update should not cause a re-subscribe in infoChanged handler", + function() + -- simulate no actual change + test.socket.device_lifecycle:__queue_receive(mock_device_modular_fingerprint:generate_info_changed({})) + end, + { test_init = test_init_modular_fingerprint } ) test.register_coroutine_test( diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_bosch_button_contact.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_bosch_button_contact.lua index 1ca2add2ff..b999ac44f9 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_bosch_button_contact.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_bosch_button_contact.lua @@ -80,6 +80,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) --should send initial press } + }, + { + min_api_version = 19 } ) @@ -115,6 +118,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -160,6 +166,9 @@ test.register_message_test( ) } }, + }, + { + min_api_version = 19 } ) @@ -181,6 +190,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -218,6 +230,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.button.double({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -240,6 +255,9 @@ test.register_message_test( "main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5)) ), }, + }, + { + min_api_version = 19 } ) @@ -272,6 +290,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_flow_sensor.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_flow_sensor.lua index 6b1301cb96..220ac3c51e 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_flow_sensor.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_flow_sensor.lua @@ -69,6 +69,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.flowMeasurement.flow({ value = 20.0, unit = "m^3/h" })) } + }, + { + min_api_version = 19 } ) @@ -96,6 +99,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.flowMeasurement.flowRange({ value = { minimum = 2.0, maximum = 500.0 }, unit = "m^3/h" })) } + }, + { + min_api_version = 19 } ) @@ -125,6 +131,9 @@ test.register_message_test( refresh_commands(mock_device) } }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_freeze_leak_sensor.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_freeze_leak_sensor.lua index 44a984b2a7..0c05271917 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_freeze_leak_sensor.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_freeze_leak_sensor.lua @@ -97,6 +97,9 @@ test.register_message_test( direction = "send", message = mock_device_freeze_leak:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.freeze()) } + }, + { + min_api_version = 19 } ) @@ -130,6 +133,9 @@ test.register_message_test( direction = "send", message = mock_device_freeze_leak:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -162,6 +168,9 @@ test.register_message_test( direction = "send", message = mock_device_freeze_leak:generate_test_message("main", capabilities.hardwareFault.hardwareFault.clear()) } + }, + { + min_api_version = 19 } ) @@ -180,7 +189,10 @@ test.register_coroutine_test( mock_device_freeze_leak.id, clusters.BooleanStateConfiguration.attributes.CurrentSensitivityLevel:write(mock_device_freeze_leak, 2, 0) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -197,7 +209,10 @@ test.register_coroutine_test( mock_device_freeze_leak.id, clusters.BooleanStateConfiguration.attributes.CurrentSensitivityLevel:write(mock_device_freeze_leak, 2, mock_device_freeze_leak:get_field("freezeMax") - 1) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -227,7 +242,10 @@ test.register_coroutine_test( mock_device_freeze_leak.id, clusters.BooleanStateConfiguration.attributes.CurrentSensitivityLevel:write(mock_device_freeze_leak, 2, 0) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_pressure_sensor.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_pressure_sensor.lua index f7b3d7afe0..24659a2426 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_pressure_sensor.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_pressure_sensor.lua @@ -92,6 +92,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.atmosphericPressureMeasurement.atmosphericPressure({ value = 0, unit = "kPa" })) } + }, + { + min_api_version = 19 } ) @@ -111,6 +114,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5))) } + }, + { + min_api_version = 19 } ) @@ -140,6 +146,9 @@ test.register_message_test( refresh_commands(mock_device) } }, + }, + { + min_api_version = 19 } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_rain_sensor.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_rain_sensor.lua index 21f8a0fa51..b25ca9ff96 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_rain_sensor.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_rain_sensor.lua @@ -94,6 +94,9 @@ test.register_message_test( direction = "send", message = mock_device_rain:generate_test_message("main", capabilities.rainSensor.rain.detected()) } + }, + { + min_api_version = 19 } ) @@ -126,6 +129,9 @@ test.register_message_test( direction = "send", message = mock_device_rain:generate_test_message("main", capabilities.hardwareFault.hardwareFault.clear()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor.lua index a66e575310..06f7f40fb8 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor.lua @@ -161,6 +161,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 41 })) } + }, + { + min_api_version = 19 } ) @@ -180,6 +183,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -199,6 +205,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 137 })) } + }, + { + min_api_version = 19 } ) @@ -231,6 +240,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -250,6 +262,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5))) } + }, + { + min_api_version = 19 } ) @@ -282,6 +297,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -316,6 +334,9 @@ test.register_message_test( refresh_commands(mock_device) } }, + }, + { + min_api_version = 19 } ) @@ -343,6 +364,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 5.00, maximum = 40.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -355,7 +379,10 @@ test.register_coroutine_test( }) mock_device_presence_sensor:expect_metadata_update({ profile = "presence-illuminance-temperature-humidity-battery" }) end, - { test_init = test_init_presence_sensor } + { + test_init = test_init_presence_sensor, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_battery.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_battery.lua index 8d3962de66..46b3819baf 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_battery.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_battery.lua @@ -86,7 +86,10 @@ test.register_coroutine_test( } ) mock_device_humidity_battery:expect_metadata_update({ profile = "humidity-battery" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -111,7 +114,10 @@ test.register_coroutine_test( } ) mock_device_humidity_battery:expect_metadata_update({ profile = "humidity-batteryLevel" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -134,7 +140,10 @@ test.register_coroutine_test( }) } ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_featuremap.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_featuremap.lua index b1e5d39248..b617e317a0 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_featuremap.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_featuremap.lua @@ -169,21 +169,30 @@ test.register_coroutine_test( "Test profile change on init for humidity sensor with battery", function() end, - { test_init = test_init_humidity_battery } + { + test_init = test_init_humidity_battery, + min_api_version = 19 + } ) test.register_coroutine_test( "Test profile change on init for humidity sensor without battery", function() end, - { test_init = test_init_humidity_no_battery } + { + test_init = test_init_humidity_no_battery, + min_api_version = 19 + } ) test.register_coroutine_test( "Test profile change on init for temperature-humidity sensor", function() end, - { test_init = test_init_temp_humidity } + { + test_init = test_init_temp_humidity, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_rpc.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_rpc.lua index 88af036e19..cfc6455813 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_rpc.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_sensor_rpc.lua @@ -69,7 +69,11 @@ test.register_message_test( clusters.TemperatureMeasurement.attributes.MaxMeasuredValue:build_test_report_data(mock_device, 1, 4000) } } + }, + { + min_api_version = 19 } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_smoke_co_alarm.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_smoke_co_alarm.lua index c7cfe26c2a..634c9750d7 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_smoke_co_alarm.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_smoke_co_alarm.lua @@ -122,6 +122,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -167,6 +170,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.detected()) } + }, + { + min_api_version = 19 } ) @@ -212,6 +218,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.clear()) }, + }, + { + min_api_version = 19 } ) @@ -270,6 +279,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.detected()) }, + }, + { + min_api_version = 19 } ) @@ -328,6 +340,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.detected()) }, + }, + { + min_api_version = 19 } ) @@ -373,6 +388,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.batteryLevel.battery.critical()), } + }, + { + min_api_version = 19 } ) @@ -415,6 +433,9 @@ test.register_message_test( direction = "send", message = {mock_device.id, clusters.SmokeCoAlarm.attributes.COState:read(mock_device)} } + }, + { + min_api_version = 19 } ) @@ -447,6 +468,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.clear()) } + }, + { + min_api_version = 19 } ) @@ -466,6 +490,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -498,6 +525,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 41 })) } + }, + { + min_api_version = 19 } ) @@ -546,6 +576,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideMeasurement.carbonMonoxideLevel({value = 10, unit = "ppm"})) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-sensor/src/test/test_matter_smoke_co_alarm_battery.lua b/drivers/SmartThings/matter-sensor/src/test/test_matter_smoke_co_alarm_battery.lua index 816552935e..b5a3fd9f39 100644 --- a/drivers/SmartThings/matter-sensor/src/test/test_matter_smoke_co_alarm_battery.lua +++ b/drivers/SmartThings/matter-sensor/src/test/test_matter_smoke_co_alarm_battery.lua @@ -90,7 +90,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ profile = "smoke-co-temp-humidity-comeas-battery" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -102,7 +105,10 @@ test.register_coroutine_test( clusters.PowerSource.attributes.AttributeList:build_test_report_data(mock_device, 1, {uint32(0)}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -119,7 +125,10 @@ test.register_coroutine_test( "main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5)) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-switch/fingerprints.yml b/drivers/SmartThings/matter-switch/fingerprints.yml index 115b06f325..852a67432d 100644 --- a/drivers/SmartThings/matter-switch/fingerprints.yml +++ b/drivers/SmartThings/matter-switch/fingerprints.yml @@ -896,12 +896,12 @@ matterManufacturer: deviceProfileName: plug-binary #Ikea - id: "4476/32768" - deviceLabel: BILRESA scroll wheel + deviceLabel: BILRESA Scroll Wheel vendorId: 0x117C productId: 0x8000 deviceProfileName: ikea-scroll - id: "4476/32769" - deviceLabel: BILRESA dual button + deviceLabel: BILRESA Dual Button vendorId: 0x117C productId: 0x8001 deviceProfileName: ikea-2-button-battery diff --git a/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/capability_handlers.lua b/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/capability_handlers.lua index 0a7fcca312..443c83956b 100644 --- a/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/capability_handlers.lua +++ b/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/capability_handlers.lua @@ -259,6 +259,15 @@ end function CameraCapabilityHandlers.handle_remove_zone(driver, device, cmd) local endpoint_id = device:component_to_endpoint(cmd.component) + local triggers = device:get_latest_state( + camera_fields.profile_components.main, capabilities.zoneManagement.ID, capabilities.zoneManagement.triggers.NAME + ) or {} + for _, v in pairs(triggers) do + if v.zoneId == cmd.args.zoneId then + device:send(clusters.ZoneManagement.server.commands.RemoveTrigger(device, endpoint_id, cmd.args.zoneId)) + break + end + end device:send(clusters.ZoneManagement.server.commands.RemoveZone(device, endpoint_id, cmd.args.zoneId)) end diff --git a/drivers/SmartThings/matter-switch/src/sub_drivers/camera/init.lua b/drivers/SmartThings/matter-switch/src/sub_drivers/camera/init.lua index 24ca154950..91ebe03ebc 100644 --- a/drivers/SmartThings/matter-switch/src/sub_drivers/camera/init.lua +++ b/drivers/SmartThings/matter-switch/src/sub_drivers/camera/init.lua @@ -47,6 +47,13 @@ function CameraLifecycleHandlers.driver_switched(driver, device) end function CameraLifecycleHandlers.info_changed(driver, device, event, args) + local software_version_changed = device.matter_version ~= nil and args.old_st_store.matter_version ~= nil and + device.matter_version.software ~= args.old_st_store.matter_version.software + + if software_version_changed then + camera_cfg.match_profile(device, false, false) + end + if not switch_utils.deep_equals(device.profile, args.old_st_store.profile, { ignore_functions = true }) then camera_cfg.initialize_camera_capabilities(device) device:subscribe() diff --git a/drivers/SmartThings/matter-switch/src/switch_handlers/capability_handlers.lua b/drivers/SmartThings/matter-switch/src/switch_handlers/capability_handlers.lua index 3c65e3e8c0..eec323a335 100644 --- a/drivers/SmartThings/matter-switch/src/switch_handlers/capability_handlers.lua +++ b/drivers/SmartThings/matter-switch/src/switch_handlers/capability_handlers.lua @@ -125,11 +125,12 @@ end function CapabilityHandlers.handle_step_color_temperature_by_percent(driver, device, cmd) local step_percent_change = cmd.args and cmd.args.stepSize or 0 if step_percent_change == 0 then return end + step_percent_change = st_utils.clamp_value(step_percent_change, -100, 100) local endpoint_id = device:component_to_endpoint(cmd.component) -- before the Matter 1.3 lua libs update (HUB FW 55), there was no ColorControl StepModeEnum type defined local step_mode = step_percent_change > 0 and (clusters.ColorControl.types.StepModeEnum and clusters.ColorControl.types.StepModeEnum.DOWN or 3) or (clusters.ColorControl.types.StepModeEnum and clusters.ColorControl.types.StepModeEnum.UP or 1) - local min_mireds = switch_utils.get_field_for_endpoint(device, fields.COLOR_TEMP_BOUND_RECEIVED_MIRED..fields.COLOR_TEMP_MIN, endpoint_id) or fields.COLOR_TEMPERATURE_MIRED_MIN -- default min mireds - local max_mireds = switch_utils.get_field_for_endpoint(device, fields.COLOR_TEMP_BOUND_RECEIVED_MIRED..fields.COLOR_TEMP_MAX, endpoint_id) or fields.COLOR_TEMPERATURE_MIRED_MAX -- default max mireds + local min_mireds = switch_utils.get_field_for_endpoint(device, fields.COLOR_TEMP_BOUND_RECEIVED_MIRED..fields.COLOR_TEMP_MIN, endpoint_id) or fields.DEFAULT_MIRED_MIN + local max_mireds = switch_utils.get_field_for_endpoint(device, fields.COLOR_TEMP_BOUND_RECEIVED_MIRED..fields.COLOR_TEMP_MAX, endpoint_id) or fields.DEFAULT_MIRED_MAX local step_size_in_mireds = st_utils.round((max_mireds - min_mireds) * (math.abs(step_percent_change)/100.0)) device:send(clusters.ColorControl.server.commands.StepColorTemperature(device, endpoint_id, step_mode, step_size_in_mireds, fields.TRANSITION_TIME_FAST, min_mireds, max_mireds, fields.OPTIONS_MASK, fields.IGNORE_COMMAND_IF_OFF)) end diff --git a/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua b/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua index 65a962ca2c..1432b18c74 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua @@ -15,8 +15,14 @@ SwitchFields.MIRED_KELVIN_CONVERSION_CONSTANT = 1000000 -- These values are a "sanity check" to check that values we are getting are reasonable local COLOR_TEMPERATURE_KELVIN_MAX = 15000 local COLOR_TEMPERATURE_KELVIN_MIN = 1000 -SwitchFields.COLOR_TEMPERATURE_MIRED_MAX = st_utils.round(SwitchFields.MIRED_KELVIN_CONVERSION_CONSTANT/COLOR_TEMPERATURE_KELVIN_MIN) -SwitchFields.COLOR_TEMPERATURE_MIRED_MIN = st_utils.round(SwitchFields.MIRED_KELVIN_CONVERSION_CONSTANT/COLOR_TEMPERATURE_KELVIN_MAX) +SwitchFields.COLOR_TEMPERATURE_MIRED_MAX = st_utils.round(SwitchFields.MIRED_KELVIN_CONVERSION_CONSTANT/COLOR_TEMPERATURE_KELVIN_MIN) -- 1000 Mireds +SwitchFields.COLOR_TEMPERATURE_MIRED_MIN = st_utils.round(SwitchFields.MIRED_KELVIN_CONVERSION_CONSTANT/COLOR_TEMPERATURE_KELVIN_MAX) -- 67 Mireds + +-- These values are the config bounds in the default Matter profiles (e.g. light-level-colorTemperature, light-color-level) +local DEFAULT_KELVIN_MIN = 2200 +local DEFAULT_KELVIN_MAX = 6500 +SwitchFields.DEFAULT_MIRED_MIN = st_utils.round(SwitchFields.MIRED_KELVIN_CONVERSION_CONSTANT/DEFAULT_KELVIN_MAX) -- 154 Mireds +SwitchFields.DEFAULT_MIRED_MAX = st_utils.round(SwitchFields.MIRED_KELVIN_CONVERSION_CONSTANT/DEFAULT_KELVIN_MIN) -- 455 Mireds SwitchFields.SWITCH_LEVEL_LIGHTING_MIN = 1 SwitchFields.CURRENT_HUESAT_ATTR_MIN = 0 diff --git a/drivers/SmartThings/matter-switch/src/switch_utils/utils.lua b/drivers/SmartThings/matter-switch/src/switch_utils/utils.lua index 1afecb318f..f949a15a56 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/utils.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/utils.lua @@ -351,15 +351,15 @@ function utils.deep_equals(a, b, opts, seen) end -- Compare keys/values from a - for k, v in next, a do - if not utils.deep_equals(v, rawget(b, k), opts, seen) then + for k, v in pairs(a) do + if not utils.deep_equals(v, b[k], opts, seen) then return false end end -- Ensure b doesn't have extra keys - for k in next, b do - if rawget(a, k) == nil then + for k in pairs(b) do + if a[k] == nil then return false end end diff --git a/drivers/SmartThings/matter-switch/src/test/test_aqara_climate_sensor_w100.lua b/drivers/SmartThings/matter-switch/src/test/test_aqara_climate_sensor_w100.lua index d47c666166..357c1171dd 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_aqara_climate_sensor_w100.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_aqara_climate_sensor_w100.lua @@ -162,7 +162,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( aqara_mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -184,7 +187,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( aqara_mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 5.00, maximum = 40.00 }, unit = "C" })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -209,7 +215,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( aqara_mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 41 })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -225,7 +234,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( aqara_mock_device:generate_test_message("main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5))) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -247,7 +259,10 @@ test.register_coroutine_test( clusters.Switch.events.ShortRelease:build_test_event_report(aqara_mock_device, 3, {previous_position = 0}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -269,7 +284,10 @@ test.register_coroutine_test( clusters.Switch.events.ShortRelease:build_test_event_report(aqara_mock_device, 3, {previous_position = 0}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -307,7 +325,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(aqara_mock_device:generate_test_message("button2", capabilities.button.button.double({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -333,7 +354,10 @@ test.register_coroutine_test( clusters.Switch.events.LongRelease:build_test_event_report(aqara_mock_device, 3, {previous_position = 0}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -359,7 +383,10 @@ test.register_coroutine_test( clusters.Switch.events.LongRelease:build_test_event_report(aqara_mock_device, 5, {previous_position = 0}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -375,7 +402,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( aqara_mock_device:generate_test_message("button1", capabilities.button.button.double({state_change = true})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -391,7 +421,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( aqara_mock_device:generate_test_message("button1", capabilities.button.supportedButtonValues({"pushed", "double", "held"}, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -413,7 +446,10 @@ test.register_coroutine_test( clusters.Switch.events.ShortRelease:build_test_event_report(aqara_mock_device, 4, {previous_position = 0}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -433,7 +469,10 @@ test.register_coroutine_test( "button3", capabilities.button.supportedButtonValues({"pushed", "double", "held", "pushed_3x"}, {visibility = {displayed = false}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -453,7 +492,10 @@ test.register_coroutine_test( "button1", capabilities.button.supportedButtonValues({"pushed", "double", "held", "pushed_3x", "pushed_4x", "pushed_5x", "pushed_6x"}, {visibility = {displayed = false}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-switch/src/test/test_aqara_cube.lua b/drivers/SmartThings/matter-switch/src/test/test_aqara_cube.lua index 3c377255ab..5a5eb23b0f 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_aqara_cube.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_aqara_cube.lua @@ -233,7 +233,10 @@ test.register_coroutine_test( "main", capabilities.battery.battery(math.floor(150 / 2.0 + 0.5)) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -265,7 +268,10 @@ test.register_coroutine_test( mock_device_exhausted:generate_test_message("main", cubeFace.cubeFace({value = "face1Up"})) ) end, - { test_init = test_init_exhausted } + { + test_init = test_init_exhausted, + min_api_version = 19 + } ) -- run the tests diff --git a/drivers/SmartThings/matter-switch/src/test/test_aqara_light_switch_h2.lua b/drivers/SmartThings/matter-switch/src/test/test_aqara_light_switch_h2.lua index 35f4cd9ce7..9f21039519 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_aqara_light_switch_h2.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_aqara_light_switch_h2.lua @@ -267,7 +267,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( aqara_mock_children[aqara_child2_ep]:generate_test_message("main", capabilities.switch.switch.on()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -344,7 +347,10 @@ test.register_coroutine_test( energy = 39.0 })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-switch/src/test/test_electrical_sensor_set.lua b/drivers/SmartThings/matter-switch/src/test/test_electrical_sensor_set.lua index 8cabc4fe09..ec972534b3 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_electrical_sensor_set.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_electrical_sensor_set.lua @@ -205,14 +205,6 @@ end test.register_message_test( "On command should send the appropriate commands", { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" } - } - }, - { { channel = "capability", direction = "receive", @@ -221,6 +213,14 @@ test.register_message_test( { capability = "switch", component = "main", command = "on", args = { } } } }, + { + channel = "devices", + direction = "send", + message = { + "register_native_capability_cmd_handler", + { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" } + } + }, { channel = "matter", direction = "send", @@ -229,19 +229,14 @@ test.register_message_test( clusters.OnOff.server.commands.On(mock_device, 2) } } + }, + { + min_api_version = 19 } ) test.register_message_test( "Off command should send the appropriate commands", - { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "off" } - } - }, { { channel = "capability", @@ -251,6 +246,14 @@ test.register_message_test( { capability = "switch", component = "main", command = "off", args = { } } } }, + { + channel = "devices", + direction = "send", + message = { + "register_native_capability_cmd_handler", + { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "off" } + } + }, { channel = "matter", direction = "send", @@ -259,6 +262,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, 2) } } + }, + { + min_api_version = 19 } ) @@ -286,6 +292,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -351,7 +360,10 @@ test.register_coroutine_test( energy = 39.0 })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -373,7 +385,10 @@ test.register_coroutine_test( ) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -432,7 +447,10 @@ test.register_coroutine_test( })) ) end, - { test_init = test_init_periodic } + { + test_init = test_init_periodic, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -454,7 +472,10 @@ test.register_coroutine_test( parent_assigned_child_key = string.format("%d", 4) }) end, - { test_init = test_init } + { + test_init = test_init, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -466,7 +487,10 @@ test.register_coroutine_test( test.socket.matter:__queue_receive({ mock_device_periodic.id, clusters.PowerTopology.attributes.AvailableEndpoints:build_test_report_data(mock_device_periodic, 1, {uint32(1)})}) mock_device_periodic:expect_metadata_update({ profile = "plug-energy-powerConsumption" }) end, - { test_init = test_init_periodic } + { + test_init = test_init_periodic, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -581,7 +605,10 @@ test.register_coroutine_test( ) -- no powerConsumptionReport will be emitted now, since it has not been 15 minutes since the previous report (even though it was the child). end, - { test_init = test_init } + { + test_init = test_init, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -649,7 +676,10 @@ test.register_coroutine_test( })) ) end, - { test_init = test_init_periodic } + { + test_init = test_init_periodic, + min_api_version = 19 + } ) test.register_message_test( @@ -729,6 +759,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-switch/src/test/test_electrical_sensor_tree.lua b/drivers/SmartThings/matter-switch/src/test/test_electrical_sensor_tree.lua index 5e6644ecac..37524e4a03 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_electrical_sensor_tree.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_electrical_sensor_tree.lua @@ -137,14 +137,6 @@ test.set_test_init_function(test_init) test.register_message_test( "On command should send the appropriate commands", { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" } - } - }, - { { channel = "capability", direction = "receive", @@ -153,6 +145,14 @@ test.register_message_test( { capability = "switch", component = "main", command = "on", args = { } } } }, + { + channel = "devices", + direction = "send", + message = { + "register_native_capability_cmd_handler", + { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" } + } + }, { channel = "matter", direction = "send", @@ -161,19 +161,14 @@ test.register_message_test( clusters.OnOff.server.commands.On(mock_device, 2) } } + }, + { + min_api_version = 19 } ) test.register_message_test( "Off command should send the appropriate commands", - { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "off" } - } - }, { { channel = "capability", @@ -183,6 +178,14 @@ test.register_message_test( { capability = "switch", component = "main", command = "off", args = { } } } }, + { + channel = "devices", + direction = "send", + message = { + "register_native_capability_cmd_handler", + { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "off" } + } + }, { channel = "matter", direction = "send", @@ -191,6 +194,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, 2) } } + }, + { + min_api_version = 19 } ) @@ -218,6 +224,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -283,7 +292,10 @@ test.register_coroutine_test( energy = 39.0 })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -306,7 +318,10 @@ test.register_coroutine_test( parent_assigned_child_key = string.format("%d", 4) }) end, - { test_init = test_init } + { + test_init = test_init, + min_api_version = 19 + } ) test.register_message_test( @@ -386,6 +401,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-switch/src/test/test_eve_energy.lua b/drivers/SmartThings/matter-switch/src/test/test_eve_energy.lua index a189b1e5fc..2f40904cd8 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_eve_energy.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_eve_energy.lua @@ -180,6 +180,9 @@ test.register_message_test( clusters.OnOff.server.commands.On(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -210,6 +213,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -227,7 +233,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -239,7 +248,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "removed" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -270,7 +282,8 @@ test.register_coroutine_test( test.mock_device.add_test_device(mock_device) test.timer.__create_and_queue_test_time_advance_timer(60, "interval", "create_poll_schedule") - end + end, + min_api_version = 19 } ) @@ -287,7 +300,10 @@ test.register_coroutine_test( refresh_response:merge(cluster_base.read(mock_device, 0x01, PRIVATE_CLUSTER_ID, PRIVATE_ATTR_ID_WATT_ACCUMULATED, nil)) test.socket.matter:__expect_send({ mock_device.id, refresh_response}) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -311,7 +327,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -335,7 +354,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -371,7 +393,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -396,7 +421,10 @@ test.register_coroutine_test( cluster_base.write(mock_device, 0x01, PRIVATE_CLUSTER_ID, PRIVATE_ATTR_ID_ACCUMULATED_CONTROL_POINT, nil, data) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -420,7 +448,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -454,7 +485,8 @@ test.register_coroutine_test( test.mock_device.add_test_device(mock_device) test.timer.__create_and_queue_test_time_advance_timer(60 * 15, "interval", "create_poll_report_schedule") test.timer.__create_and_queue_test_time_advance_timer(60, "interval", "create_poll_schedule") - end + end, + min_api_version = 19 } ) @@ -545,7 +577,11 @@ test.register_coroutine_test( energy = 39.0 })) ) - end, { test_init = test_init_electrical_sensor } + end, + { + test_init = test_init_electrical_sensor, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-switch/src/test/test_ikea_scroll.lua b/drivers/SmartThings/matter-switch/src/test/test_ikea_scroll.lua index 4629d69a5f..6e1e0206bc 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_ikea_scroll.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_ikea_scroll.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local t_utils = require "integration_test.utils" local capabilities = require "st.capabilities" @@ -232,6 +235,9 @@ test.register_message_test( message = mock_ikea_scroll:generate_test_message("group3", capabilities.button.supportedButtonValues({"pushed", "double", "held", "pushed_3x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -353,6 +359,9 @@ test.register_message_test( ) }, } + }, + { + min_api_version = 19 } ) @@ -474,6 +483,9 @@ test.register_message_test( ) }, } + }, + { + min_api_version = 19 } ) @@ -527,6 +539,9 @@ test.register_message_test( message = mock_ikea_scroll:generate_test_message("group2", capabilities.knob.rotateAmount(18, {state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -580,6 +595,9 @@ test.register_message_test( message = mock_ikea_scroll:generate_test_message("group2", capabilities.knob.rotateAmount(-18, {state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -633,6 +651,9 @@ test.register_message_test( message = mock_ikea_scroll:generate_test_message("group3", capabilities.knob.rotateAmount(18, {state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -686,6 +707,9 @@ test.register_message_test( message = mock_ikea_scroll:generate_test_message("group3", capabilities.knob.rotateAmount(-18, {state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -717,6 +741,9 @@ test.register_message_test( message = mock_ikea_scroll:generate_test_message("main", capabilities.button.button.held({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -748,6 +775,9 @@ test.register_message_test( message = mock_ikea_scroll:generate_test_message("group2", capabilities.button.button.pushed({state_change = true})) }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-switch/src/test/test_light_illuminance_motion.lua b/drivers/SmartThings/matter-switch/src/test/test_light_illuminance_motion.lua index abc98591fc..36624197b1 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_light_illuminance_motion.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_light_illuminance_motion.lua @@ -152,6 +152,9 @@ test.register_message_test( clusters.OnOff.server.commands.On(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -182,6 +185,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -262,6 +268,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -289,6 +298,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -372,6 +384,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "colorControl", capability_attr_id = "saturation" } } }, + }, + { + min_api_version = 19 } ) @@ -394,6 +409,9 @@ test.register_message_test( clusters.ColorControl.server.commands.MoveToHue(mock_device, 1, hue, 0, TRANSITION_TIME, OPTIONS_MASK, HANDLE_COMMAND_IF_OFF) } }, + }, + { + min_api_version = 19 } ) @@ -416,6 +434,9 @@ test.register_message_test( clusters.ColorControl.server.commands.MoveToSaturation(mock_device, 1, sat, TRANSITION_TIME, OPTIONS_MASK, HANDLE_COMMAND_IF_OFF) } }, + }, + { + min_api_version = 19 } ) @@ -459,6 +480,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperature(1800)) }, + }, + { + min_api_version = 19 } ) @@ -488,7 +512,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_x_y_color_mode } + { + test_init = test_init_x_y_color_mode, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -517,7 +544,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_x_y_color_mode } + { + test_init = test_init_x_y_color_mode, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -546,7 +576,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_x_y_color_mode } + { + test_init = test_init_x_y_color_mode, + min_api_version = 19 + } ) test.register_message_test( @@ -560,6 +593,9 @@ test.register_message_test( clusters.ColorControl.attributes.ColorTemperatureMireds:build_test_report_data(mock_device, 1, 0) } } + }, + { + min_api_version = 19 } ) @@ -579,6 +615,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 137 })) } + }, + { + min_api_version = 19 } ) @@ -611,6 +650,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_bridge.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_bridge.lua index 20e2545349..42ec81e888 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_bridge.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_bridge.lua @@ -59,6 +59,26 @@ local mock_bridge = test.mock_device.build_test_matter_device({ } }) +local mock_basic_bridge = test.mock_device.build_test_matter_device({ + profile = t_utils.get_profile_definition("matter-bridge.yml"), + matter_version = { hardware = 1, software = 1 }, + manufacturer_info = { + vendor_id = 0x0000, + product_id = 0x0000, + }, + endpoints = { + { + endpoint_id = 0, + clusters = { + { cluster_id = clusters.Basic.ID, cluster_type = "SERVER" }, + }, + device_types = { + { device_type_id = 0x000E, device_type_revision = 1 } -- Aggregator + } + } + } +}) + local function test_init_mock_bridge() test.mock_device.add_test_device(mock_bridge) test.socket.device_lifecycle:__queue_receive({ mock_bridge.id, "added" }) @@ -67,11 +87,78 @@ local function test_init_mock_bridge() mock_bridge:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end +local function test_init_mock_basic_bridge() + test.mock_device.add_test_device(mock_basic_bridge) + test.socket.device_lifecycle:__queue_receive({ mock_basic_bridge.id, "added" }) + test.socket.device_lifecycle:__queue_receive({ mock_basic_bridge.id, "init" }) + test.socket.device_lifecycle:__queue_receive({ mock_basic_bridge.id, "doConfigure" }) + mock_basic_bridge:expect_metadata_update({ provisioning_state = "PROVISIONED" }) +end + test.register_coroutine_test( "Profile should not change for devices with aggregator device type (bridges)", function() end, - { test_init = test_init_mock_bridge } + { + test_init = test_init_mock_bridge, + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Camera reprofiling should happen after software version change when camera endpoint appears", + function() + local updated_endpoints = { + { + endpoint_id = 0, + clusters = { + { cluster_id = clusters.Basic.ID, cluster_type = "SERVER" }, + }, + device_types = { + { device_type_id = 0x000E, device_type_revision = 1 } -- Aggregator + } + }, + { + endpoint_id = 1, + clusters = { + { + cluster_id = clusters.CameraAvStreamManagement.ID, + feature_map = clusters.CameraAvStreamManagement.types.Feature.VIDEO, + cluster_type = "SERVER" + }, + { cluster_id = clusters.PushAvStreamTransport.ID, cluster_type = "SERVER" } + }, + device_types = { + { device_type_id = 0x0142, device_type_revision = 1 } -- Camera + } + } + } + + test.socket.device_lifecycle:__queue_receive( + mock_basic_bridge:generate_info_changed({ + matter_version = { hardware = 1, software = 2 }, + endpoints = updated_endpoints + }) + ) + + mock_basic_bridge:expect_metadata_update({ + profile = "camera", + optional_component_capabilities = { + { + "main", + { + "videoCapture2", + "cameraViewportSettings", + "videoStreamSettings" + } + } + } + }) + end, + { + test_init = test_init_mock_basic_bridge, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_button.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_button.lua index f84c29c4c5..7de587d93f 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_button.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_button.lua @@ -170,7 +170,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({mock_device_battery.id, updated_subscribe_request}) expect_configure_buttons(mock_device_battery) end, - { test_init = test_init_battery } + { + test_init = test_init_battery, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -191,7 +194,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_battery } + { + test_init = test_init_battery, + min_api_version = 19 + } ) test.register_message_test( @@ -211,6 +217,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) --should send initial press } + }, + { + min_api_version = 19 } ) @@ -246,6 +255,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -282,6 +294,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -327,6 +342,9 @@ test.register_message_test( ) } }, + }, + { + min_api_version = 19 } ) @@ -348,6 +366,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -369,6 +390,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "pushed_3x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -390,6 +414,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "pushed_3x", "pushed_4x", "pushed_5x", "pushed_6x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -426,6 +453,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.double({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -462,6 +492,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed_4x({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -481,7 +514,10 @@ test.register_coroutine_test( clusters.PowerSource.attributes.AttributeList:build_test_report_data(mock_device, 1, {uint32(10)}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -499,7 +535,10 @@ test.register_coroutine_test( ) expect_configure_buttons(mock_device) mock_device:expect_metadata_update({ profile = "button-batteryLevel" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -517,7 +556,10 @@ test.register_coroutine_test( ) expect_configure_buttons(mock_device) mock_device:expect_metadata_update({ profile = "button-battery" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_camera.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_camera.lua index 65d3de5872..a11f7f944b 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_camera.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_camera.lua @@ -346,6 +346,65 @@ end -- Matter Handler UTs +test.register_coroutine_test( + "Software version change should trigger camera reprofiling when camera endpoint is present", + function() + test.socket.device_lifecycle:__queue_receive( + mock_device:generate_info_changed({ matter_version = { hardware = 1, software = 2 } }) + ) + + mock_device:expect_metadata_update({ + optional_component_capabilities = { + { + "main", + { + "videoCapture2", + "cameraViewportSettings", + "videoStreamSettings", + "localMediaStorage", + "audioRecording", + "cameraPrivacyMode", + "imageControl", + "hdr", + "nightVision", + "mechanicalPanTiltZoom", + "zoneManagement", + "webrtc", + "motionSensor", + "sounds" + } + }, + { + "speaker", + { + "audioMute", + "audioVolume" + } + }, + { + "microphone", + { + "audioMute", + "audioVolume" + } + }, + { + "doorbell", + { + "button" + } + } + }, + profile = "camera" + }) + + test.socket.matter:__expect_send({mock_device.id, clusters.Switch.attributes.MultiPressMax:read(mock_device, DOORBELL_EP)}) + end, + { + min_api_version = 19 + } +) + test.register_coroutine_test( "Reports mapping to EnabledState capability data type should generate appropriate events", function() @@ -390,7 +449,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", v.capability("disabled")) ) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -430,7 +492,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", v.capability("auto")) ) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -456,7 +521,10 @@ test.register_coroutine_test( first_value = false end end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -497,7 +565,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.webrtc.talkback(false)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -525,7 +596,10 @@ test.register_coroutine_test( mock_device:generate_test_message(v.component, capabilities.audioMute.mute("unmuted")) ) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -572,7 +646,10 @@ test.register_coroutine_test( mock_device:generate_test_message(v.component, capabilities.audioVolume.volume(32)) ) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -594,7 +671,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("statusLed", capabilities.switch.switch.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -644,7 +724,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("statusLed", capabilities.mode.mode("auto")) ) - end + end, + { + min_api_version = 19 + } ) local function receive_rate_distortion_trade_off_points() @@ -765,7 +848,10 @@ test.register_coroutine_test( receive_video_sensor_params() emit_video_sensor_parameters() emit_supported_resolutions() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -780,7 +866,10 @@ test.register_coroutine_test( emit_video_sensor_parameters() receive_max_encoded_pixel_rate() emit_supported_resolutions() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -795,7 +884,10 @@ test.register_coroutine_test( emit_video_sensor_parameters() receive_rate_distortion_trade_off_points() emit_supported_resolutions() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -847,7 +939,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.mechanicalPanTiltZoom.zoom(30)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -868,7 +963,10 @@ test.register_coroutine_test( { id = 2, label = "Preset 2", pan = -55, tilt = 80, zoom = 60} })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -883,7 +981,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.mechanicalPanTiltZoom.maxPresets(10)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -898,7 +999,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.zoneManagement.maxZones(10)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -943,7 +1047,10 @@ test.register_coroutine_test( } })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -978,7 +1085,10 @@ test.register_coroutine_test( } })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1001,7 +1111,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.zoneManagement.sensitivity(5, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1027,7 +1140,10 @@ test.register_coroutine_test( clusters.Chime.attributes.SelectedChime:build_test_report_data(mock_device, CAMERA_EP, 2) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.sounds.selectedSound(2))) - end + end, + { + min_api_version = 19 + } ) -- Event Handler UTs @@ -1067,7 +1183,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.zoneManagement.triggeredZones({{zoneId = 3}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1090,7 +1209,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("doorbell", capabilities.button.button.double({state_change = true})) ) - end + end, + { + min_api_version = 19 + } ) -- Capability Handler UTs @@ -1127,7 +1249,10 @@ test.register_coroutine_test( mock_device.id, attr:write(mock_device, CAMERA_EP, clusters.CameraAvStreamManagement.types.TriStateAutoEnum.AUTO) }) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1160,7 +1285,10 @@ test.register_coroutine_test( mock_device.id, v.attr:write(mock_device, CAMERA_EP, false) }) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1182,7 +1310,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({ mock_device.id, clusters.CameraAvStreamManagement.attributes.ImageRotation:write(mock_device, CAMERA_EP, 257) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1246,7 +1377,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({ mock_device.id, clusters.CameraAvStreamManagement.attributes.MicrophoneMuted:write(mock_device, CAMERA_EP, false) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1351,7 +1485,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("microphone", capabilities.audioVolume.volume(99)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1374,7 +1511,10 @@ test.register_coroutine_test( mock_device.id, clusters.CameraAvStreamManagement.attributes.StatusLightBrightness:write(mock_device, CAMERA_EP, v) }) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1396,7 +1536,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({ mock_device.id, clusters.CameraAvStreamManagement.attributes.StatusLightEnabled:write(mock_device, CAMERA_EP, false) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1425,7 +1568,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({ mock_device.id, clusters.CameraAvSettingsUserLevelManagement.server.commands.MPTZRelativeMove(mock_device, CAMERA_EP, 0, 0, 80) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1503,7 +1649,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.mechanicalPanTiltZoom.zoom(5)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1532,7 +1681,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({ mock_device.id, clusters.CameraAvSettingsUserLevelManagement.server.commands.MPTZMoveToPreset(mock_device, CAMERA_EP, 2) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1554,7 +1706,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({ mock_device.id, clusters.Chime.server.commands.PlayChimeSound(mock_device, CAMERA_EP) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1571,7 +1726,7 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "zoneManagement", component = "main", command = "newZone", args = { - i .. " zone", {{value = {x = 0, y = 0}}, {value = {x = 1920, y = 1080}} }, i, "blue" + i .. " zone", {{value = {x = 0, y = 0}}, {value = {x = 1920, y = 1080}} }, i, "#FFFFFF" }} }) test.socket.matter:__expect_send({ @@ -1584,7 +1739,7 @@ test.register_coroutine_test( clusters.ZoneManagement.types.TwoDCartesianVertexStruct({x = 0, y = 0}), clusters.ZoneManagement.types.TwoDCartesianVertexStruct({x = 1920, y = 1080}) }, - color = "blue" + color = "#FFFFFF" } ) ) @@ -1625,7 +1780,10 @@ test.register_coroutine_test( mock_device.id, clusters.ZoneManagement.server.commands.RemoveZone(mock_device, CAMERA_EP, i) }) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1695,7 +1853,10 @@ test.register_coroutine_test( mock_device.id, clusters.ZoneManagement.server.commands.RemoveZone(mock_device, CAMERA_EP, i) }) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1768,7 +1929,102 @@ test.register_coroutine_test( test.socket.matter:__expect_send({ mock_device.id, clusters.ZoneManagement.server.commands.RemoveTrigger(mock_device, CAMERA_EP, 1) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Removing a zone with an existing trigger should send RemoveTrigger followed by RemoveZone", + function() + update_device_profile() + test.wait_for_events() + + -- Create a zone + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "zoneManagement", component = "main", command = "newZone", args = { + "motion zone", {{value = {x = 0, y = 0}}, {value = {x = 1920, y = 1080}}}, "motion", "#FFFFFF" + }} + }) + test.socket.matter:__expect_send({ + mock_device.id, clusters.ZoneManagement.server.commands.CreateTwoDCartesianZone(mock_device, CAMERA_EP, + clusters.ZoneManagement.types.TwoDCartesianZoneStruct({ + name = "motion zone", + use = clusters.ZoneManagement.types.ZoneUseEnum.MOTION, + vertices = { + clusters.ZoneManagement.types.TwoDCartesianVertexStruct({x = 0, y = 0}), + clusters.ZoneManagement.types.TwoDCartesianVertexStruct({x = 1920, y = 1080}) + }, + color = "#FFFFFF" + }) + ) + }) + + -- Create a trigger + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "zoneManagement", component = "main", command = "createOrUpdateTrigger", args = { + 1, 10, 3, 15, 3, 5 + }} + }) + test.socket.matter:__expect_send({ + mock_device.id, clusters.ZoneManagement.server.commands.CreateOrUpdateTrigger(mock_device, CAMERA_EP, { + zone_id = 1, + initial_duration = 10, + augmentation_duration = 3, + max_duration = 15, + blind_duration = 3, + sensitivity = 5 + }) + }) + + -- Receive the Triggers attribute update from the device reflecting the new trigger + test.socket.matter:__queue_receive({ + mock_device.id, + clusters.ZoneManagement.attributes.Triggers:build_test_report_data( + mock_device, CAMERA_EP, { + clusters.ZoneManagement.types.ZoneTriggerControlStruct({ + zone_id = 1, initial_duration = 10, augmentation_duration = 3, + max_duration = 15, blind_duration = 3, sensitivity = 5 + }) + } + ) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.zoneManagement.triggers({{ + zoneId = 1, initialDuration = 10, augmentationDuration = 3, + maxDuration = 15, blindDuration = 3, sensitivity = 5 + }})) + ) + test.wait_for_events() + + -- Receive removeZone command: since a trigger exists for zone 1, RemoveTrigger is sent first, then RemoveZone + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "zoneManagement", component = "main", command = "removeZone", args = { 1 } } + }) + test.socket.matter:__expect_send({ + mock_device.id, clusters.ZoneManagement.server.commands.RemoveTrigger(mock_device, CAMERA_EP, 1) + }) + test.socket.matter:__expect_send({ + mock_device.id, clusters.ZoneManagement.server.commands.RemoveZone(mock_device, CAMERA_EP, 1) + }) + test.wait_for_events() + + -- Receive the updated Zones attribute from the device with the zone removed + test.socket.matter:__queue_receive({ + mock_device.id, + clusters.ZoneManagement.attributes.Zones:build_test_report_data(mock_device, CAMERA_EP, {}) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.zoneManagement.zones({value = {}})) + ) + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1947,7 +2203,10 @@ test.register_coroutine_test( 1, false, true ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2547,7 +2806,10 @@ test.register_coroutine_test( uint32(clusters.CameraAvStreamManagement.attributes.StatusLightBrightness.ID) }) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2586,7 +2848,10 @@ test.register_coroutine_test( mock_device:expect_metadata_update(updated_expected_metadata) test.socket.matter:__expect_send({mock_device.id, clusters.Switch.attributes.MultiPressMax:read(mock_device, DOORBELL_EP)}) test.socket.capability:__expect_send(mock_device:generate_test_message("doorbell", capabilities.button.button.pushed({state_change = false}))) - end + end, + { + min_api_version = 19 + } ) -- run the tests diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_light_fan.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_light_fan.lua index c3598a38ad..eb38e516ee 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_light_fan.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_light_fan.lua @@ -216,7 +216,10 @@ test.register_coroutine_test( "main", capabilities.switch.switch.on() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -259,6 +262,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.colorTemperature.colorTemperature(1800)) }, + }, + { + min_api_version = 19 } ) @@ -305,6 +311,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.fanMode.fanMode("medium")) } + }, + { + min_api_version = 19 } ) @@ -338,6 +347,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.fanMode.supportedFanModes({"off", "low", "medium", "high", "auto"}, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -360,6 +372,9 @@ test.register_message_test( clusters.FanControl.attributes.FanMode:write(mock_device, mock_device_ep2, FanMode.LOW) } } + }, + { + min_api_version = 19 } ) @@ -382,6 +397,9 @@ test.register_message_test( clusters.FanControl.attributes.PercentSetting:write(mock_device, mock_device_ep2, 64) } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button.lua index 33002a8203..f929b93745 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button.lua @@ -292,7 +292,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({mock_device_battery.id, updated_subscribe_request}) expect_configure_buttons(mock_device_battery) end, - { test_init = test_init_battery } + { + test_init = test_init_battery, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -313,7 +316,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_battery } + { + test_init = test_init_battery, + min_api_version = 19 + } ) test.register_message_test( @@ -333,6 +339,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) --should send initial press } + }, + { + min_api_version = 19 } ) @@ -363,6 +372,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("button2", button_attr.pushed({state_change = true})) --should send initial press } + }, + { + min_api_version = 19 } ) @@ -385,7 +397,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button2", button_attr.held({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -407,7 +422,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button3", button_attr.pushed({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -428,7 +446,10 @@ test.register_coroutine_test( mock_device, 50, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -465,7 +486,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button5", button_attr.double({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -490,7 +514,10 @@ test.register_coroutine_test( mock_device, 30, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -515,7 +542,10 @@ test.register_coroutine_test( mock_device, 60, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -550,6 +580,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -586,6 +619,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -631,6 +667,9 @@ test.register_message_test( ) } }, + }, + { + min_api_version = 19 } ) @@ -652,6 +691,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -673,6 +715,9 @@ test.register_message_test( message = mock_device:generate_test_message("button5", capabilities.button.supportedButtonValues({"pushed", "double", "held", "pushed_3x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -694,6 +739,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "pushed_3x", "pushed_4x", "pushed_5x", "pushed_6x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -730,6 +778,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.double({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -766,6 +817,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed_4x({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -787,6 +841,9 @@ test.register_message_test( message = mock_device:generate_test_message("button4", capabilities.button.supportedButtonValues({"pushed", "double"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -828,6 +885,9 @@ test.register_message_test( } } -- no double event + }, + { + min_api_version = 19 } ) @@ -883,6 +943,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("button5", button_attr.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -902,7 +965,10 @@ test.register_coroutine_test( clusters.PowerSource.attributes.AttributeList:build_test_report_data(mock_device, 10, {uint32(10)}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -920,7 +986,10 @@ test.register_coroutine_test( ) expect_configure_buttons(mock_device) mock_device:expect_metadata_update({ profile = "5-button-batteryLevel" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -938,7 +1007,10 @@ test.register_coroutine_test( ) expect_configure_buttons(mock_device) mock_device:expect_metadata_update({ profile = "5-button-battery" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_motion.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_motion.lua index dca5f20645..071c897a35 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_motion.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_motion.lua @@ -195,6 +195,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) --should send initial press } +}, +{ + min_api_version = 19 } ) @@ -225,6 +228,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("button2", button_attr.pushed({state_change = true})) --should send initial press } +}, +{ + min_api_version = 19 } ) @@ -247,7 +253,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button2", button_attr.held({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -269,7 +278,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button3", button_attr.pushed({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -290,7 +302,10 @@ test.register_coroutine_test( mock_device, 50, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -327,7 +342,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button6", button_attr.double({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -352,7 +370,10 @@ test.register_coroutine_test( mock_device, 40, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -368,7 +389,10 @@ test.register_coroutine_test( clusters.OccupancySensing.attributes.Occupancy:build_test_report_data(mock_device, 70, 0) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -393,7 +417,10 @@ test.register_coroutine_test( mock_device, 60, {previous_position = 0} ) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -428,6 +455,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.held({state_change = true})) } +}, +{ + min_api_version = 19 } ) @@ -464,6 +494,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({state_change = true})) }, + }, + { + min_api_version = 19 } ) @@ -509,6 +542,9 @@ test.register_message_test( ) } }, + }, + { + min_api_version = 19 } ) @@ -530,6 +566,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -551,6 +590,9 @@ test.register_message_test( message = mock_device:generate_test_message("button6", capabilities.button.supportedButtonValues({"pushed", "double", "held", "pushed_3x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -572,6 +614,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "double", "pushed_3x", "pushed_4x", "pushed_5x", "pushed_6x"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -609,6 +654,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", button_attr.double({state_change = true})) }, +}, +{ + min_api_version = 19 } ) @@ -646,6 +694,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", button_attr.pushed_4x({state_change = true})) }, +}, +{ + min_api_version = 19 } ) @@ -667,6 +718,9 @@ test.register_message_test( message = mock_device:generate_test_message("button5", capabilities.button.supportedButtonValues({"pushed", "double"}, {visibility = {displayed = false}})) }, + }, + { + min_api_version = 19 } ) @@ -708,6 +762,9 @@ test.register_message_test( } } -- no double event +}, +{ + min_api_version = 19 } ) @@ -763,6 +820,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("button6", button_attr.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) -- run the tests diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua index db1ae04bfb..2cf394a356 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua @@ -280,6 +280,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -300,6 +303,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("button1", button_attr.pushed({state_change = true})) --should send initial press } +}, +{ + min_api_version = 19 } ) @@ -330,6 +336,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("button2", button_attr.pushed({state_change = true})) } +}, +{ + min_api_version = 19 } ) @@ -352,7 +361,10 @@ test.register_coroutine_test( ) }) test.socket.capability:__expect_send(mock_device:generate_test_message("button3", button_attr.pushed({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -378,7 +390,10 @@ test.register_coroutine_test( clusters.ColorControl.attributes.ColorTemperatureMireds:build_test_report_data(mock_device, mock_device_ep5, 556) }) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.colorTemperature.colorTemperature(1800))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -440,7 +455,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(unsup_mock_device:generate_test_message("button2", capabilities.button.supportedButtonValues({"pushed", "held"}, {visibility = {displayed = false}}))) test.socket.capability:__expect_send(unsup_mock_device:generate_test_message("button2", button_attr.pushed({state_change = false}))) end, - { test_init = test_init_mcd_unsupported_switch_device_type } + { + test_init = test_init_mcd_unsupported_switch_device_type, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -457,7 +475,10 @@ test.register_coroutine_test( mock_child:expect_metadata_update({ profile = "light-color-level" }) mock_device:expect_metadata_update({ profile = "light-level-3-button" }) expect_configure_buttons() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -472,7 +493,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed({ profile = updated_device_profile })) test.socket.matter:__expect_send({mock_device.id, subscribe_request}) expect_configure_buttons() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -483,7 +507,10 @@ test.register_coroutine_test( mock_child:expect_metadata_update({ profile = "light-color-level" }) mock_device:expect_metadata_update({ profile = "light-level-3-button" }) expect_configure_buttons() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -500,7 +527,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send({mock_device.id, subscribe_request}) mock_child:expect_metadata_update({ provisioning_state = "PROVISIONED" }) test.socket.device_lifecycle:__queue_receive({ mock_child.id, "doConfigure" }) - end + end, + { + min_api_version = 19 + } ) -- run the tests diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_sensor_offset_preferences.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_sensor_offset_preferences.lua index de2afe3bd3..642610e88a 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_sensor_offset_preferences.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_sensor_offset_preferences.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" local t_utils = require "integration_test.utils" @@ -97,7 +100,11 @@ test.register_coroutine_test("Read appropriate attribute values after tempOffset value = 20.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Read appropriate attribute values after humidityOffset preference change", function() local report = clusters.RelativeHumidityMeasurement.attributes.MeasuredValue:build_test_report_data(mock_device,2, 2000) @@ -116,7 +123,11 @@ test.register_coroutine_test("Read appropriate attribute values after humidityOf test.socket.capability:__expect_send(mock_device:generate_test_message("main",capabilities.relativeHumidityMeasurement.humidity({ value = 20 }))) -end) +end, +{ + min_api_version = 19 +} +) test.set_test_init_function(test_init) diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua index 6cdf530dbf..189d95d2e9 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua @@ -263,13 +263,19 @@ end test.register_message_test( "Test that Color Temperature Light device does not switch profiles", {}, - { test_init = test_init_color_temp } + { + test_init = test_init_color_temp, + min_api_version = 19 + } ) test.register_message_test( "Test that Extended Color Light device does not switch profiles", {}, - { test_init = test_init_extended_color } + { + test_init = test_init_extended_color, + min_api_version = 19 + } ) test.register_message_test( @@ -299,6 +305,9 @@ test.register_message_test( clusters.OnOff.server.commands.On(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -329,6 +338,9 @@ test.register_message_test( clusters.OnOff.server.commands.Off(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -410,6 +422,9 @@ test.register_message_test( } }, + }, + { + min_api_version = 19 } ) @@ -437,6 +452,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -483,7 +501,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_no_hue_sat } + { + test_init = test_init_no_hue_sat, + min_api_version = 19 + } ) local hue = math.floor((50 * 0xFE) / 100.0 + 0.5) @@ -566,6 +587,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "colorControl", capability_attr_id = "saturation" } } }, + }, + { + min_api_version = 19 } ) @@ -648,6 +672,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "colorControl", capability_attr_id = "saturation" } } }, + }, + { + min_api_version = 19 } ) @@ -672,6 +699,9 @@ test.register_message_test( clusters.ColorControl.server.commands.MoveToHue(mock_device, 1, hue, 0, TRANSITION_TIME, OPTIONS_MASK, HANDLE_COMMAND_IF_OFF) } }, + }, + { + min_api_version = 19 } ) @@ -694,6 +724,9 @@ test.register_message_test( clusters.ColorControl.server.commands.MoveToSaturation(mock_device, 1, sat, TRANSITION_TIME, OPTIONS_MASK, HANDLE_COMMAND_IF_OFF) } }, + }, + { + min_api_version = 19 } ) @@ -737,6 +770,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperature(1800)) }, + }, + { + min_api_version = 19 } ) @@ -766,7 +802,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_x_y_color_mode } + { + test_init = test_init_x_y_color_mode, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -795,7 +834,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_x_y_color_mode } + { + test_init = test_init_x_y_color_mode, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -824,7 +866,10 @@ test.register_coroutine_test( ) ) end, - { test_init = test_init_x_y_color_mode } + { + test_init = test_init_x_y_color_mode, + min_api_version = 19 + } ) test.register_message_test( @@ -838,6 +883,9 @@ test.register_message_test( clusters.ColorControl.attributes.ColorTemperatureMireds:build_test_report_data(mock_device, 1, 0) } } + }, + { + min_api_version = 19 } ) @@ -865,6 +913,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({minimum = 1800, maximum = 6500})) } + }, + { + min_api_version = 19 } ) @@ -892,6 +943,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({minimum = 2800, maximum = 6000})) } + }, + { + min_api_version = 19 } ) @@ -945,6 +999,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperature(2800)) } + }, + { + min_api_version = 19 } ) @@ -1004,6 +1061,9 @@ test.register_message_test( clusters.ColorControl.server.commands.MoveToColorTemperature(mock_device, 1, 365, TRANSITION_TIME, OPTIONS_MASK, HANDLE_COMMAND_IF_OFF) } } + }, + { + min_api_version = 19 } ) @@ -1026,6 +1086,9 @@ test.register_message_test( clusters.ColorControl.attributes.ColorTempPhysicalMaxMireds:build_test_report_data(mock_device, 1, 555) } } + }, + { + min_api_version = 19 } ) @@ -1048,6 +1111,9 @@ test.register_message_test( clusters.ColorControl.attributes.ColorTempPhysicalMaxMireds:build_test_report_data(mock_device, 1, 1100) } } + }, + { + min_api_version = 19 } ) @@ -1075,6 +1141,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.levelRange({minimum = 2, maximum = 4})) } + }, + { + min_api_version = 19 } ) @@ -1097,6 +1166,9 @@ test.register_message_test( clusters.LevelControl.attributes.MaxLevel:build_test_report_data(mock_device, 1, 10) } } + }, + { + min_api_version = 19 } ) @@ -1152,7 +1224,10 @@ test.register_coroutine_test( } ) end, - { test_init = test_init_x_y_color_mode } + { + test_init = test_init_x_y_color_mode, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1194,7 +1269,10 @@ test.register_coroutine_test( "main", capabilities.colorControl.saturation(72) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1209,7 +1287,10 @@ test.register_coroutine_test( end test.socket.matter:__expect_send({mock_device.id, read_request}) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua index 5513c915b7..b45219adca 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua @@ -674,91 +674,131 @@ test.register_coroutine_test( "Test profile change on init for onoff parent cluster as server", function() end, - { test_init = test_init_onoff } + { + test_init = test_init_onoff, + min_api_version = 19 + } ) test.register_coroutine_test( "Test profile change on init for dimmer parent cluster as server", function() end, - { test_init = test_init_dimmer } + { + test_init = test_init_dimmer, + min_api_version = 19 + } ) test.register_coroutine_test( "Test profile change on init for color dimmer parent cluster as server", function() end, - { test_init = test_init_color_dimmer } + { + test_init = test_init_color_dimmer, + min_api_version = 19 + } ) test.register_coroutine_test( "Test init for onoff parent cluster as client", function() end, - { test_init = test_init_onoff_client } + { + test_init = test_init_onoff_client, + min_api_version = 19 + } ) test.register_coroutine_test( "Test init for device with requiring the switch category as a vendor override", function() end, - { test_init = test_init_switch_vendor_override } + { + test_init = test_init_switch_vendor_override, + min_api_version = 19 + } ) test.register_coroutine_test( "Test init for mounted onoff control parent cluster as server", function() end, - { test_init = test_init_mounted_on_off_control } + { + test_init = test_init_mounted_on_off_control, + min_api_version = 19 + } ) test.register_coroutine_test( "Test init for mounted dimmable load control parent cluster as server", function() end, - { test_init = test_init_mounted_dimmable_load_control } + { + test_init = test_init_mounted_dimmable_load_control, + min_api_version = 19 + } ) test.register_coroutine_test( "Test profile change on init for water valve parent cluster as server", function() end, - { test_init = test_init_water_valve } + { + test_init = test_init_water_valve, + min_api_version = 19 + } ) test.register_coroutine_test( "Test profile change on init for onoff parent cluster as client and onoff child as server", function() end, - { test_init = test_init_parent_client_child_server } + { + test_init = test_init_parent_client_child_server, + min_api_version = 19 + } ) test.register_coroutine_test( "Test profile change on init for onoff device when parent and child are both server", function() end, - { test_init = test_init_parent_child_switch_types } + { + test_init = test_init_parent_child_switch_types, + min_api_version = 19 + } ) test.register_coroutine_test( "Test child device attribute subscriptions when parent device has clusters that are not a superset of child device clusters", function() end, - { test_init = test_init_parent_child_different_types } + { + test_init = test_init_parent_child_different_types, + min_api_version = 19 + } ) test.register_coroutine_test( "Test child device attributes not subscribed to for unsupported device type for child device", function() end, - { test_init = test_init_parent_child_unsupported_device_type } + { + test_init = test_init_parent_child_unsupported_device_type, + min_api_version = 19 + } ) test.register_coroutine_test( "Test init for light with motion sensor", function() end, - { test_init = test_init_light_level_motion } + { + test_init = test_init_light_level_motion, + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_water_valve.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_water_valve.lua index da74443896..03cf8ee407 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_water_valve.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_water_valve.lua @@ -85,6 +85,9 @@ test.register_message_test( clusters.ValveConfigurationAndControl.server.commands.Open(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -107,6 +110,9 @@ test.register_message_test( clusters.ValveConfigurationAndControl.server.commands.Close(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -129,6 +135,9 @@ test.register_message_test( clusters.ValveConfigurationAndControl.server.commands.Open(mock_device, 1, nil, 25) } } + }, + { + min_api_version = 19 } ) @@ -151,6 +160,9 @@ test.register_message_test( clusters.ValveConfigurationAndControl.server.commands.Close(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -170,6 +182,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.closed()) }, + }, + { + min_api_version = 19 } ) @@ -189,6 +204,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.open()) }, + }, + { + min_api_version = 19 } ) @@ -208,6 +226,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.open()) }, + }, + { + min_api_version = 19 } ) @@ -227,6 +248,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.level.level(50)) }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-switch/src/test/test_multi_switch_mcd.lua b/drivers/SmartThings/matter-switch/src/test/test_multi_switch_mcd.lua index 774e6bfa52..2fabc37408 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_multi_switch_mcd.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_multi_switch_mcd.lua @@ -204,7 +204,10 @@ test.register_message_test( } } }, - { test_init = test_init_mock_3switch } + { + test_init = test_init_mock_3switch, + min_api_version = 19 + } ) -- The custom "test_init" function also checks that the appropriate profile is switched on init @@ -228,7 +231,10 @@ test.register_message_test( } } }, - { test_init = test_init_mock_2switch } + { + test_init = test_init_mock_2switch, + min_api_version = 19 + } ) -- The custom "test_init" function also checks that the appropriate profile is switched on init @@ -252,7 +258,11 @@ test.register_message_test( } } }, - { test_init = test_init_mock_3switch_non_sequential } + { + test_init = test_init_mock_3switch_non_sequential, + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/matter-switch/src/test/test_multi_switch_parent_child_lights.lua b/drivers/SmartThings/matter-switch/src/test/test_multi_switch_parent_child_lights.lua index be01a7bf32..efbb7c4545 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_multi_switch_parent_child_lights.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_multi_switch_parent_child_lights.lua @@ -348,6 +348,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -399,6 +402,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -450,6 +456,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -477,6 +486,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -520,6 +532,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.colorTemperature.colorTemperature(1800)) }, + }, + { + min_api_version = 19 } ) @@ -552,6 +567,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.colorControl.saturation(72)) } + }, + { + min_api_version = 19 } ) @@ -608,6 +626,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.colorControl.saturation(72)) } + }, + { + min_api_version = 19 } ) @@ -656,6 +677,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.switchLevel.levelRange({minimum = 50, maximum = 80})) } + }, + { + min_api_version = 19 } ) @@ -683,6 +707,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({minimum = 1800, maximum = 6500})) } + }, + { + min_api_version = 19 } ) @@ -690,7 +717,10 @@ test.register_coroutine_test( "Test child devices are created in order of their endpoints", function() end, - { test_init = test_init_parent_child_endpoints_non_sequential } + { + test_init = test_init_parent_child_endpoints_non_sequential, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -700,7 +730,11 @@ test.register_coroutine_test( mock_children[child1_ep]:expect_metadata_update({ profile = "light-level" }) mock_children[child2_ep]:expect_metadata_update({ profile = "light-color-level" }) mock_device:expect_metadata_update({ profile = "light-binary" }) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/matter-switch/src/test/test_multi_switch_parent_child_plugs.lua b/drivers/SmartThings/matter-switch/src/test/test_multi_switch_parent_child_plugs.lua index 2370984c97..edbc775df8 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_multi_switch_parent_child_plugs.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_multi_switch_parent_child_plugs.lua @@ -341,6 +341,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -392,6 +395,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -443,6 +449,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -470,6 +479,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -513,6 +525,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.colorTemperature.colorTemperature(1800)) }, + }, + { + min_api_version = 19 } ) @@ -545,6 +560,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.colorControl.saturation(72)) } + }, + { + min_api_version = 19 } ) @@ -601,6 +619,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.colorControl.saturation(72)) } + }, + { + min_api_version = 19 } ) @@ -649,6 +670,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.switchLevel.levelRange({minimum = 50, maximum = 80})) } + }, + { + min_api_version = 19 } ) @@ -676,6 +700,9 @@ test.register_message_test( direction = "send", message = mock_children[child2_ep]:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({minimum = 1800, maximum = 6500})) } + }, + { + min_api_version = 19 } ) @@ -683,7 +710,11 @@ test.register_coroutine_test( "Test child devices are created in order of their endpoints", function() end, - { test_init = test_init_parent_child_endpoints_non_sequential } + { + test_init = test_init_parent_child_endpoints_non_sequential, + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/matter-switch/src/test/test_stateless_step.lua b/drivers/SmartThings/matter-switch/src/test/test_stateless_step.lua index a8a8e83b4b..345d8ad232 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_stateless_step.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_stateless_step.lua @@ -67,7 +67,7 @@ test.register_message_test( direction = "send", message = { mock_device_color_temp.id, - clusters.ColorControl.server.commands.StepColorTemperature(mock_device_color_temp, 1, clusters.ColorControl.types.StepModeEnum.DOWN, 187, fields.TRANSITION_TIME_FAST, fields.COLOR_TEMPERATURE_MIRED_MIN, fields.COLOR_TEMPERATURE_MIRED_MAX, fields.OPTIONS_MASK, fields.IGNORE_COMMAND_IF_OFF) + clusters.ColorControl.server.commands.StepColorTemperature(mock_device_color_temp, 1, clusters.ColorControl.types.StepModeEnum.DOWN, 60, fields.TRANSITION_TIME_FAST, fields.DEFAULT_MIRED_MIN, fields.DEFAULT_MIRED_MAX, fields.OPTIONS_MASK, fields.IGNORE_COMMAND_IF_OFF) }, }, { @@ -83,7 +83,7 @@ test.register_message_test( direction = "send", message = { mock_device_color_temp.id, - clusters.ColorControl.server.commands.StepColorTemperature(mock_device_color_temp, 1, clusters.ColorControl.types.StepModeEnum.DOWN, 840, fields.TRANSITION_TIME_FAST, fields.COLOR_TEMPERATURE_MIRED_MIN, fields.COLOR_TEMPERATURE_MIRED_MAX, fields.OPTIONS_MASK, fields.IGNORE_COMMAND_IF_OFF) + clusters.ColorControl.server.commands.StepColorTemperature(mock_device_color_temp, 1, clusters.ColorControl.types.StepModeEnum.DOWN, 271, fields.TRANSITION_TIME_FAST, fields.DEFAULT_MIRED_MIN, fields.DEFAULT_MIRED_MAX, fields.OPTIONS_MASK, fields.IGNORE_COMMAND_IF_OFF) }, }, { @@ -99,9 +99,12 @@ test.register_message_test( direction = "send", message = { mock_device_color_temp.id, - clusters.ColorControl.server.commands.StepColorTemperature(mock_device_color_temp, 1, clusters.ColorControl.types.StepModeEnum.UP, 467, fields.TRANSITION_TIME_FAST, fields.COLOR_TEMPERATURE_MIRED_MIN, fields.COLOR_TEMPERATURE_MIRED_MAX, fields.OPTIONS_MASK, fields.IGNORE_COMMAND_IF_OFF) + clusters.ColorControl.server.commands.StepColorTemperature(mock_device_color_temp, 1, clusters.ColorControl.types.StepModeEnum.UP, 151, fields.TRANSITION_TIME_FAST, fields.DEFAULT_MIRED_MIN, fields.DEFAULT_MIRED_MAX, fields.OPTIONS_MASK, fields.IGNORE_COMMAND_IF_OFF) }, } + }, + { + min_api_version = 19 } ) @@ -157,6 +160,9 @@ test.register_message_test( clusters.LevelControl.server.commands.Step(mock_device_color_temp, 1, clusters.LevelControl.types.StepModeEnum.UP, 254, fields.TRANSITION_TIME_FAST, fields.OPTIONS_MASK, fields.IGNORE_COMMAND_IF_OFF) }, } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-switch/src/test/test_third_reality_mk1.lua b/drivers/SmartThings/matter-switch/src/test/test_third_reality_mk1.lua index 0a72a1316e..77c7d7843c 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_third_reality_mk1.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_third_reality_mk1.lua @@ -232,7 +232,10 @@ test.register_coroutine_test( mock_device:generate_test_message(key == 1 and "main" or "F" .. key, capabilities.button.button.pushed({state_change = true})) ) end - end + end, + { + min_api_version = 19 + } ) -- run the tests diff --git a/drivers/SmartThings/matter-thermostat/fingerprints.yml b/drivers/SmartThings/matter-thermostat/fingerprints.yml index 82be079601..cd1e7c5cbd 100644 --- a/drivers/SmartThings/matter-thermostat/fingerprints.yml +++ b/drivers/SmartThings/matter-thermostat/fingerprints.yml @@ -49,6 +49,12 @@ matterManufacturer: vendorId: 0x1527 productId: 0x0002 deviceProfileName: thermostat-heating-only-batteryLevel + #Leviton + - id: "4251/4101" + deviceLabel: Decora Smart Wi-Fi (2ndGen) Fan Speed Controller + vendorId: 0x109B + productId: 0x1005 + deviceProfileName: fan-generic #Lux - id: "4614/1" deviceLabel: LUX TQ1 Smart Thermostat diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier.lua index ca7fddcdd9..8c0ddad122 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier.lua @@ -430,7 +430,10 @@ test.register_coroutine_test( mock_device_ap_aqs:expect_metadata_update({ profile = "air-purifier-hepa-ac-aqs-co2-tvoc-meas-co2-radon-level" }) mock_device_ap_aqs:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end, - { test_init = test_init_ap_aqs } + { + test_init = test_init_ap_aqs, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -443,7 +446,10 @@ test.register_coroutine_test( mock_device_ap_thermo_aqs:expect_metadata_update({ provisioning_state = "PROVISIONED" }) print(mock_device_ap_thermo_aqs.profile) end, - { test_init = test_init_ap_thermo_aqs } + { + test_init = test_init_ap_thermo_aqs, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -465,7 +471,10 @@ test.register_coroutine_test( mock_device_ap_thermo_aqs_preconfigured:generate_test_message("main", capabilities.formaldehydeMeasurement.formaldehydeLevel({value = 14, unit = "ppm"})) ) end, - { test_init = test_init_ap_thermo_aqs_preconfigured } + { + test_init = test_init_ap_thermo_aqs_preconfigured, + min_api_version = 19 + } ) test.register_message_test( @@ -519,6 +528,9 @@ test.register_message_test( clusters.FanControl.attributes.FanMode:write(mock_device, 1, clusters.FanControl.attributes.FanMode.AUTO) } } + }, + { + min_api_version = 19 } ) @@ -560,6 +572,9 @@ test.register_message_test( capabilities.airPurifierFanMode.airPurifierFanMode.high.NAME }, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -595,6 +610,9 @@ test.register_message_test( clusters.FanControl.attributes.PercentSetting:write(mock_device, 1, 50) } } + }, + { + min_api_version = 19 } ) @@ -640,6 +658,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.airPurifierFanMode.airPurifierFanMode.high()) }, + }, + { + min_api_version = 19 } ) @@ -698,6 +719,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("activatedCarbonFilter", capabilities.filterStatus.filterStatus.replace()) }, + }, + { + min_api_version = 19 } ) @@ -751,6 +775,9 @@ test.register_message_test( clusters.FanControl.attributes.WindSetting:write(mock_device, 1, clusters.FanControl.types.WindSettingMask.NATURAL_WIND) } } + }, + { + min_api_version = 19 } ) @@ -770,6 +797,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.fanSpeedPercent.percent(100)) }, + }, + { + min_api_version = 19 } ) @@ -838,6 +868,9 @@ test.register_message_test( clusters.FanControl.attributes.RockSetting:write(mock_device_rock, 1, clusters.FanControl.types.RockBitmap.ROCK_UP_DOWN) } } + }, + { + min_api_version = 19 } ) @@ -853,7 +886,10 @@ test.register_coroutine_test( clusters.Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device_ap_thermo_aqs_preconfigured, 7, 2100) }) end, - { test_init = test_init_ap_thermo_aqs_preconfigured } + { + test_init = test_init_ap_thermo_aqs_preconfigured, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -876,7 +912,10 @@ test.register_coroutine_test( clusters.ActivatedCarbonFilterMonitoring.server.commands.ResetCondition(mock_device_ap_thermo_aqs_preconfigured, 1) }) end, - { test_init = test_init_ap_thermo_aqs_preconfigured } + { + test_init = test_init_ap_thermo_aqs_preconfigured, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_api9.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_api9.lua index fd68c958d9..d16833eda1 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_api9.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_api9.lua @@ -430,7 +430,10 @@ test.register_coroutine_test( mock_device_ap_aqs:expect_metadata_update({ profile = "air-purifier-hepa-ac-aqs-co2-tvoc-meas-co2-radon-level" }) mock_device_ap_aqs:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end, - { test_init = test_init_ap_aqs } + { + test_init = test_init_ap_aqs, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -443,7 +446,10 @@ test.register_coroutine_test( mock_device_ap_thermo_aqs:expect_metadata_update({ provisioning_state = "PROVISIONED" }) print(mock_device_ap_thermo_aqs.profile) end, - { test_init = test_init_ap_thermo_aqs } + { + test_init = test_init_ap_thermo_aqs, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -465,7 +471,10 @@ test.register_coroutine_test( mock_device_ap_thermo_aqs_preconfigured:generate_test_message("main", capabilities.formaldehydeMeasurement.formaldehydeLevel({value = 14, unit = "ppm"})) ) end, - { test_init = test_init_ap_thermo_aqs_preconfigured } + { + test_init = test_init_ap_thermo_aqs_preconfigured, + min_api_version = 19 + } ) test.register_message_test( @@ -519,6 +528,9 @@ test.register_message_test( clusters.FanControl.attributes.FanMode:write(mock_device, 1, clusters.FanControl.attributes.FanMode.AUTO) } } + }, + { + min_api_version = 19 } ) @@ -560,6 +572,9 @@ test.register_message_test( capabilities.airPurifierFanMode.airPurifierFanMode.high.NAME }, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -595,6 +610,9 @@ test.register_message_test( clusters.FanControl.attributes.PercentSetting:write(mock_device, 1, 50) } } + }, + { + min_api_version = 19 } ) @@ -640,6 +658,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.airPurifierFanMode.airPurifierFanMode.high()) } + }, + { + min_api_version = 19 } ) @@ -698,6 +719,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("activatedCarbonFilter", capabilities.filterStatus.filterStatus.replace()) } + }, + { + min_api_version = 19 } ) @@ -752,6 +776,9 @@ test.register_message_test( clusters.FanControl.attributes.WindSetting:write(mock_device, 1, clusters.FanControl.types.WindSettingMask.NATURAL_WIND) } } + }, + { + min_api_version = 19 } ) @@ -771,6 +798,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.fanSpeedPercent.percent(100)) } + }, + { + min_api_version = 19 } ) @@ -840,6 +870,9 @@ test.register_message_test( clusters.FanControl.attributes.RockSetting:write(mock_device_rock, 1, clusters.FanControl.types.RockBitmap.ROCK_UP_DOWN) } } + }, + { + min_api_version = 19 } ) @@ -855,7 +888,10 @@ test.register_coroutine_test( clusters.Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device_ap_thermo_aqs_preconfigured, 7, 2100) }) end, - { test_init = test_init_ap_thermo_aqs_preconfigured } + { + test_init = test_init_ap_thermo_aqs_preconfigured, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -878,7 +914,10 @@ test.register_coroutine_test( clusters.ActivatedCarbonFilterMonitoring.server.commands.ResetCondition(mock_device_ap_thermo_aqs_preconfigured, 1) }) end, - { test_init = test_init_ap_thermo_aqs_preconfigured } + { + test_init = test_init_ap_thermo_aqs_preconfigured, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_modular.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_modular.lua index 745076cd04..7ee1a966d4 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_modular.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_air_purifier_modular.lua @@ -315,7 +315,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive(mock_device_basic:generate_info_changed({ profile = updated_device_profile })) test.socket.matter:__expect_send({mock_device_basic.id, subscribe_request}) end, - { test_init = test_init_basic } + { + test_init = test_init_basic, + min_api_version = 19 + } ) local expected_update_metadata= { @@ -389,7 +392,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive(mock_device_ap_thermo_aqs:generate_info_changed({ profile = updated_device_profile })) test.socket.matter:__expect_send({mock_device_ap_thermo_aqs.id, subscribe_request}) end, - { test_init = test_init_ap_thermo_aqs_preconfigured } + { + test_init = test_init_ap_thermo_aqs_preconfigured, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_fan.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_fan.lua index 8eefceb23b..975a192d9d 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_fan.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_fan.lua @@ -111,7 +111,10 @@ test.register_coroutine_test( mock_device:expect_metadata_update({ profile = "fan-rock-wind" }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end, - { test_init = test_init } + { + test_init = test_init, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -123,7 +126,10 @@ test.register_coroutine_test( mock_device_generic:expect_metadata_update({ profile = "fan-generic" }) mock_device_generic:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end, - { test_init = test_init_generic } + { + test_init = test_init_generic, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_heat_pump.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_heat_pump.lua index e96bfb69fc..8bfd026c24 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_heat_pump.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_heat_pump.lua @@ -146,7 +146,10 @@ test.register_coroutine_test( local component_to_endpoint_map = mock_device:get_field("__component_to_endpoint_map") assert(component_to_endpoint_map["thermostatOne"] == THERMOSTAT_ONE_EP, string.format("Thermostat One Endpoint must be %d", THERMOSTAT_ONE_EP)) assert(component_to_endpoint_map["thermostatTwo"] == THERMOSTAT_TWO_EP, string.format("Thermostat Two Endpoint must be %d", THERMOSTAT_TWO_EP)) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -188,6 +191,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("thermostatTwo", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 23.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -230,6 +236,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("thermostatTwo", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 19.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -268,6 +277,9 @@ test.register_message_test( clusters.Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device, THERMOSTAT_TWO_EP, 25*100) } } + }, + { + min_api_version = 19 } ) @@ -306,6 +318,9 @@ test.register_message_test( clusters.Thermostat.attributes.OccupiedCoolingSetpoint:write(mock_device, THERMOSTAT_TWO_EP , 13*100) } } + }, + { + min_api_version = 19 } ) @@ -370,6 +385,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("thermostatTwo", capabilities.thermostatMode.thermostatMode.heat()) }, + }, + { + min_api_version = 19 } ) @@ -455,6 +473,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("thermostatTwo", capabilities.thermostatMode.supportedThermostatModes({"off", "cool"}, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -523,6 +544,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("thermostatTwo", capabilities.thermostatMode.thermostatMode.emergency_heat()) }, + }, + { + min_api_version = 19 } ) @@ -587,7 +611,10 @@ test.register_message_test( message = mock_device_with_auto:generate_test_message("thermostatTwo", capabilities.thermostatMode.thermostatMode.emergency_heat()) }, }, - { test_init = test_init_auto } + { + test_init = test_init_auto, + min_api_version = 19 + } ) test.register_message_test( @@ -608,6 +635,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 15.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -630,6 +660,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 15, unit = "Wh" })) } + }, + { + min_api_version = 19 } ) @@ -676,7 +709,8 @@ test.register_coroutine_test( { test_init = function() test_init() - end + end, + min_api_version = 19 } ) @@ -728,7 +762,8 @@ test.register_coroutine_test( { test_init = function() test_init() - end + end, + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_room_ac.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_room_ac.lua index bb7b9e6bde..6dfe993c27 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_room_ac.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_room_ac.lua @@ -294,7 +294,10 @@ test.register_coroutine_test( ) mock_device_configure:expect_metadata_update({ profile = "room-air-conditioner" }) end, - { test_init = test_init_configure } + { + test_init = test_init_configure, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -312,7 +315,10 @@ test.register_coroutine_test( ) mock_device_nostate:expect_metadata_update({ profile = "room-air-conditioner-fan-heating-cooling-nostate" }) end, - { test_init = test_init_nostate } + { + test_init = test_init_nostate, + min_api_version = 19 + } ) test.register_message_test( @@ -347,6 +353,9 @@ test.register_message_test( clusters.FanControl.attributes.PercentSetting:write(mock_device, 1, 50) } } + }, + { + min_api_version = 19 } ) @@ -400,6 +409,9 @@ test.register_message_test( clusters.FanControl.attributes.WindSetting:write(mock_device, 1, clusters.FanControl.types.WindSettingMask.NATURAL_WIND) } } + }, + { + min_api_version = 19 } ) @@ -445,6 +457,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.airConditionerFanMode.fanMode("high")) } + }, + { + min_api_version = 19 } ) @@ -478,6 +493,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.airConditionerFanMode.supportedAcFanModes({"off", "low", "medium", "high", "auto"}, {visibility={displayed=false}})) } + }, + { + min_api_version = 19 } ) @@ -524,6 +542,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"cool"}, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -561,6 +582,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.emergency_heat()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_room_ac_modular.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_room_ac_modular.lua index be240c95d0..6ecbe049aa 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_room_ac_modular.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_room_ac_modular.lua @@ -312,7 +312,10 @@ test.register_coroutine_test( function() test_room_ac_device_type_update_modular_profile(mock_device_basic, expected_metadata_basic, subscribe_request_basic, uint32(0x29)) end, - { test_init = test_init_basic } + { + test_init = test_init_basic, + min_api_version = 19 + } ) local expected_metadata_no_state = { @@ -337,6 +340,9 @@ test.register_coroutine_test( function() test_room_ac_device_type_update_modular_profile(mock_device_no_state, expected_metadata_no_state, subscribe_request_no_state, uint32(0)) end, - { test_init = test_init_no_state } + { + test_init = test_init_no_state, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_battery.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_battery.lua index a28882ca46..bb9c637714 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_battery.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_battery.lua @@ -105,7 +105,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ profile = "thermostat-cooling-only-nostate" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -124,7 +127,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ profile = "thermostat-cooling-only-nostate-batteryLevel" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -136,7 +142,10 @@ test.register_coroutine_test( clusters.PowerSource.attributes.AttributeList:build_test_report_data(mock_device, 1, {uint32(10)}) } ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_featuremap.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_featuremap.lua index 2db6e20e59..328ea848cf 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_featuremap.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_featuremap.lua @@ -226,7 +226,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ profile = "thermostat-humidity-fan-heating-only" }) -end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -247,7 +250,10 @@ test.register_coroutine_test( } } test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed(updates)) -end +end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -269,7 +275,10 @@ test.register_coroutine_test( } ) mock_device_simple:expect_metadata_update({ profile = "thermostat-cooling-only-nostate" }) -end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -283,7 +292,10 @@ test.register_coroutine_test( } ) mock_device_no_battery:expect_metadata_update({ profile = "thermostat-cooling-only-nostate-nobattery" }) -end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_multiple_device_types.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_multiple_device_types.lua index 90e529beb3..e9f92b6d2c 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_multiple_device_types.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_multiple_device_types.lua @@ -238,7 +238,10 @@ test.register_coroutine_test( function() test_thermostat_device_type_update_modular_profile(mock_device, expected_metadata, get_subscribe_request(mock_device, new_cluster_subscribe_list)) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -247,7 +250,10 @@ test.register_coroutine_test( test_thermostat_device_type_update_modular_profile(mock_device_disorder_endpoints, expected_metadata, get_subscribe_request(mock_device_disorder_endpoints, new_cluster_subscribe_list)) end, - { test_init = test_init_disorder_endpoints } + { + test_init = test_init_disorder_endpoints, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -278,7 +284,10 @@ test.register_coroutine_test( mock_device.id, clusters.FanControl.attributes.PercentSetting:write(mock_device, 2, 50) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua index 74e550b344..6f8f7d6412 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits.lua @@ -148,7 +148,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", cached_heating_setpoint) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -174,7 +177,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", cached_cooling_setpoint) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -200,7 +206,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", cached_heating_setpoint) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -226,7 +235,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", cached_cooling_setpoint) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -245,7 +257,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", cached_heating_setpoint) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -264,7 +279,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", cached_cooling_setpoint) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -277,7 +295,10 @@ test.register_coroutine_test( test.wait_for_events() local min_setpoint_deadband_checked = mock_device:get_field("MIN_SETPOINT_DEADBAND_CHECKED") assert(min_setpoint_deadband_checked == true, "min_setpoint_deadband_checked is True") - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -304,6 +325,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpointRange({ value = { minimum = 10.00, maximum = 32.22, step = 0.1 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -331,6 +355,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpointRange({ value = { minimum = 10.00, maximum = 32.22, step = 0.1 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -358,6 +385,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 5.00, maximum = 39.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits_rpc.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits_rpc.lua index 13eaa47bfe..3163303942 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits_rpc.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermo_setpoint_limits_rpc.lua @@ -99,6 +99,9 @@ test.register_message_test( clusters.Thermostat.attributes.AbsMaxCoolSetpointLimit:build_test_report_data(mock_device, 1, 3222) } } + }, + { + min_api_version = 19 } ) @@ -121,6 +124,9 @@ test.register_message_test( clusters.Thermostat.attributes.AbsMaxHeatSetpointLimit:build_test_report_data(mock_device, 1, 3222) } } + }, + { + min_api_version = 19 } ) @@ -143,7 +149,11 @@ test.register_message_test( clusters.TemperatureMeasurement.attributes.MaxMeasuredValue:build_test_report_data(mock_device, 1, 4000) } } + }, + { + min_api_version = 19 } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat.lua index 3eed9709a2..4125e20649 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat.lua @@ -167,6 +167,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 40 })) } + }, + { + min_api_version = 19 } ) @@ -186,6 +189,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -205,6 +211,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -229,6 +238,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -253,6 +265,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -272,6 +287,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.cooling()) } + }, + { + min_api_version = 19 } ) @@ -291,6 +309,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.heating()) } + }, + { + min_api_version = 19 } ) @@ -310,6 +331,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.fan_only()) } + }, + { + min_api_version = 19 } ) @@ -329,6 +353,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.idle()) } + }, + { + min_api_version = 19 } ) @@ -363,6 +390,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.cool()) }, + }, + { + min_api_version = 19 } ) @@ -409,6 +439,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "cool"}, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -455,7 +488,10 @@ test.register_message_test( message = mock_device_auto:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"off", "cool", "auto"}, {visibility={displayed=false}})) }, }, - { test_init = test_init_auto } + { + test_init = test_init_auto, + min_api_version = 19 + } ) test.register_message_test( @@ -492,6 +528,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.emergency_heat()) } + }, + { + min_api_version = 19 } ) @@ -530,7 +569,10 @@ test.register_message_test( message = mock_device_auto:generate_test_message("main", capabilities.thermostatMode.thermostatMode.emergency_heat()) } }, - { test_init = test_init_auto } + { + test_init = test_init_auto, + min_api_version = 19 + } ) test.register_message_test( @@ -579,7 +621,10 @@ test.register_message_test( } }, }, - { test_init = test_init_auto } + { + test_init = test_init_auto, + min_api_version = 19 + } ) local FanMode = clusters.FanControl.attributes.FanMode @@ -633,6 +678,9 @@ test.register_message_test( FanMode:build_test_report_data(mock_device, 1, FanMode.OFF) } } + }, + { + min_api_version = 19 } ) @@ -666,6 +714,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatFanMode.supportedThermostatFanModes({"auto", "on"}, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -688,6 +739,9 @@ test.register_message_test( clusters.Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device, 1, 15*100) } } + }, + { + min_api_version = 19 } ) @@ -710,6 +764,9 @@ test.register_message_test( clusters.Thermostat.attributes.OccupiedCoolingSetpoint:write(mock_device, 1, 25*100) } } + }, + { + min_api_version = 19 } ) @@ -732,6 +789,9 @@ test.register_message_test( clusters.Thermostat.attributes.SystemMode:write(mock_device, 1, 3) } } + }, + { + min_api_version = 19 } ) @@ -770,6 +830,9 @@ test.register_message_test( FanMode:write(mock_device, 1, FanMode.ON) } }, + }, + { + min_api_version = 19 } ) @@ -792,6 +855,9 @@ test.register_message_test( clusters.FanControl.attributes.FanMode:write(mock_device, 1, 5) } } + }, + { + min_api_version = 19 } ) @@ -810,7 +876,11 @@ test.register_coroutine_test("Battery percent reports should generate correct me ) ) test.wait_for_events() -end) +end, +{ + min_api_version = 19 +} +) local refresh_request = nil local attribute_refresh_list = { @@ -861,6 +931,9 @@ test.register_message_test( refresh_request } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_composed_bridged.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_composed_bridged.lua index ef85b147af..9e38f59b09 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_composed_bridged.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_composed_bridged.lua @@ -96,6 +96,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 40 })) } + }, + { + min_api_version = 19 } ) @@ -116,6 +119,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -136,6 +142,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -162,6 +171,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -188,6 +200,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 40.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -208,6 +223,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.cooling()) } + }, + { + min_api_version = 19 } ) @@ -228,6 +246,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.heating()) } + }, + { + min_api_version = 19 } ) @@ -248,6 +269,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.fan_only()) } + }, + { + min_api_version = 19 } ) @@ -268,6 +292,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.idle()) } + }, + { + min_api_version = 19 } ) @@ -300,6 +327,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.cool()) }, + }, + { + min_api_version = 19 } ) @@ -350,6 +380,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({ "off", "cool" }, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -389,6 +422,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.emergency_heat()) }, + }, + { + min_api_version = 19 } ) @@ -436,6 +472,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatFanMode.thermostatFanMode.on()) }, + }, + { + min_api_version = 19 } ) @@ -471,6 +510,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatFanMode.supportedThermostatFanModes({ "auto", "on" }, {visibility={displayed=false}})) }, + }, + { + min_api_version = 19 } ) @@ -493,6 +535,9 @@ test.register_message_test( clusters.Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device, 3, 15 * 100) } } + }, + { + min_api_version = 19 } ) @@ -515,6 +560,9 @@ test.register_message_test( clusters.Thermostat.attributes.OccupiedCoolingSetpoint:write(mock_device, 3, 25 * 100) } } + }, + { + min_api_version = 19 } ) @@ -537,6 +585,9 @@ test.register_message_test( clusters.Thermostat.attributes.SystemMode:write(mock_device, 3, 3) } } + }, + { + min_api_version = 19 } ) @@ -575,6 +626,9 @@ test.register_message_test( FanMode:write(mock_device, 3, FanMode.ON) } }, + }, + { + min_api_version = 19 } ) @@ -597,6 +651,9 @@ test.register_message_test( clusters.FanControl.attributes.FanMode:write(mock_device, 3, 5) } } + }, + { + min_api_version = 19 } ) @@ -615,7 +672,11 @@ test.register_coroutine_test("Battery percent reports should generate correct me ) ) test.wait_for_events() -end) +end, +{ + min_api_version = 19 +} +) local refresh_request = nil local attribute_refresh_list = { @@ -666,6 +727,9 @@ test.register_message_test( refresh_request } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_modular.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_modular.lua index 16e5be7660..1cdf85215a 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_modular.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_modular.lua @@ -177,7 +177,83 @@ test.register_coroutine_test( function() test_thermostat_device_type_update_modular_profile(mock_device_basic, expected_metadata, subscribe_request_basic) end, - { test_init = test_init } + { + test_init = test_init, + min_api_version = 19 + } +) + +local function initialize_subscribe_request(mock_device, subscribed_attributes) + local subscribe_request = nil + for _, attributes in pairs(subscribed_attributes) do + for _, attribute in pairs(attributes) do + if subscribe_request == nil then + subscribe_request = attribute:subscribe(mock_device) + else + subscribe_request:merge(attribute:subscribe(mock_device)) + end + end + end + return subscribe_request +end + + +local function test_init_modular_fingerprint() + test.mock_device.add_test_device(mock_device_modular) + test.socket.device_lifecycle:__queue_receive({ mock_device_modular.id, "init" }) + local subscribe_request = initialize_subscribe_request(mock_device_modular, { + [clusters.Thermostat.ID] = { + clusters.Thermostat.attributes.LocalTemperature, + clusters.Thermostat.attributes.SystemMode, + clusters.Thermostat.attributes.ControlSequenceOfOperation, + }, + [clusters.TemperatureMeasurement.ID] = { + clusters.TemperatureMeasurement.attributes.MaxMeasuredValue, + clusters.TemperatureMeasurement.attributes.MeasuredValue, + clusters.TemperatureMeasurement.attributes.MinMeasuredValue, + }, + }) + test.socket.matter:__expect_send({mock_device_modular.id, subscribe_request}) +end + +test.register_coroutine_test( +"Component-capability update without profile ID update should cause re-subscribe in infoChanged handler", function() + local subscribe_request = initialize_subscribe_request(mock_device_modular, { + [clusters.Thermostat.ID] = { + clusters.Thermostat.attributes.LocalTemperature, + clusters.Thermostat.attributes.SystemMode, + clusters.Thermostat.attributes.ControlSequenceOfOperation, + }, + [clusters.TemperatureMeasurement.ID] = { + clusters.TemperatureMeasurement.attributes.MaxMeasuredValue, + clusters.TemperatureMeasurement.attributes.MeasuredValue, + clusters.TemperatureMeasurement.attributes.MinMeasuredValue, + }, + [clusters.FanControl.ID] = { + clusters.FanControl.attributes.FanMode, + clusters.FanControl.attributes.FanModeSequence, + }, + }) + local expected_metadata_modular = { + optional_component_capabilities={{"main", {"fanMode"}}}, + profile="thermostat-modular", + } + local updated_device_profile = t_utils.get_profile_definition("thermostat-modular.yml", + {enabled_optional_capabilities = expected_metadata_modular.optional_component_capabilities} + ) + updated_device_profile.id = "00000000-1111-2222-3333-000000000003" + test.socket.device_lifecycle:__queue_receive(mock_device_modular:generate_info_changed({ profile = updated_device_profile })) + test.socket.matter:__expect_send({mock_device_modular.id, subscribe_request}) + end, + { test_init = test_init_modular_fingerprint } +) + +test.register_coroutine_test( + "No component-capability update and no profile ID update should not cause a re-subscribe in infoChanged handler", function() + -- simulate no actual change + test.socket.device_lifecycle:__queue_receive(mock_device_modular:generate_info_changed({})) + end, + { test_init = function() test.mock_device.add_test_device(mock_device_modular) end } ) local function initialize_subscribe_request(mock_device, subscribed_attributes) diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_rpc5.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_rpc5.lua index a9bbf59930..0ae634cbc4 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_rpc5.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_thermostat_rpc5.lua @@ -135,6 +135,9 @@ test.register_message_test( clusters.Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device, 1, 35 * 100) } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-thermostat/src/test/test_matter_water_heater.lua b/drivers/SmartThings/matter-thermostat/src/test/test_matter_water_heater.lua index b39db4136b..552715c3bf 100644 --- a/drivers/SmartThings/matter-thermostat/src/test/test_matter_water_heater.lua +++ b/drivers/SmartThings/matter-thermostat/src/test/test_matter_water_heater.lua @@ -115,6 +115,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 70.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -137,6 +140,9 @@ test.register_message_test( clusters.Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device, WATER_HEATER_EP, 80*100) } } + }, + { + min_api_version = 19 } ) @@ -196,6 +202,9 @@ test.register_message_test( clusters.WaterHeaterMode.commands.ChangeToMode(mock_device, WATER_HEATER_EP, 0) -- Index where Mode 1 is stored) } } + }, + { + min_api_version = 19 } ) @@ -225,6 +234,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -247,6 +259,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 15, unit = "Wh" })) } + }, + { + min_api_version = 19 } ) @@ -315,7 +330,8 @@ test.register_coroutine_test( { test_init = function() test_init() - end + end, + min_api_version = 19 } ) @@ -415,6 +431,9 @@ test.register_message_test( clusters.WaterHeaterMode.commands.ChangeToMode(mock_device, WATER_HEATER_EP, 0) -- Index is Water Heater Mode 1 } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/matter-thermostat/src/thermostat_utils/utils.lua b/drivers/SmartThings/matter-thermostat/src/thermostat_utils/utils.lua index dd298bc987..a233a0c0e7 100644 --- a/drivers/SmartThings/matter-thermostat/src/thermostat_utils/utils.lua +++ b/drivers/SmartThings/matter-thermostat/src/thermostat_utils/utils.lua @@ -97,15 +97,15 @@ function ThermostatUtils.deep_equals(a, b, opts, seen) end -- Compare keys/values from a - for k, v in next, a do - if not ThermostatUtils.deep_equals(v, rawget(b, k), opts, seen) then + for k, v in pairs(a) do + if not ThermostatUtils.deep_equals(v, b[k], opts, seen) then return false end end -- Ensure b doesn't have extra keys - for k in next, b do - if rawget(a, k) == nil then + for k in pairs(b) do + if a[k] == nil then return false end 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 409ebfcb09..20f01b6f99 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 @@ -187,7 +187,10 @@ test.register_coroutine_test( WindowCovering.attributes.OperationalStatus:build_test_report_data(mock_device, 10, 0), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -217,7 +220,10 @@ test.register_coroutine_test( WindowCovering.attributes.OperationalStatus:build_test_report_data(mock_device, 10, 0), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -247,7 +253,10 @@ test.register_coroutine_test( "main", capabilities.windowShade.windowShade.closed() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -277,7 +286,10 @@ test.register_coroutine_test( "main", capabilities.windowShade.windowShade.closed() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -307,7 +319,10 @@ test.register_coroutine_test( WindowCovering.attributes.OperationalStatus:build_test_report_data(mock_device, 10, 0), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -337,7 +352,10 @@ test.register_coroutine_test( WindowCovering.attributes.OperationalStatus:build_test_report_data(mock_device, 10, 0), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -367,7 +385,10 @@ test.register_coroutine_test( ), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -397,7 +418,10 @@ test.register_coroutine_test( ), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -427,7 +451,10 @@ test.register_coroutine_test( WindowCovering.attributes.OperationalStatus:build_test_report_data(mock_device, 10, 0), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -457,7 +484,10 @@ test.register_coroutine_test( WindowCovering.attributes.OperationalStatus:build_test_report_data(mock_device, 10, 0), } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -487,7 +517,10 @@ test.register_coroutine_test( "main", capabilities.windowShade.windowShade.partially_open() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -517,7 +550,10 @@ test.register_coroutine_test( "main", capabilities.windowShade.windowShade.partially_open() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test("WindowCovering OperationalStatus opening", function() @@ -551,7 +587,11 @@ test.register_coroutine_test("WindowCovering OperationalStatus opening", functio "main", capabilities.windowShade.windowShade.opening() ) ) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("WindowCovering OperationalStatus closing", function() test.socket.capability:__set_channel_ordering("relaxed") @@ -584,7 +624,11 @@ test.register_coroutine_test("WindowCovering OperationalStatus closing", functio "main", capabilities.windowShade.windowShade.closing() ) ) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("WindowCovering OperationalStatus unknown", function() test.socket.capability:__set_channel_ordering("relaxed") @@ -617,7 +661,11 @@ test.register_coroutine_test("WindowCovering OperationalStatus unknown", functio "main", capabilities.windowShade.windowShade.unknown() ) ) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test( "WindowShade open cmd handler", function() @@ -631,7 +679,10 @@ test.register_coroutine_test( {mock_device.id, WindowCovering.server.commands.UpOrOpen(mock_device, 10)} ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -646,7 +697,10 @@ test.register_coroutine_test( {mock_device.id, WindowCovering.server.commands.DownOrClose(mock_device, 10)} ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -661,7 +715,10 @@ test.register_coroutine_test( {mock_device.id, WindowCovering.server.commands.StopMotion(mock_device, 10)} ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -690,7 +747,10 @@ test.register_coroutine_test( end test.socket.matter:__expect_send({mock_device.id, read_request}) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test("WindowShade setShadeLevel cmd handler", function() @@ -703,7 +763,11 @@ test.register_coroutine_test("WindowShade setShadeLevel cmd handler", function() test.socket.matter:__expect_send( {mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 10, 8000)} ) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("WindowShade setShadeTiltLevel cmd handler", function() test.socket.capability:__queue_receive( @@ -715,7 +779,11 @@ test.register_coroutine_test("WindowShade setShadeTiltLevel cmd handler", functi test.socket.matter:__expect_send( {mock_device.id, WindowCovering.server.commands.GoToTiltPercentage(mock_device, 10, 4000)} ) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("LevelControl CurrentLevel handler", function() test.socket.matter:__queue_receive( @@ -729,7 +797,11 @@ test.register_coroutine_test("LevelControl CurrentLevel handler", function() "main", capabilities.windowShadeLevel.shadeLevel(math.floor((100 / 254.0 * 100) + .5)) ) ) -end) +end, +{ + min_api_version = 19 +} +) --test battery test.register_coroutine_test( @@ -747,7 +819,10 @@ test.register_coroutine_test( "main", capabilities.battery.battery(math.floor(150/2.0+0.5)) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test("OperationalStatus report contains current position report", function() @@ -767,7 +842,11 @@ test.register_coroutine_test("OperationalStatus report contains current position "main", capabilities.windowShade.windowShade.partially_open() ) ) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test( "Handle preset commands", @@ -789,7 +868,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send( {mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 10, (100 - PRESET_LEVEL) * 100)} ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -802,7 +884,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ profile = "window-covering-tilt-battery" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -814,14 +899,20 @@ test.register_coroutine_test( clusters.PowerSource.attributes.AttributeList:build_test_report_data(mock_device, 10, {uint32(10)}) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Test mains powered device does not switch to battery profile", function() end, - { test_init = test_init_mains_powered } + { + test_init = test_init_mains_powered, + min_api_version = 19 + } ) test.register_coroutine_test( @@ -833,7 +924,10 @@ test.register_coroutine_test( test.wait_for_events() test.socket.matter:__queue_receive({mock_device.id, clusters.PowerSource.attributes.AttributeList:build_test_report_data(mock_device, 10, {uint32(0x0C)})}) mock_device:expect_metadata_update({profile = "window-covering-tilt-battery"}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -942,7 +1036,10 @@ test.register_coroutine_test( "main", capabilities.windowShade.windowShade.partially_open() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1013,7 +1110,10 @@ test.register_coroutine_test( "main", capabilities.windowShade.windowShade.partially_open() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1068,7 +1168,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send( {mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 10, 0)} ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1123,7 +1226,10 @@ test.register_coroutine_test( test.socket.matter:__expect_send( {mock_device.id, WindowCovering.server.commands.GoToTiltPercentage(mock_device, 10, 10000)} ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/virtual-switch/src/test/test_virtual_switch.lua b/drivers/SmartThings/virtual-switch/src/test/test_virtual_switch.lua index 651668297b..00264417b1 100644 --- a/drivers/SmartThings/virtual-switch/src/test/test_virtual_switch.lua +++ b/drivers/SmartThings/virtual-switch/src/test/test_virtual_switch.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" local capabilities = require "st.capabilities" @@ -41,6 +44,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -57,6 +63,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("main", capabilities.switch.switch.on({state_change=true})) } + }, + { + min_api_version = 19 } ) @@ -73,6 +82,9 @@ test.register_message_test( direction = "send", message = mock_device_no_prefs:generate_test_message("main", capabilities.switch.switch.on({state_change=true})) } + }, + { + min_api_version = 19 } ) @@ -90,6 +102,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("main", capabilities.switch.switch.off({state_change=true})) } + }, + { + min_api_version = 19 } ) @@ -106,6 +121,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("main", capabilities.switch.switch.off({state_change=true})) } + }, + { + min_api_version = 19 } ) @@ -128,6 +146,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -146,7 +167,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_simple_device.id, { capability = "switch", component = "main", command = "on", args = {} } }) test.socket.capability:__expect_send(mock_simple_device:generate_test_message("main", capabilities.switch.switch.on())) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-air-quality-detector/src/test/test_MultiIR_air_quality_detector.lua b/drivers/SmartThings/zigbee-air-quality-detector/src/test/test_MultiIR_air_quality_detector.lua index 883a3dc5a5..73920bcd34 100755 --- a/drivers/SmartThings/zigbee-air-quality-detector/src/test/test_MultiIR_air_quality_detector.lua +++ b/drivers/SmartThings/zigbee-air-quality-detector/src/test/test_MultiIR_air_quality_detector.lua @@ -71,7 +71,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, read_tvoc_messge}) test.socket.zigbee:__expect_send({mock_device.id, read_carbonDioxide_messge}) test.socket.zigbee:__expect_send({mock_device.id, read_AQI_messge}) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -90,6 +93,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 40 })) } + }, + { + min_api_version = 19 } ) @@ -109,6 +115,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -126,7 +135,10 @@ test.register_coroutine_test( capabilities.carbonDioxideMeasurement.carbonDioxide({value = 1400, unit = "ppm"}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.carbonDioxideHealthConcern.carbonDioxideHealthConcern({value = "good"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -143,7 +155,10 @@ test.register_coroutine_test( capabilities.fineDustSensor.fineDustLevel({value = 74 }))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.fineDustHealthConcern.fineDustHealthConcern.good())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -160,7 +175,10 @@ test.register_coroutine_test( capabilities.veryFineDustSensor.veryFineDustLevel({value = 69 }))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.veryFineDustHealthConcern.veryFineDustHealthConcern.good())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -177,7 +195,10 @@ test.register_coroutine_test( capabilities.dustSensor.dustLevel({value = 69 }))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.dustHealthConcern.dustHealthConcern.good())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -192,7 +213,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.formaldehydeMeasurement.formaldehydeLevel({value = 1000.0, unit = "mg/m^3"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -209,7 +233,10 @@ test.register_coroutine_test( capabilities.tvocMeasurement.tvocLevel({value = 1000.0, unit = "ug/m3"}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.tvocHealthConcern.tvocHealthConcern({value = "unhealthy"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -224,7 +251,240 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.airQualityHealthConcern.airQualityHealthConcern({value = "good"}))) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "AQI moderate (51-100) emits moderate airQualityHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 75 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC5, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.airQualityHealthConcern.airQualityHealthConcern({value = "moderate"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "AQI slightlyUnhealthy (101-150) emits slightlyUnhealthy airQualityHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 125 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC5, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.airQualityHealthConcern.airQualityHealthConcern({value = "slightlyUnhealthy"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "AQI unhealthy (151-200) emits unhealthy airQualityHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 175 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC5, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.airQualityHealthConcern.airQualityHealthConcern({value = "unhealthy"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "AQI veryUnhealthy (201-300) emits veryUnhealthy airQualityHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 250 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC5, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.airQualityHealthConcern.airQualityHealthConcern({value = "veryUnhealthy"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "AQI hazardous (>=301) emits hazardous airQualityHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 350 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC5, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.airQualityHealthConcern.airQualityHealthConcern({value = "hazardous"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "carbonDioxide moderate (1501-2500) emits moderate carbonDioxideHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 2000 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC3, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.carbonDioxideMeasurement.carbonDioxide({value = 2000, unit = "ppm"}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.carbonDioxideHealthConcern.carbonDioxideHealthConcern({value = "moderate"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "carbonDioxide unhealthy (>2500) emits unhealthy carbonDioxideHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 3000 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC3, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.carbonDioxideMeasurement.carbonDioxide({value = 3000, unit = "ppm"}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.carbonDioxideHealthConcern.carbonDioxideHealthConcern({value = "unhealthy"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "pm2.5 moderate emits moderate fineDustHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 90 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC1, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.fineDustSensor.fineDustLevel({value = 90}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.fineDustHealthConcern.fineDustHealthConcern({value = "moderate"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "pm2.5 unhealthy (>=115) emits unhealthy fineDustHealthConcern", + function() + local attr_report_data = { + { 0x0000, data_types.Uint16.ID, 120 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC1, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.fineDustSensor.fineDustLevel({value = 120}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.fineDustHealthConcern.fineDustHealthConcern({value = "unhealthy"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "pm1.0 unhealthy (>100) emits unhealthy veryFineDustHealthConcern", + function() + local attr_report_data = { + { 0x0001, data_types.Uint16.ID, 150 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC1, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.veryFineDustSensor.veryFineDustLevel({value = 150}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.veryFineDustHealthConcern.veryFineDustHealthConcern({value = "unhealthy"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "pm10 unhealthy (>150) emits unhealthy dustHealthConcern", + function() + local attr_report_data = { + { 0x0002, data_types.Uint16.ID, 200 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC1, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.dustSensor.dustLevel({value = 200}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.dustHealthConcern.dustHealthConcern({value = "unhealthy"}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "tvoc good (<600) emits good tvocHealthConcern", + function() + local attr_report_data = { + { 0x0001, data_types.SinglePrecisionFloat.ID, SinglePrecisionFloat(0, 8, 0.953125) } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, 0xFCC2, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.tvocMeasurement.tvocLevel({value = 500.0, unit = "ug/m3"}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.tvocHealthConcern.tvocHealthConcern({value = "good"}))) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-bed/src/test/test_shus_mattress.lua b/drivers/SmartThings/zigbee-bed/src/test/test_shus_mattress.lua index 7e5ade0cf5..bc19893cc6 100755 --- a/drivers/SmartThings/zigbee-bed/src/test/test_shus_mattress.lua +++ b/drivers/SmartThings/zigbee-bed/src/test/test_shus_mattress.lua @@ -1,913 +1,1118 @@ --- Copyright 2024 SmartThings, Inc. --- Licensed under the Apache License, Version 2.0 - --- Mock out globals -local test = require "integration_test" -local cluster_base = require "st.zigbee.cluster_base" -local data_types = require "st.zigbee.data_types" -local t_utils = require "integration_test.utils" -local zigbee_test_utils = require "integration_test.zigbee_test_utils" -local custom_capabilities = require "shus-mattress/custom_capabilities" - -local shus_mattress_profile_def = t_utils.get_profile_definition("shus-smart-mattress.yml") -test.add_package_capability("aiMode.yaml") -test.add_package_capability("autoInflation.yaml") -test.add_package_capability("leftControl.yaml") -test.add_package_capability("rightControl.yaml") -test.add_package_capability("strongExpMode.yaml") -test.add_package_capability("yoga.yaml") -test.add_package_capability("mattressHardness.yaml") - -local PRIVATE_CLUSTER_ID = 0xFCC2 -local MFG_CODE = 0x1235 - -local mock_device = test.mock_device.build_test_zigbee_device( -{ - label = "Shus Smart Mattress", - profile = shus_mattress_profile_def, - zigbee_endpoints = { - [1] = { - id = 1, - manufacturer = "SHUS", - model = "SX-1", - server_clusters = { 0x0000,PRIVATE_CLUSTER_ID } - } - } -}) - -zigbee_test_utils.prepare_zigbee_env_info() -local function test_init() - test.mock_device.add_test_device(mock_device) - zigbee_test_utils.init_noop_health_check_timer() -end - -test.set_test_init_function(test_init) - -test.register_coroutine_test( - "lifecycle - added test", - function() - test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.yoga.supportedYogaState({"stop", "left", "right"}, { visibility = { displayed = false }}) )) - local read_0x0006_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0006, MFG_CODE) - local read_0x0007_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0007, MFG_CODE) - local read_0x0009_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0009, MFG_CODE) - local read_0x000a_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000a, MFG_CODE) - local read_0x0000_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE) - local read_0x0001_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0001, MFG_CODE) - local read_0x0002_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0002, MFG_CODE) - local read_0x0003_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0003, MFG_CODE) - local read_0x0004_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0004, MFG_CODE) - local read_0x0005_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0005, MFG_CODE) - local read_0x0008_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0008, MFG_CODE) - local read_0x000C_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000C, MFG_CODE) - local read_0x000D_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000D, MFG_CODE) - local read_0x000E_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000E, MFG_CODE) - local read_0x000F_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000F, MFG_CODE) - local read_0x0010_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0010, MFG_CODE) - local read_0x0011_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0011, MFG_CODE) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0006_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0007_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0009_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000a_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0000_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0001_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0002_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0003_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0004_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0005_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0008_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000C_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000D_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000E_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000F_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0010_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0011_messge}) - end -) - -test.register_coroutine_test( - "capability - refresh", - function() - test.socket.capability:__queue_receive({ mock_device.id, - { capability = "refresh", component = "main", command = "refresh", args = {} } }) - local read_0x0006_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0006, MFG_CODE) - local read_0x0007_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0007, MFG_CODE) - local read_0x0009_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0009, MFG_CODE) - local read_0x000a_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000a, MFG_CODE) - local read_0x0000_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE) - local read_0x0001_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0001, MFG_CODE) - local read_0x0002_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0002, MFG_CODE) - local read_0x0003_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0003, MFG_CODE) - local read_0x0004_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0004, MFG_CODE) - local read_0x0005_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0005, MFG_CODE) - local read_0x0008_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0008, MFG_CODE) - local read_0x000C_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000C, MFG_CODE) - local read_0x000D_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000D, MFG_CODE) - local read_0x000E_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000E, MFG_CODE) - local read_0x000F_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000F, MFG_CODE) - local read_0x0010_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0010, MFG_CODE) - local read_0x0011_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0011, MFG_CODE) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0006_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0007_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0009_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000a_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0000_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0001_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0002_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0003_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0004_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0005_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0008_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000C_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000D_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000E_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x000F_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0010_messge}) - test.socket.zigbee:__expect_send({mock_device.id, read_0x0011_messge}) - end -) - -test.register_coroutine_test( - "Device reported leftback 0 and driver emit custom_capabilities.left_control.leftback.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0000, data_types.Uint8.ID, 0 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.leftback.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported leftback 1 and driver emit custom_capabilities.left_control.leftback.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0000, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.leftback.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported leftwaist 0 and driver emit custom_capabilities.left_control.leftwaist.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0001, data_types.Uint8.ID, 0 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.leftwaist.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported leftwaist 1 and driver emit custom_capabilities.left_control.leftwaist.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0001, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.leftwaist.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported lefthip 0 and driver emit custom_capabilities.left_control.lefthip.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0002, data_types.Uint8.ID, 0 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.lefthip.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported lefthip 1 and driver emit custom_capabilities.left_control.lefthip.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0002, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.lefthip.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported rightback 0 and driver emit custom_capabilities.right_control.rightback.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0003, data_types.Uint8.ID, 0 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.rightback.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported rightback 1 and driver emit custom_capabilities.right_control.rightback.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0003, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.rightback.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported rightwaist 0 and driver emit custom_capabilities.right_control.rightwaist.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0004, data_types.Uint8.ID, 0 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.rightwaist.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported rightwaist 1 and driver emit custom_capabilities.right_control.rightwaist.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0004, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.rightwaist.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported righthip 0 and driver emit custom_capabilities.right_control.righthip.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0005, data_types.Uint8.ID, 0 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.righthip.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported righthip 1 and driver emit custom_capabilities.right_control.righthip.idle({ visibility = { displayed = false }})", - function() - local attr_report_data = { - { 0x0005, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.righthip.idle({ visibility = { displayed = false }}))) - end -) - -test.register_coroutine_test( - "Device reported leftBackHardness 1 and driver emit custom_capabilities.mattressHardness.leftBackHardness(1)", - function() - local attr_report_data = { - { 0x000C, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.mattressHardness.leftBackHardness(1))) - end -) - -test.register_coroutine_test( - "Device reported leftWaistHardness 1 and driver emit custom_capabilities.mattressHardness.leftWaistHardness(1)", - function() - local attr_report_data = { - { 0x000D, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.mattressHardness.leftWaistHardness(1))) - end -) - -test.register_coroutine_test( - "Device reported leftHipHardness 1 and driver emit custom_capabilities.mattressHardness.leftHipHardness(1)", - function() - local attr_report_data = { - { 0x000E, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.mattressHardness.leftHipHardness(1))) - end -) - -test.register_coroutine_test( - "Device reported rightBackHardness 1 and driver emit custom_capabilities.mattressHardness.rightBackHardness(1)", - function() - local attr_report_data = { - { 0x000F, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.mattressHardness.rightBackHardness(1))) - end -) - -test.register_coroutine_test( - "Device reported rightWaistHardness 1 and driver emit custom_capabilities.mattressHardness.rightWaistHardness(1)", - function() - local attr_report_data = { - { 0x0010, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.mattressHardness.rightWaistHardness(1))) - end -) - -test.register_coroutine_test( - "Device reported rightHipHardness 1 and driver emit custom_capabilities.mattressHardness.rightHipHardness(1)", - function() - local attr_report_data = { - { 0x0011, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.mattressHardness.rightHipHardness(1))) - end -) - -test.register_coroutine_test( - "Device reported yoga 2 and driver emit custom_capabilities.yoga.state.right()", - function() - local attr_report_data = { - { 0x0008, data_types.Uint8.ID, 2 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.yoga.state.right())) - end -) - -test.register_coroutine_test( - "Device reported yoga 1 and driver emit custom_capabilities.yoga.state.left()", - function() - local attr_report_data = { - { 0x0008, data_types.Uint8.ID, 1 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.yoga.state.left())) - end -) - -test.register_coroutine_test( - "Device reported yoga 0 and driver emit custom_capabilities.yoga.state.stop()", - function() - local attr_report_data = { - { 0x0008, data_types.Uint8.ID, 0 } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.yoga.state.stop())) - end -) - -test.register_coroutine_test( - "Device reported ai_mode left false and driver emit custom_capabilities.ai_mode.left.off()", - function() - local attr_report_data = { - { 0x0006, data_types.Boolean.ID, false } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.ai_mode.left.off())) - end -) - -test.register_coroutine_test( - "Device reported ai_mode left true and driver emit custom_capabilities.ai_mode.left.on()", - function() - local attr_report_data = { - { 0x0006, data_types.Boolean.ID, true } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.ai_mode.left.on())) - end -) - -test.register_coroutine_test( - "Device reported ai_mode right true and driver emit custom_capabilities.ai_mode.right.on()", - function() - local attr_report_data = { - { 0x0007, data_types.Boolean.ID, true } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.ai_mode.right.on())) - end -) - -test.register_coroutine_test( - "Device reported ai_mode right false and driver emit custom_capabilities.ai_mode.right.off()", - function() - local attr_report_data = { - { 0x0007, data_types.Boolean.ID, false } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.ai_mode.right.off())) - end -) - -test.register_coroutine_test( - "Device reported inflationState false and driver emit custom_capabilities.auto_inflation.inflationState.off()", - function() - local attr_report_data = { - { 0x0009, data_types.Boolean.ID, false } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.auto_inflation.inflationState.off())) - end -) - -test.register_coroutine_test( - "Device reported inflationState true and driver emit custom_capabilities.auto_inflation.inflationState.on()", - function() - local attr_report_data = { - { 0x0009, data_types.Boolean.ID, true } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.auto_inflation.inflationState.on())) - end -) - -test.register_coroutine_test( - "Device reported strong_exp_mode false and driver emit custom_capabilities.strong_exp_mode.expState.off()", - function() - local attr_report_data = { - { 0x000a, data_types.Boolean.ID, false } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.strong_exp_mode.expState.off())) - end -) - -test.register_coroutine_test( - "Device reported strong_exp_mode true and driver emit custom_capabilities.strong_exp_mode.expState.on()", - function() - local attr_report_data = { - { 0x000a, data_types.Boolean.ID, true } - } - test.socket.zigbee:__queue_receive({ - mock_device.id, - zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.strong_exp_mode.expState.on())) - end -) - - -test.register_coroutine_test( - "capability leftControl on and driver send on ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.ai_mode.ID, component = "main", command ="leftControl" , args = {"on"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0006, MFG_CODE, data_types.Boolean, true) - }) - end -) - -test.register_coroutine_test( - "capability leftControl off and driver send off ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.ai_mode.ID, component = "main", command ="leftControl" , args = {"off"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0006, MFG_CODE, data_types.Boolean, false) - }) - end -) - -test.register_coroutine_test( - "capability rightControl on and driver send on ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.ai_mode.ID, component = "main", command ="rightControl" , args = {"on"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0007, MFG_CODE, data_types.Boolean, true) - }) - end -) - -test.register_coroutine_test( - "capability rightControl off and driver send off ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.ai_mode.ID, component = "main", command ="rightControl" , args = {"off"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0007, MFG_CODE, data_types.Boolean, false) - }) - end -) - -test.register_coroutine_test( - "capability auto_inflation stateControl on and driver send on ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.auto_inflation.ID, component = "main", command ="stateControl" , args = {"on"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0009, MFG_CODE, data_types.Boolean, true) - }) - end -) - -test.register_coroutine_test( - "capability auto_inflation stateControl off and driver send off ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.auto_inflation.ID, component = "main", command ="stateControl" , args = {"off"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0009, MFG_CODE, data_types.Boolean, false) - }) - end -) - -test.register_coroutine_test( - "capability strong_exp_mode stateControl on and driver send on ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.strong_exp_mode.ID, component = "main", command ="stateControl" , args = {"on"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x000a, MFG_CODE, data_types.Boolean, true) - }) - end -) - -test.register_coroutine_test( - "capability strong_exp_mode stateControl off and driver send off ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.strong_exp_mode.ID, component = "main", command ="stateControl" , args = {"off"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x000a, MFG_CODE, data_types.Boolean, false) - }) - end -) - -test.register_coroutine_test( - "capability left_control backControl soft and driver send soft ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.left_control.ID, component = "main", command ="backControl" , args = {"soft"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0000, MFG_CODE, data_types.Uint8, 0) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.leftback.soft())) - end -) - -test.register_coroutine_test( - "capability waistControl backControl soft and driver send soft ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.left_control.ID, component = "main", command ="waistControl" , args = {"soft"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0001, MFG_CODE, data_types.Uint8, 0) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.leftwaist.soft())) - end -) - -test.register_coroutine_test( - "capability left_control hipControl soft and driver send soft ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.left_control.ID, component = "main", command ="hipControl" , args = {"soft"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0002, MFG_CODE, data_types.Uint8, 0) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.lefthip.soft())) - end -) - -test.register_coroutine_test( - "capability left_control backControl hard and driver send hard ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.left_control.ID, component = "main", command ="backControl" , args = {"hard"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0000, MFG_CODE, data_types.Uint8, 1) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.leftback.hard())) - end -) - -test.register_coroutine_test( - "capability waistControl backControl hard and driver send hard ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.left_control.ID, component = "main", command ="waistControl" , args = {"hard"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0001, MFG_CODE, data_types.Uint8, 1) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.leftwaist.hard())) - end -) - -test.register_coroutine_test( - "capability left_control hipControl hard and driver send hard ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.left_control.ID, component = "main", command ="hipControl" , args = {"hard"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0002, MFG_CODE, data_types.Uint8, 1) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.left_control.lefthip.hard())) - end -) - -test.register_coroutine_test( - "capability right_control backControl soft and driver send soft ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.right_control.ID, component = "main", command ="backControl" , args = {"soft"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0003, MFG_CODE, data_types.Uint8, 0) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.rightback.soft())) - end -) - -test.register_coroutine_test( - "capability right_control waistControl soft and driver send soft ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.right_control.ID, component = "main", command ="waistControl" , args = {"soft"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0004, MFG_CODE, data_types.Uint8, 0) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.rightwaist.soft())) - end -) - -test.register_coroutine_test( - "capability right_control hipControl soft and driver send soft ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.right_control.ID, component = "main", command ="hipControl" , args = {"soft"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0005, MFG_CODE, data_types.Uint8, 0) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.righthip.soft())) - end -) - -test.register_coroutine_test( - "capability right_control backControl hard and driver send hard ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.right_control.ID, component = "main", command ="backControl" , args = {"hard"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0003, MFG_CODE, data_types.Uint8, 1) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.rightback.hard())) - end -) - -test.register_coroutine_test( - "capability right_control waistControl hard and driver send hard ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.right_control.ID, component = "main", command ="waistControl" , args = {"hard"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0004, MFG_CODE, data_types.Uint8, 1) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.rightwaist.hard())) - end -) - -test.register_coroutine_test( - "capability right_control hipControl hard and driver send hard ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.right_control.ID, component = "main", command ="hipControl" , args = {"hard"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0005, MFG_CODE, data_types.Uint8, 1) - }) - test.socket.capability:__expect_send(mock_device:generate_test_message("main", - custom_capabilities.right_control.righthip.hard())) - end -) - -test.register_coroutine_test( - "capability yoga stateControl left and driver send left ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.yoga.ID, component = "main", command ="stateControl" , args = {"left"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0008, MFG_CODE, data_types.Uint8, 1) - }) - end -) - -test.register_coroutine_test( - "capability yoga stateControl right and driver send right ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.yoga.ID, component = "main", command ="stateControl" , args = {"right"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0008, MFG_CODE, data_types.Uint8, 2) - }) - end -) - -test.register_coroutine_test( - "capability yoga stateControl stop and driver send stop ", - function() - test.socket.capability:__queue_receive({ - mock_device.id, - { capability = custom_capabilities.yoga.ID, component = "main", command ="stateControl" , args = {"stop"}} - }) - test.socket.zigbee:__expect_send({ mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, - 0x0008, MFG_CODE, data_types.Uint8, 0) - }) - end -) - -test.run_registered_tests() +-- Copyright 2024 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +-- Mock out globals +local test = require "integration_test" +local cluster_base = require "st.zigbee.cluster_base" +local data_types = require "st.zigbee.data_types" +local t_utils = require "integration_test.utils" +local zigbee_test_utils = require "integration_test.zigbee_test_utils" +local custom_capabilities = require "shus-mattress/custom_capabilities" + +local shus_mattress_profile_def = t_utils.get_profile_definition("shus-smart-mattress.yml") +test.add_package_capability("aiMode.yaml") +test.add_package_capability("autoInflation.yaml") +test.add_package_capability("leftControl.yaml") +test.add_package_capability("rightControl.yaml") +test.add_package_capability("strongExpMode.yaml") +test.add_package_capability("yoga.yaml") +test.add_package_capability("mattressHardness.yaml") + +local PRIVATE_CLUSTER_ID = 0xFCC2 +local MFG_CODE = 0x1235 + +local mock_device = test.mock_device.build_test_zigbee_device( +{ + label = "Shus Smart Mattress", + profile = shus_mattress_profile_def, + zigbee_endpoints = { + [1] = { + id = 1, + manufacturer = "SHUS", + model = "SX-1", + server_clusters = { 0x0000,PRIVATE_CLUSTER_ID } + } + } +}) + +zigbee_test_utils.prepare_zigbee_env_info() +local function test_init() + test.mock_device.add_test_device(mock_device) + zigbee_test_utils.init_noop_health_check_timer() +end + +test.set_test_init_function(test_init) + +test.register_coroutine_test( + "lifecycle - added test", + function() + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.yoga.supportedYogaState({"stop", "left", "right"}, { visibility = { displayed = false }}) )) + local read_0x0006_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0006, MFG_CODE) + local read_0x0007_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0007, MFG_CODE) + local read_0x0009_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0009, MFG_CODE) + local read_0x000a_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000a, MFG_CODE) + local read_0x0000_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE) + local read_0x0001_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0001, MFG_CODE) + local read_0x0002_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0002, MFG_CODE) + local read_0x0003_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0003, MFG_CODE) + local read_0x0004_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0004, MFG_CODE) + local read_0x0005_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0005, MFG_CODE) + local read_0x0008_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0008, MFG_CODE) + local read_0x000C_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000C, MFG_CODE) + local read_0x000D_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000D, MFG_CODE) + local read_0x000E_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000E, MFG_CODE) + local read_0x000F_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000F, MFG_CODE) + local read_0x0010_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0010, MFG_CODE) + local read_0x0011_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0011, MFG_CODE) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0006_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0007_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0009_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000a_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0000_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0001_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0002_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0003_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0004_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0005_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0008_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000C_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000D_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000E_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000F_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0010_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0011_messge}) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability - refresh", + function() + test.socket.capability:__queue_receive({ mock_device.id, + { capability = "refresh", component = "main", command = "refresh", args = {} } }) + local read_0x0006_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0006, MFG_CODE) + local read_0x0007_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0007, MFG_CODE) + local read_0x0009_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0009, MFG_CODE) + local read_0x000a_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000a, MFG_CODE) + local read_0x0000_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE) + local read_0x0001_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0001, MFG_CODE) + local read_0x0002_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0002, MFG_CODE) + local read_0x0003_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0003, MFG_CODE) + local read_0x0004_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0004, MFG_CODE) + local read_0x0005_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0005, MFG_CODE) + local read_0x0008_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0008, MFG_CODE) + local read_0x000C_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000C, MFG_CODE) + local read_0x000D_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000D, MFG_CODE) + local read_0x000E_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000E, MFG_CODE) + local read_0x000F_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x000F, MFG_CODE) + local read_0x0010_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0010, MFG_CODE) + local read_0x0011_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0011, MFG_CODE) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0006_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0007_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0009_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000a_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0000_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0001_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0002_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0003_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0004_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0005_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0008_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000C_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000D_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000E_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x000F_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0010_messge}) + test.socket.zigbee:__expect_send({mock_device.id, read_0x0011_messge}) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported leftback 0 and driver emit custom_capabilities.left_control.leftback.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0000, data_types.Uint8.ID, 0 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftback.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported leftback 1 and driver emit custom_capabilities.left_control.leftback.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0000, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftback.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported leftwaist 0 and driver emit custom_capabilities.left_control.leftwaist.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0001, data_types.Uint8.ID, 0 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftwaist.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported leftwaist 1 and driver emit custom_capabilities.left_control.leftwaist.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0001, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftwaist.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported lefthip 0 and driver emit custom_capabilities.left_control.lefthip.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0002, data_types.Uint8.ID, 0 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.lefthip.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported lefthip 1 and driver emit custom_capabilities.left_control.lefthip.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0002, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.lefthip.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported rightback 0 and driver emit custom_capabilities.right_control.rightback.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0003, data_types.Uint8.ID, 0 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.rightback.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported rightback 1 and driver emit custom_capabilities.right_control.rightback.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0003, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.rightback.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported rightwaist 0 and driver emit custom_capabilities.right_control.rightwaist.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0004, data_types.Uint8.ID, 0 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.rightwaist.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported rightwaist 1 and driver emit custom_capabilities.right_control.rightwaist.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0004, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.rightwaist.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported righthip 0 and driver emit custom_capabilities.right_control.righthip.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0005, data_types.Uint8.ID, 0 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.righthip.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported righthip 1 and driver emit custom_capabilities.right_control.righthip.idle({ visibility = { displayed = false }})", + function() + local attr_report_data = { + { 0x0005, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.righthip.idle({ visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported leftBackHardness 1 and driver emit custom_capabilities.mattressHardness.leftBackHardness(1)", + function() + local attr_report_data = { + { 0x000C, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.mattressHardness.leftBackHardness(1))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported leftWaistHardness 1 and driver emit custom_capabilities.mattressHardness.leftWaistHardness(1)", + function() + local attr_report_data = { + { 0x000D, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.mattressHardness.leftWaistHardness(1))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported leftHipHardness 1 and driver emit custom_capabilities.mattressHardness.leftHipHardness(1)", + function() + local attr_report_data = { + { 0x000E, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.mattressHardness.leftHipHardness(1))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported rightBackHardness 1 and driver emit custom_capabilities.mattressHardness.rightBackHardness(1)", + function() + local attr_report_data = { + { 0x000F, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.mattressHardness.rightBackHardness(1))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported rightWaistHardness 1 and driver emit custom_capabilities.mattressHardness.rightWaistHardness(1)", + function() + local attr_report_data = { + { 0x0010, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.mattressHardness.rightWaistHardness(1))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported rightHipHardness 1 and driver emit custom_capabilities.mattressHardness.rightHipHardness(1)", + function() + local attr_report_data = { + { 0x0011, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.mattressHardness.rightHipHardness(1))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported yoga 3 and driver emit custom_capabilities.yoga.state.both()", + function() + local attr_report_data = { + { 0x0008, data_types.Uint8.ID, 3 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.yoga.state.both())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported yoga 2 and driver emit custom_capabilities.yoga.state.right()", + function() + local attr_report_data = { + { 0x0008, data_types.Uint8.ID, 2 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.yoga.state.right())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported yoga 1 and driver emit custom_capabilities.yoga.state.left()", + function() + local attr_report_data = { + { 0x0008, data_types.Uint8.ID, 1 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.yoga.state.left())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported yoga 0 and driver emit custom_capabilities.yoga.state.stop()", + function() + local attr_report_data = { + { 0x0008, data_types.Uint8.ID, 0 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.yoga.state.stop())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported ai_mode left false and driver emit custom_capabilities.ai_mode.left.off()", + function() + local attr_report_data = { + { 0x0006, data_types.Boolean.ID, false } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.ai_mode.left.off())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported ai_mode left true and driver emit custom_capabilities.ai_mode.left.on()", + function() + local attr_report_data = { + { 0x0006, data_types.Boolean.ID, true } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.ai_mode.left.on())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported ai_mode right true and driver emit custom_capabilities.ai_mode.right.on()", + function() + local attr_report_data = { + { 0x0007, data_types.Boolean.ID, true } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.ai_mode.right.on())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported ai_mode right false and driver emit custom_capabilities.ai_mode.right.off()", + function() + local attr_report_data = { + { 0x0007, data_types.Boolean.ID, false } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.ai_mode.right.off())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported inflationState false and driver emit custom_capabilities.auto_inflation.inflationState.off()", + function() + local attr_report_data = { + { 0x0009, data_types.Boolean.ID, false } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.auto_inflation.inflationState.off())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported inflationState true and driver emit custom_capabilities.auto_inflation.inflationState.on()", + function() + local attr_report_data = { + { 0x0009, data_types.Boolean.ID, true } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.auto_inflation.inflationState.on())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported strong_exp_mode false and driver emit custom_capabilities.strong_exp_mode.expState.off()", + function() + local attr_report_data = { + { 0x000a, data_types.Boolean.ID, false } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.strong_exp_mode.expState.off())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Device reported strong_exp_mode true and driver emit custom_capabilities.strong_exp_mode.expState.on()", + function() + local attr_report_data = { + { 0x000a, data_types.Boolean.ID, true } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.strong_exp_mode.expState.on())) + end, + { + min_api_version = 19 + } +) + + +test.register_coroutine_test( + "capability leftControl on and driver send on ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.ai_mode.ID, component = "main", command ="leftControl" , args = {"on"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0006, MFG_CODE, data_types.Boolean, true) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability leftControl off and driver send off ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.ai_mode.ID, component = "main", command ="leftControl" , args = {"off"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0006, MFG_CODE, data_types.Boolean, false) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability rightControl on and driver send on ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.ai_mode.ID, component = "main", command ="rightControl" , args = {"on"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0007, MFG_CODE, data_types.Boolean, true) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability rightControl off and driver send off ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.ai_mode.ID, component = "main", command ="rightControl" , args = {"off"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0007, MFG_CODE, data_types.Boolean, false) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability auto_inflation stateControl on and driver send on ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.auto_inflation.ID, component = "main", command ="stateControl" , args = {"on"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0009, MFG_CODE, data_types.Boolean, true) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability auto_inflation stateControl off and driver send off ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.auto_inflation.ID, component = "main", command ="stateControl" , args = {"off"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0009, MFG_CODE, data_types.Boolean, false) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability strong_exp_mode stateControl on and driver send on ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.strong_exp_mode.ID, component = "main", command ="stateControl" , args = {"on"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x000a, MFG_CODE, data_types.Boolean, true) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability strong_exp_mode stateControl off and driver send off ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.strong_exp_mode.ID, component = "main", command ="stateControl" , args = {"off"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x000a, MFG_CODE, data_types.Boolean, false) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability left_control backControl soft and driver send soft ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.left_control.ID, component = "main", command ="backControl" , args = {"soft"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0000, MFG_CODE, data_types.Uint8, 0) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftback.soft())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability waistControl backControl soft and driver send soft ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.left_control.ID, component = "main", command ="waistControl" , args = {"soft"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0001, MFG_CODE, data_types.Uint8, 0) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftwaist.soft())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability left_control hipControl soft and driver send soft ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.left_control.ID, component = "main", command ="hipControl" , args = {"soft"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0002, MFG_CODE, data_types.Uint8, 0) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.lefthip.soft())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability left_control backControl hard and driver send hard ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.left_control.ID, component = "main", command ="backControl" , args = {"hard"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0000, MFG_CODE, data_types.Uint8, 1) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftback.hard())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability waistControl backControl hard and driver send hard ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.left_control.ID, component = "main", command ="waistControl" , args = {"hard"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0001, MFG_CODE, data_types.Uint8, 1) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftwaist.hard())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability left_control hipControl hard and driver send hard ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.left_control.ID, component = "main", command ="hipControl" , args = {"hard"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0002, MFG_CODE, data_types.Uint8, 1) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.lefthip.hard())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability right_control backControl soft and driver send soft ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.right_control.ID, component = "main", command ="backControl" , args = {"soft"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0003, MFG_CODE, data_types.Uint8, 0) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.rightback.soft())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability right_control waistControl soft and driver send soft ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.right_control.ID, component = "main", command ="waistControl" , args = {"soft"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0004, MFG_CODE, data_types.Uint8, 0) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.rightwaist.soft())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability right_control hipControl soft and driver send soft ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.right_control.ID, component = "main", command ="hipControl" , args = {"soft"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0005, MFG_CODE, data_types.Uint8, 0) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.righthip.soft())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability right_control backControl hard and driver send hard ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.right_control.ID, component = "main", command ="backControl" , args = {"hard"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0003, MFG_CODE, data_types.Uint8, 1) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.rightback.hard())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability right_control waistControl hard and driver send hard ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.right_control.ID, component = "main", command ="waistControl" , args = {"hard"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0004, MFG_CODE, data_types.Uint8, 1) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.rightwaist.hard())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability right_control hipControl hard and driver send hard ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.right_control.ID, component = "main", command ="hipControl" , args = {"hard"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0005, MFG_CODE, data_types.Uint8, 1) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.right_control.righthip.hard())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability yoga stateControl left and driver send left ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.yoga.ID, component = "main", command ="stateControl" , args = {"left"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0008, MFG_CODE, data_types.Uint8, 1) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability yoga stateControl right and driver send right ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.yoga.ID, component = "main", command ="stateControl" , args = {"right"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0008, MFG_CODE, data_types.Uint8, 2) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability yoga stateControl stop and driver send stop ", + function() + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.yoga.ID, component = "main", command ="stateControl" , args = {"stop"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0008, MFG_CODE, data_types.Uint8, 0) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "capability left_control backControl soft emits idle event after delay", + function() + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = custom_capabilities.left_control.ID, component = "main", command ="backControl" , args = {"soft"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + 0x0000, MFG_CODE, data_types.Uint8, 0) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftback.soft())) + test.wait_for_events() + + test.mock_time.advance_time(1) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + custom_capabilities.left_control.leftback("idle", { visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/aqara/init.lua b/drivers/SmartThings/zigbee-button/src/aqara/init.lua index 7467fcfe42..b9545e4721 100644 --- a/drivers/SmartThings/zigbee-button/src/aqara/init.lua +++ b/drivers/SmartThings/zigbee-button/src/aqara/init.lua @@ -85,6 +85,7 @@ local function battery_level_handler(driver, device, value, zb_rx) batteryLevel = "warning" end + -- Note that all aqara buttons use batteryLevel and not battery capability. if device:supports_capability_by_id(capabilities.battery.ID) then device:emit_event(capabilities.battery.battery(calc_battery_percentage(voltage))) elseif device:supports_capability_by_id(capabilities.batteryLevel.ID) then diff --git a/drivers/SmartThings/zigbee-button/src/test/test_SLED_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_SLED_button.lua index cfbd4a6845..6e4ad5793e 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_SLED_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_SLED_button.lua @@ -48,7 +48,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("button3", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -69,7 +72,10 @@ test.register_coroutine_test( mock_device:generate_test_message("button3", button_attr.held({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -81,7 +87,10 @@ test.register_coroutine_test( zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, OnOff.ID) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_aduro_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_aduro_button.lua index 27b8da764b..2d89507a07 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_aduro_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_aduro_button.lua @@ -91,7 +91,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -126,7 +129,10 @@ test.register_coroutine_test( Level.ID, 3) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +177,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_aqara_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_aqara_button.lua index 67314ef651..d15ea394b4 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_aqara_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_aqara_button.lua @@ -21,6 +21,21 @@ local PRIVATE_ATTRIBUTE_ID_ALIVE = 0x00F7 local MODE_CHANGE = "stse.allowOperationModeChange" local COMP_LIST = { "button1", "button2", "all" } + +local mock_device_h1_single = test.mock_device.build_test_zigbee_device( + { + profile = t_utils.get_profile_definition("aqara-single-button-mode.yml"), + zigbee_endpoints = { + [1] = { + id = 1, + manufacturer = "LUMI", + model = "lumi.remote.b18ac1", + server_clusters = { 0x0001, 0x0012 } + } + } + } +) + local mock_device_e1 = test.mock_device.build_test_zigbee_device( { profile = t_utils.get_profile_definition("one-button-batteryLevel.yml"), @@ -51,6 +66,7 @@ local mock_device_h1_double_rocker = test.mock_device.build_test_zigbee_device( zigbee_test_utils.prepare_zigbee_env_info() local function test_init() + test.mock_device.add_test_device(mock_device_h1_single) test.mock_device.add_test_device(mock_device_e1) test.mock_device.add_test_device(mock_device_h1_double_rocker) end @@ -81,7 +97,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message(COMP_LIST[i], capabilities.button.button.pushed({ state_change = false }))) end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -110,7 +129,10 @@ test.register_coroutine_test( MFG_CODE, data_types.Uint8, 2) }) mock_device_e1:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) @@ -142,7 +164,10 @@ test.register_coroutine_test( PRIVATE_ATTRIBUTE_ID_T1, MFG_CODE, data_types.Uint8, 1) }) mock_device_h1_double_rocker:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -160,7 +185,10 @@ test.register_coroutine_test( capabilities.button.button.pushed({ state_change = true }))) test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message("button1", capabilities.button.button.pushed({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -178,7 +206,10 @@ test.register_coroutine_test( capabilities.button.button.double({ state_change = true }))) test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message("button1", capabilities.button.button.double({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -196,7 +227,10 @@ test.register_coroutine_test( capabilities.button.button.held({ state_change = true }))) test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message("button1", capabilities.button.button.held({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -212,6 +246,9 @@ test.register_message_test( direction = "send", message = mock_device_e1:generate_test_message("main", capabilities.batteryLevel.battery("normal")) } + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -227,6 +264,9 @@ test.register_message_test( direction = "send", message = mock_device_e1:generate_test_message("main", capabilities.batteryLevel.battery("warning")) } + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -242,6 +282,9 @@ test.register_message_test( direction = "send", message = mock_device_e1:generate_test_message("main", capabilities.batteryLevel.battery("critical")) } + }, + { + min_api_version = 19 } ) @@ -283,7 +326,32 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message(COMP_LIST[i], capabilities.button.button.pushed({ state_change = false }))) end - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Handle added lifecycle - H1 single rocker (sets mode=1)", + function() + test.socket.device_lifecycle:__queue_receive({ mock_device_h1_single.id, "added" }) + test.socket.capability:__expect_send(mock_device_h1_single:generate_test_message("main", + capabilities.button.supportedButtonValues({ "pushed" }, { visibility = { displayed = false } }))) + test.socket.capability:__expect_send(mock_device_h1_single:generate_test_message("main", + capabilities.button.numberOfButtons({ value = 1 }))) + test.socket.capability:__expect_send(mock_device_h1_single:generate_test_message("main", + capabilities.button.button.pushed({ state_change = false }))) + test.socket.capability:__expect_send(mock_device_h1_single:generate_test_message("main", + capabilities.batteryLevel.battery.normal())) + test.socket.capability:__expect_send(mock_device_h1_single:generate_test_message("main", + capabilities.batteryLevel.type("CR2450"))) + test.socket.capability:__expect_send(mock_device_h1_single:generate_test_message("main", + capabilities.batteryLevel.quantity(1))) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_centralite_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_centralite_button.lua index c8d5ff87ae..f1e0b28ebd 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_centralite_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_centralite_button.lua @@ -93,7 +93,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) @@ -147,7 +150,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", button_attr.held({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -183,7 +189,10 @@ test.register_coroutine_test( OnOff.attributes.OnOff:configure_reporting(mock_device, 0, 600, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -194,7 +203,10 @@ test.register_coroutine_test( mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -239,7 +251,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_dimming_remote.lua b/drivers/SmartThings/zigbee-button/src/test/test_dimming_remote.lua index c552322c9b..d04587e2f0 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_dimming_remote.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_dimming_remote.lua @@ -53,7 +53,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -81,7 +84,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -109,7 +115,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.held({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -148,7 +157,10 @@ test.register_coroutine_test( ) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -159,7 +171,10 @@ test.register_coroutine_test( mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -258,7 +273,10 @@ test.register_coroutine_test( mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_ewelink_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_ewelink_button.lua index 5562eced88..43d6f95d84 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_ewelink_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_ewelink_button.lua @@ -62,7 +62,10 @@ test.register_coroutine_test( mock_device.id, TemperatureMeasurement.attributes.MinMeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -74,7 +77,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, PowerConfiguration.ID) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:configure_reporting(mock_device, 30, 21600, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -87,7 +93,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button.button.double({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -100,7 +109,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button.button.held({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -137,7 +149,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button.button.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_ezviz_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_ezviz_button.lua index be613bbc14..53242a2e2c 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_ezviz_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_ezviz_button.lua @@ -53,6 +53,9 @@ test.register_message_test( direction = "send", message = mock_device_ezviz_button:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -94,6 +97,9 @@ test.register_message_test( direction = "send", message = mock_device_ezviz_button:generate_test_message("main", capabilities.button.button.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -110,6 +116,9 @@ test.register_message_test( direction = "send", message = mock_device_ezviz_button:generate_test_message("main", capabilities.button.button.double({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -126,6 +135,9 @@ test.register_message_test( direction = "send", message = mock_device_ezviz_button:generate_test_message("main", capabilities.button.button.held({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -159,7 +171,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_send({ mock_device_ezviz_button.id, ZoneStatusAttribute:read(mock_device_ezviz_button) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -182,7 +197,10 @@ test.register_coroutine_test( mock_device_ezviz_button:generate_test_message("main", capabilities.button.button.pushed({ state_change = false })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_frient_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_frient_button.lua index aa6f211d65..0204586c8a 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_frient_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_frient_button.lua @@ -86,6 +86,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -108,7 +111,11 @@ test.register_message_test("Refresh should read all necessary attributes", { direction = "send", message = {mock_device.id, BasicInput.attributes.PresentValue:read(mock_device)} }, -}) +}, +{ + min_api_version = 19 +} +) test.register_coroutine_test("panicAlarm should be triggered and cleared", function() @@ -140,7 +147,11 @@ test.register_coroutine_test("panicAlarm should be triggered and cleared", funct test.socket.capability:__expect_send(mock_device_panic:generate_test_message("main", panicAlarm.clear({value = "clear", state_change = true}))) test.wait_for_events() -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test( "Battery Voltage test cases", @@ -171,7 +182,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed"}, {visibility = { displayed = false }}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.numberOfButtons({value = 1}))) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -210,7 +224,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, BasicInput.ID, 0x8000, DEVELCO_MANUFACTURER_CODE, data_types.Uint16, 65535):to_endpoint(0x20)}) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test("info_changed for OnOff cluster attributes should run properly", @@ -234,7 +251,11 @@ function() buttonDelay_msg.body.zcl_header.frame_ctrl.value = 0x0C buttonDelay_msg.address_header.dest_endpoint.value = 0x20 test.socket.zigbee:__expect_send({mock_device.id, buttonDelay_msg}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test(" Configuration and Switching to button-profile-panic-frient deviceProfile should be triggered", function() test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") @@ -263,7 +284,11 @@ test.register_coroutine_test(" Configuration and Switching to button-profile-pan end -- Unable to check if the emit went through successfully due to the framework limitations in swapping mock device's deviceProfile --test.socket.capability:__expect_send({mock_device.id, capabilities.panicAlarm.panicAlarm.clear({state_change = true})}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Switching from button-profile-panic-frient to button-profile-frient should work", function() test.socket.device_lifecycle:__queue_receive(mock_device_panic:generate_info_changed( @@ -275,7 +300,11 @@ test.register_coroutine_test("Switching from button-profile-panic-frient to butt )) mock_device_panic:expect_metadata_update({ profile = "button-profile-frient" }) test.socket.zigbee:__expect_send({mock_device_panic.id, cluster_base.write_manufacturer_specific_attribute(mock_device_panic,BasicInput.ID,0x8000,DEVELCO_MANUFACTURER_CODE,data_types.Uint16,0xFFFF)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("New preferences after switching the profile should work", function() test.socket.zigbee:__set_channel_ordering("relaxed") @@ -293,6 +322,10 @@ test.register_coroutine_test("New preferences after switching the profile should test.socket.zigbee:__expect_send({mock_device_panic.id, cluster_base.write_manufacturer_specific_attribute(mock_device_panic, IASZone.ID,0x8003,DEVELCO_MANUFACTURER_CODE,data_types.Uint16, 300)}) test.socket.zigbee:__expect_send({mock_device_panic.id, cluster_base.write_manufacturer_specific_attribute(mock_device_panic, IASZone.ID,0x8004,DEVELCO_MANUFACTURER_CODE,data_types.Uint16, 20)}) test.socket.zigbee:__expect_send({mock_device_panic.id, cluster_base.write_manufacturer_specific_attribute(mock_device_panic, IASZone.ID,0x8005,DEVELCO_MANUFACTURER_CODE,data_types.Enum8, 1)}) -end) +end, +{ + min_api_version = 19 +} +) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_heiman_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_heiman_button.lua index 0cc2c734cf..6761cf263c 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_heiman_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_heiman_button.lua @@ -90,7 +90,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -122,7 +125,10 @@ test.register_coroutine_test( mock_device_hs6ssb:generate_test_message("main", button_attr.pushed({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -166,7 +172,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_add_hub_to_group(0x0011) test.socket.zigbee:__expect_add_hub_to_group(0x0012) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -187,7 +196,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_add_hub_to_group(0x0012) test.socket.zigbee:__expect_add_hub_to_group(0x0013) mock_device_hs6ssb:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -265,7 +277,10 @@ test.register_coroutine_test( Basic.attributes.DeviceEnabled:write(mock_device, true) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -296,7 +311,10 @@ test.register_coroutine_test( Basic.attributes.DeviceEnabled:write(mock_device_hs6ssb, true) }) mock_device_hs6ssb:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -341,7 +359,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -386,7 +407,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device_hs6ssb.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_ikea_on_off.lua b/drivers/SmartThings/zigbee-button/src/test/test_ikea_on_off.lua index 82f477f426..87e225ae16 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_ikea_on_off.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_ikea_on_off.lua @@ -73,7 +73,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.held({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -114,7 +117,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -135,7 +141,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_add_hub_to_group(0xB9F2) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -194,7 +203,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, Groups.commands.AddGroup(mock_device, 0x0000) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -290,7 +302,10 @@ test.register_coroutine_test( PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_ikea_open_close.lua b/drivers/SmartThings/zigbee-button/src/test/test_ikea_open_close.lua index 3d5c7ab58d..a3eb2ef195 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_ikea_open_close.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_ikea_open_close.lua @@ -53,7 +53,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", (button_attr.pushed({ state_change = true }))) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -95,7 +98,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -116,7 +122,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_add_hub_to_group(0xB9F2) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -138,7 +147,10 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_add_hub_to_group(0x0000) test.socket.zigbee:__expect_send({mock_device.id, Groups.commands.AddGroup(mock_device, 0x0000) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -233,7 +245,10 @@ test.register_coroutine_test( PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_ikea_remote_control.lua b/drivers/SmartThings/zigbee-button/src/test/test_ikea_remote_control.lua index ef08a1d7e5..6c77739952 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_ikea_remote_control.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_ikea_remote_control.lua @@ -107,7 +107,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", (button_attr.held({ state_change = true }))) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -149,7 +152,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +177,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_add_hub_to_group(0xB9F2) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -275,7 +284,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -291,6 +303,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(55)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-button/src/test/test_iris_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_iris_button.lua index 64630415a0..88fae6eeb2 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_iris_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_iris_button.lua @@ -45,7 +45,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -58,7 +61,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.held({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -97,7 +103,10 @@ test.register_coroutine_test( IASZone.server.commands.ZoneEnrollResponse(mock_device, IasEnrollResponseCode.SUCCESS, 0x00) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -112,7 +121,10 @@ test.register_coroutine_test( mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +175,10 @@ test.register_coroutine_test( mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -181,7 +196,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -199,7 +217,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.held({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -217,7 +238,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -235,7 +259,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.held({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_linxura_aura_smart_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_linxura_aura_smart_button.lua index 8e3ff6e001..244969abbb 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_linxura_aura_smart_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_linxura_aura_smart_button.lua @@ -55,7 +55,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -71,7 +74,10 @@ test.register_coroutine_test( ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -87,7 +93,10 @@ test.register_coroutine_test( ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) @@ -104,7 +113,10 @@ test.register_coroutine_test( ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-button/src/test/test_linxura_smart_controller_4x_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_linxura_smart_controller_4x_button.lua index 27ec0a8e44..2f22a129c4 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_linxura_smart_controller_4x_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_linxura_smart_controller_4x_button.lua @@ -55,7 +55,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -71,7 +74,10 @@ test.register_coroutine_test( ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -87,7 +93,10 @@ test.register_coroutine_test( ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) @@ -104,7 +113,10 @@ test.register_coroutine_test( ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-button/src/test/test_push_only_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_push_only_button.lua index 4af8ef8c3c..218bb10615 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_push_only_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_push_only_button.lua @@ -46,6 +46,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -56,6 +59,9 @@ test.register_message_test( direction = "receive", message = { mock_device.id, ZoneStatusAttribute:build_test_attr_report(mock_device, 0x0000) } } + }, + { + min_api_version = 19 } ) @@ -72,6 +78,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -88,6 +97,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -150,7 +162,10 @@ test.register_coroutine_test( IASZone.attributes.ZoneStatus:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -202,7 +217,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_robb_4x_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_robb_4x_button.lua index 4888ae5f7e..3f0d63d75b 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_robb_4x_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_robb_4x_button.lua @@ -79,7 +79,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -119,6 +122,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.button.button.up_hold({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -161,6 +167,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.button.button.down_hold({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -201,7 +210,10 @@ test.register_coroutine_test( }) test.socket.zigbee:__expect_add_hub_to_group(0xE902) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -312,7 +324,10 @@ test.register_coroutine_test( mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -351,6 +366,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -366,7 +384,10 @@ test.register_coroutine_test( PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_robb_8x_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_robb_8x_button.lua index ebb324a3dc..ac1d7f4362 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_robb_8x_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_robb_8x_button.lua @@ -124,7 +124,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -198,6 +201,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.button.button.up_hold({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -276,6 +282,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.button.button.down_hold({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -318,7 +327,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_add_hub_to_group(0xE903) test.socket.zigbee:__expect_add_hub_to_group(0xE904) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -430,7 +442,10 @@ test.register_coroutine_test( mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -469,6 +484,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -484,7 +502,10 @@ test.register_coroutine_test( PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_samjin_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_samjin_button.lua index 1a23d68d83..4560daa1a0 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_samjin_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_samjin_button.lua @@ -88,7 +88,10 @@ test.register_coroutine_test( IASZone.server.commands.ZoneEnrollResponse(mock_device, IasEnrollResponseCode.SUCCESS, 0x00) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -135,7 +138,10 @@ test.register_coroutine_test( -- mock_device.id, -- IASZone.attributes.ZoneStatus:read(mock_device) -- }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_shinasystem_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_shinasystem_button.lua index 5278edbf8e..a0810072f8 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_shinasystem_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_shinasystem_button.lua @@ -83,7 +83,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) @@ -137,7 +140,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", button_attr.held({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) @@ -191,7 +197,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", button_attr.double({ state_change = true })) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -228,7 +237,10 @@ test.register_coroutine_test( Groups.commands.AddGroup(mock_device, 0x0000) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -273,7 +285,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_somfy_situo_1_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_somfy_situo_1_button.lua index 7e7e155867..f1339d6155 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_somfy_situo_1_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_somfy_situo_1_button.lua @@ -63,7 +63,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -111,7 +114,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -132,7 +138,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_add_hub_to_group(0xB9F2) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -191,7 +200,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, Groups.commands.AddGroup(mock_device, 0x0000) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -236,7 +248,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-button/src/test/test_somfy_situo_4_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_somfy_situo_4_button.lua index d358db3fcc..2422763c25 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_somfy_situo_4_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_somfy_situo_4_button.lua @@ -92,7 +92,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -158,7 +161,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("button11", (button_attr.pushed({ state_change = true }))) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -179,7 +185,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_add_hub_to_group(0xB9F2) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -224,7 +233,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-button/src/test/test_thirdreality_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_thirdreality_button.lua index a102e30e51..560f59940e 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_thirdreality_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_thirdreality_button.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( capabilities.button.numberOfButtons({ value = 1 }, { visibility = { displayed = false } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -60,7 +63,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0x0012, attr_report_data, 0x110A) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -74,7 +80,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0x0012, attr_report_data, 0x110A) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.double({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -88,7 +97,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0x0012, attr_report_data, 0x110A) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.held({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_vimar_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_vimar_button.lua index 575175aa47..3e8fc77797 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_vimar_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_vimar_button.lua @@ -75,7 +75,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -90,7 +93,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -105,7 +111,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -128,7 +137,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.up({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -151,7 +163,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.up({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -196,7 +211,10 @@ test.register_coroutine_test( end mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_wallhero_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_wallhero_button.lua index 98d8efbdfd..2c95ffe855 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_wallhero_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_wallhero_button.lua @@ -304,7 +304,10 @@ test.register_coroutine_test( test.wait_for_events() test.socket.zigbee:__queue_receive({ mock_device.id, zigbee_test_utils.build_custom_command_id(mock_device, Scenes.ID, Scenes.server.commands.RecallScene.ID, 0x0000, "\x05\x00\x00\x00\x05\x00", 0x1F) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -342,7 +345,10 @@ test.register_coroutine_test( test.socket:set_time_advance_per_select(0.1) test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_zigbee_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_zigbee_button.lua index 92a50636a4..ad7b45ef95 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_zigbee_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_zigbee_button.lua @@ -37,6 +37,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -53,6 +56,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.held({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -69,6 +75,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.double({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -80,6 +89,9 @@ test.register_message_test( direction = "receive", message = { mock_device.id, ZoneStatusAttribute:build_test_attr_report(mock_device, 0x0000) } } + }, + { + min_api_version = 19 } ) @@ -96,6 +108,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -112,6 +127,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.held({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -128,6 +146,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", button_attr.double({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -144,6 +165,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -161,6 +185,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -184,6 +211,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -264,7 +294,10 @@ test.register_coroutine_test( TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -338,7 +371,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_zigbee_ecosmart_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_zigbee_ecosmart_button.lua index c6f28dfe44..d14c324ff5 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_zigbee_ecosmart_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_zigbee_ecosmart_button.lua @@ -48,6 +48,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -93,7 +96,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -115,7 +121,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -130,7 +139,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -153,7 +165,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -195,7 +210,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", button_attr.pushed({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -241,7 +259,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_add_hub_to_group(0x4003) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-button/src/test/test_zunzunbee_8_button.lua b/drivers/SmartThings/zigbee-button/src/test/test_zunzunbee_8_button.lua index ae579dd671..eb7e222bcb 100644 --- a/drivers/SmartThings/zigbee-button/src/test/test_zunzunbee_8_button.lua +++ b/drivers/SmartThings/zigbee-button/src/test/test_zunzunbee_8_button.lua @@ -79,7 +79,10 @@ test.register_coroutine_test( }) test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -137,7 +140,10 @@ test.register_coroutine_test( IASZone.server.commands.ZoneEnrollResponse(mock_device, IasEnrollResponseCode.SUCCESS, 0x00) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -162,7 +168,10 @@ test.register_coroutine_test( ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) @@ -188,7 +197,10 @@ test.register_coroutine_test( ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-carbon-monoxide-detector/src/test/test_climax_technology_carbon_monoxide.lua b/drivers/SmartThings/zigbee-carbon-monoxide-detector/src/test/test_climax_technology_carbon_monoxide.lua index 78164924d0..9e74007faa 100644 --- a/drivers/SmartThings/zigbee-carbon-monoxide-detector/src/test/test_climax_technology_carbon_monoxide.lua +++ b/drivers/SmartThings/zigbee-carbon-monoxide-detector/src/test/test_climax_technology_carbon_monoxide.lua @@ -41,7 +41,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-carbon-monoxide-detector/src/test/test_zigbee_carbon_monoxide.lua b/drivers/SmartThings/zigbee-carbon-monoxide-detector/src/test/test_zigbee_carbon_monoxide.lua index 07933958de..abbe814c8e 100644 --- a/drivers/SmartThings/zigbee-carbon-monoxide-detector/src/test/test_zigbee_carbon_monoxide.lua +++ b/drivers/SmartThings/zigbee-carbon-monoxide-detector/src/test/test_zigbee_carbon_monoxide.lua @@ -42,6 +42,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "carbonMonoxideDetector", capability_attr_id = "carbonMonoxide" } } }, + }, + { + min_api_version = 19 } ) @@ -66,6 +69,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "carbonMonoxideDetector", capability_attr_id = "carbonMonoxide" } } }, + }, + { + min_api_version = 19 } ) @@ -91,6 +97,9 @@ test.register_message_test( } }, + }, + { + min_api_version = 19 } ) @@ -115,6 +124,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "carbonMonoxideDetector", capability_attr_id = "carbonMonoxide" } } }, + }, + { + min_api_version = 19 } ) @@ -131,6 +143,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -199,7 +214,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_aqara_contact_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_aqara_contact_sensor.lua index 7f2dae99fe..4243db2bcf 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_aqara_contact_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_aqara_contact_sensor.lua @@ -64,7 +64,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE , data_types.Uint8, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -85,7 +88,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.batteryLevel.quantity(1))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.batteryLevel.battery("normal"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -100,7 +106,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.batteryLevel.battery("normal"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -115,7 +124,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.batteryLevel.battery("critical"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -130,7 +142,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.batteryLevel.battery("normal"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -145,7 +160,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.batteryLevel.battery("warning"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -160,7 +178,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.batteryLevel.battery("critical"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -175,7 +196,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -190,7 +214,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_aurora_contact_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_aurora_contact_sensor.lua index 46fc40f686..dbb8b48dff 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_aurora_contact_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_aurora_contact_sensor.lua @@ -42,7 +42,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -90,7 +93,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_centralite_multi_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_centralite_multi_sensor.lua index d914712e06..560356b3d4 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_centralite_multi_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_centralite_multi_sensor.lua @@ -106,7 +106,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0xFC02, attr_report_data, 0x110A) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({300, 200, 100})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -129,7 +132,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0xFC02, acceleration_report_inactive, 0x110A) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -162,7 +168,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0xFC02, attr_report_data, 0x110A) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -186,7 +195,10 @@ test.register_coroutine_test( mock_device.id, zigbee_test_utils.build_attribute_read(mock_device, 0xFC02, {0x0010}, 0x104E) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -207,7 +219,10 @@ test.register_coroutine_test( mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -265,7 +280,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -287,7 +305,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -310,7 +331,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device_old_firmware:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_contact_temperature_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_contact_temperature_sensor.lua index 075b923bed..288856d99d 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_contact_temperature_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_contact_temperature_sensor.lua @@ -44,7 +44,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -103,7 +106,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -119,6 +125,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -135,6 +144,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_ecolink_contact.lua b/drivers/SmartThings/zigbee-contact/src/test/test_ecolink_contact.lua index 716828541a..946d7ddad3 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_ecolink_contact.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_ecolink_contact.lua @@ -45,7 +45,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -112,7 +115,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, PollControl.commands.SetLongPollInterval(mock_device, 0xB1040000) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -128,6 +134,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -144,6 +153,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_ewelink_heiman_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_ewelink_heiman_sensor.lua index f983211856..121ac601f2 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_ewelink_heiman_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_ewelink_heiman_sensor.lua @@ -43,7 +43,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -91,7 +94,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor.lua index bd7e7512dd..a7ae12f907 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -130,7 +133,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -146,6 +152,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -162,39 +171,12 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) --- test.register_coroutine_test( --- "Health check should check all relevant attributes", --- function() --- test.wait_for_events() - --- test.mock_time.advance_time(50000) -- battery is 21600 for max reporting interval --- test.socket.zigbee:__set_channel_ordering("relaxed") - --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- PowerConfiguration.attributes.BatteryVoltage:read(mock_device) --- } --- ) - --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- IASZone.attributes.ZoneStatus:read(mock_device) --- } --- ) --- end, --- { --- test_init = function() --- test.mock_device.add_test_device(mock_device) --- test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check") --- end --- } --- ) - test.register_message_test( "Refresh should read all necessary attributes", { @@ -224,7 +206,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -241,6 +224,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -257,6 +243,47 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatusChangeNotification should be handled: contact/open", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0001, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatusChangeNotification should be handled: contact/closed", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0000, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) + } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor_2_pro.lua b/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor_2_pro.lua index 4b0363caba..fe875d95f6 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor_2_pro.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor_2_pro.lua @@ -54,7 +54,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -173,7 +176,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -197,6 +203,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -213,6 +222,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -229,6 +241,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -306,7 +321,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -323,6 +339,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -339,6 +358,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -355,6 +377,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -371,6 +396,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -396,7 +424,10 @@ test.register_coroutine_test( temperatureSensitivity ):to_endpoint(TEMPERATURE_MEASUREMENT_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor_pro.lua b/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor_pro.lua index 6a7876541f..89f1e00d4e 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor_pro.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_frient_contact_sensor_pro.lua @@ -54,7 +54,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -173,7 +176,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -197,6 +203,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -213,6 +222,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -229,6 +241,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -306,7 +321,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -328,6 +344,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -349,6 +368,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -370,6 +392,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -391,6 +416,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -416,7 +444,10 @@ test.register_coroutine_test( temperatureSensitivity ):to_endpoint(TEMPERATURE_MEASUREMENT_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_frient_vibration_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_frient_vibration_sensor.lua index 2e704a61ca..27dca9b220 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_frient_vibration_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_frient_vibration_sensor.lua @@ -298,7 +298,10 @@ test.register_coroutine_test( }) mock_device_contact:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -323,6 +326,9 @@ test.register_message_test( } } } + }, + { + min_api_version = 19 } ) @@ -339,6 +345,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -355,6 +364,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -393,7 +405,10 @@ function() Frient_AccelerationMeasurementCluster.ManufacturerSpecificCode ):to_endpoint(POWER_CONFIGURATION_AND_ACCELERATION_ENDPOINT) }) -end +end, +{ + min_api_version = 19 +} ) test.register_message_test( @@ -414,6 +429,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive(mock_device)) } + }, + { + min_api_version = 19 } ) @@ -435,6 +453,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active(mock_device)) } + }, + { + min_api_version = 19 } ) @@ -454,7 +475,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({300, 200, 100})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -479,7 +503,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device_contact:generate_test_message("main", capabilities.contactSensor.contact.open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -504,7 +531,11 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device_contact:generate_test_message("main", capabilities.contactSensor.contact.closed()) ) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_orvibo_contact_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_orvibo_contact_sensor.lua index 291755bb17..8d75babbb6 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_orvibo_contact_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_orvibo_contact_sensor.lua @@ -42,7 +42,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -90,7 +93,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_samjin_multi_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_samjin_multi_sensor.lua index 2e0c67469d..f564e4dd7e 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_samjin_multi_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_samjin_multi_sensor.lua @@ -93,7 +93,10 @@ test.register_coroutine_test( mock_device.id, zigbee_test_utils.build_attribute_read(mock_device, 0xFC02, {0x0010}, 0x1241) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -114,7 +117,10 @@ test.register_coroutine_test( mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -172,7 +178,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -211,7 +220,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_sengled_contact_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_sengled_contact_sensor.lua index 39f127dcf4..78398bd78e 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_sengled_contact_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_sengled_contact_sensor.lua @@ -42,7 +42,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -90,7 +93,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_smartsense_multi.lua b/drivers/SmartThings/zigbee-contact/src/test/test_smartsense_multi.lua index 035c49d27f..b9d19e6f13 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_smartsense_multi.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_smartsense_multi.lua @@ -5,6 +5,9 @@ local test = require "integration_test" local zigbee_test_utils = require "integration_test.zigbee_test_utils" local t_utils = require "integration_test.utils" local capabilities = require "st.capabilities" +local clusters = require "st.zigbee.zcl.clusters" + +local IASZone = clusters.IASZone local SMARTSENSE_PROFILE_ID = 0xFC01 local MFG_CODE = 0x110A @@ -111,7 +114,10 @@ test.register_coroutine_test( }) test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -126,7 +132,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -141,7 +150,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -156,7 +168,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +186,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -186,7 +204,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -201,7 +222,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -216,7 +240,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -231,7 +258,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -246,7 +276,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(97))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -261,7 +294,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -276,7 +312,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(60))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -291,7 +330,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(0))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -306,7 +348,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(0))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -321,7 +366,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(0))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -333,7 +381,10 @@ test.register_coroutine_test( }) test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({1050, 3, 9})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -345,7 +396,10 @@ test.register_coroutine_test( }) test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({-1050, -3, -9})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -357,7 +411,10 @@ test.register_coroutine_test( }) test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({10, 1020, 7})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -369,7 +426,10 @@ test.register_coroutine_test( }) test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({-10, -1020, -7})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -381,7 +441,10 @@ test.register_coroutine_test( }) test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({116, 4, 1003})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -393,7 +456,10 @@ test.register_coroutine_test( }) test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({-116, -4, -1003})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -423,7 +489,86 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({-116, -4, -826})) ) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatusChangeNotification should generate contact event when garageSensor not set: open", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0001, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatusChangeNotification should generate contact event when garageSensor not set: closed", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0000, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatus attr report should generate contact event when garageSensor not set: open", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0001) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatus attr report should generate contact event when garageSensor not set: closed", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0000) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) + } + }, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_smartthings_multi_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_smartthings_multi_sensor.lua index 5ef40d5aaf..1337e696c2 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_smartthings_multi_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_smartthings_multi_sensor.lua @@ -87,6 +87,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -103,6 +106,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -126,7 +132,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0xFC02, acceleration_report_inactive, 0x110A) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -140,7 +149,10 @@ test.register_coroutine_test( cluster_base.build_test_read_attr_response(attribute_def, mock_device, 1) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -156,7 +168,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0xFC02, attr_report_data, 0x110A) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({300, 100, -200})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -189,7 +204,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0xFC02, attr_report_data, 0x110A) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -216,7 +234,48 @@ test.register_coroutine_test( mock_device.id, ZoneStatusAttribute:build_test_attr_report(mock_device, 0x0001) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatusChangeNotification should generate contact event when garageSensor not set: open", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0001, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatusChangeNotification should generate contact event when garageSensor not set: closed", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0000, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) + } + }, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -240,7 +299,10 @@ test.register_coroutine_test( mock_device.id, zigbee_test_utils.build_attribute_read(mock_device, 0xFC02, {0x0010}, 0x110A) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -261,7 +323,10 @@ test.register_coroutine_test( mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -323,7 +388,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -364,7 +432,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_third_reality_contact.lua b/drivers/SmartThings/zigbee-contact/src/test/test_third_reality_contact.lua index a6d989609f..5e6bb70e7d 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_third_reality_contact.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_third_reality_contact.lua @@ -42,7 +42,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -90,7 +93,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_thirdreality_multi_sensor.lua b/drivers/SmartThings/zigbee-contact/src/test/test_thirdreality_multi_sensor.lua index 24dc80b7b2..74a6375b01 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_thirdreality_multi_sensor.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_thirdreality_multi_sensor.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" local t_utils = require "integration_test.utils" @@ -49,7 +52,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0xFFF1, acceleration_report_inactive, 0x110A) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -63,7 +69,10 @@ test.register_coroutine_test( cluster_base.build_test_read_attr_response(attribute_def, mock_device, 1) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -79,7 +88,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, 0xFFF1, attr_report_data, 0x110A) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.threeAxis.threeAxis({200, 100, 300})) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact.lua b/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact.lua index 8db97fd224..de9f7d97ee 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact.lua @@ -44,6 +44,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "contactSensor", capability_attr_id = "contact" } } }, + }, + { + min_api_version = 19 } ) @@ -68,6 +71,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "contactSensor", capability_attr_id = "contact" } } }, + }, + { + min_api_version = 19 } ) @@ -94,6 +100,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "contactSensor", capability_attr_id = "contact" } } }, + }, + { + min_api_version = 19 } ) @@ -120,6 +129,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "contactSensor", capability_attr_id = "contact" } } }, + }, + { + min_api_version = 19 } ) @@ -145,6 +157,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -168,6 +183,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -185,6 +203,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -227,7 +248,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -318,7 +342,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact_battery.lua b/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact_battery.lua index 5e3404b2a0..4f12bdb22c 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact_battery.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact_battery.lua @@ -86,7 +86,10 @@ test.register_coroutine_test( test.wait_for_events() end end - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -103,6 +106,9 @@ test.register_message_test( direction = "send", message = mock_device_sengled:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -120,6 +126,9 @@ test.register_message_test( direction = "send", message = mock_device_nyce:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact_tyco.lua b/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact_tyco.lua index 0ee62b73ee..62151b9baa 100644 --- a/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact_tyco.lua +++ b/drivers/SmartThings/zigbee-contact/src/test/test_zigbee_contact_tyco.lua @@ -54,7 +54,11 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } + ) test.register_message_test( "Temperature report should be handled (C)", @@ -78,6 +82,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -96,7 +103,11 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" }))) mock_device:expect_native_attr_handler_registration("temperatureMeasurement", "temperature") test.wait_for_events() - end + end, + { + min_api_version = 19 + } + ) diff --git a/drivers/SmartThings/zigbee-dimmer-remote/src/test/test_zigbee_accessory_dimmer.lua b/drivers/SmartThings/zigbee-dimmer-remote/src/test/test_zigbee_accessory_dimmer.lua index 90d29656d8..6c628b7047 100644 --- a/drivers/SmartThings/zigbee-dimmer-remote/src/test/test_zigbee_accessory_dimmer.lua +++ b/drivers/SmartThings/zigbee-dimmer-remote/src/test/test_zigbee_accessory_dimmer.lua @@ -59,6 +59,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -78,6 +81,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -94,6 +100,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -110,6 +119,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -123,7 +135,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, move_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(10))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -136,7 +151,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, move_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(100))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -148,7 +166,10 @@ test.register_coroutine_test( step_command.body.zcl_header.frame_ctrl = frm_ctrl test.socket.zigbee:__queue_receive({ mock_device.id, step_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(90))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -160,7 +181,10 @@ test.register_coroutine_test( step_command.body.zcl_header.frame_ctrl = frm_ctrl test.socket.zigbee:__queue_receive({ mock_device.id, step_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(100))) - end + end, + { + min_api_version = 19 + } ) @@ -174,7 +198,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.held( { state_change = true } ))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -187,7 +214,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.pushed( { state_change = true } ))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -214,7 +244,105 @@ test.register_coroutine_test( Scenes.ID) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "On command when current level is 0 should reset level then toggle switch", + function() + mock_device:set_field("current_level", 0) + test.socket.zigbee:__queue_receive({ mock_device.id, OnOff.server.commands.On.build_test_rx(mock_device) }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(10))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Step command(MoveStepMode.DOWN) to level 0 should emit switch off and level 0", + function() + mock_device:set_field("current_level", 10) + local step_command = Level.server.commands.Step.build_test_rx(mock_device, Level.types.MoveStepMode.DOWN, 0x00, + 0x0000, 0x00, 0x00) + local frm_ctrl = FrameCtrl(0x01) + step_command.body.zcl_header.frame_ctrl = frm_ctrl + test.socket.zigbee:__queue_receive({ mock_device.id, step_command }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(0))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Step command(MoveStepMode.UP) when device is off should emit switch on", + function() + mock_device:set_field("current_status", "off") + local step_command = Level.server.commands.Step.build_test_rx(mock_device, Level.types.MoveStepMode.UP, 0x00, + 0x0000, 0x00, 0x00) + local frm_ctrl = FrameCtrl(0x01) + step_command.body.zcl_header.frame_ctrl = frm_ctrl + test.socket.zigbee:__queue_receive({ mock_device.id, step_command }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(100))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Capability command setLevel should be handled", + function() + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + test.socket.capability:__queue_receive({ mock_device.id, { capability = "switchLevel", component = "main", command = "setLevel", args = { 50 } } }) + test.wait_for_events() + test.mock_time.advance_time(1) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(50))) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Capability command setLevel 0 should restore previous level", + function() + mock_device:set_field("current_level", 30) + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + test.socket.capability:__queue_receive({ mock_device.id, { capability = "switchLevel", component = "main", command = "setLevel", args = { 0 } } }) + test.wait_for_events() + test.mock_time.advance_time(1) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(30))) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "device added lifecycle should initialize device state", + function() + test.socket.capability:__set_channel_ordering("relaxed") + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switchLevel.level(100))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.numberOfButtons({ value = 1 }, { visibility = { displayed = false } }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({"pushed", "held"}, { visibility = { displayed = false } }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = true }))) + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-dimmer-remote/src/test/test_zigbee_battery_accessory_dimmer.lua b/drivers/SmartThings/zigbee-dimmer-remote/src/test/test_zigbee_battery_accessory_dimmer.lua index b16fe8cd11..a5729b6492 100644 Binary files a/drivers/SmartThings/zigbee-dimmer-remote/src/test/test_zigbee_battery_accessory_dimmer.lua and b/drivers/SmartThings/zigbee-dimmer-remote/src/test/test_zigbee_battery_accessory_dimmer.lua differ diff --git a/drivers/SmartThings/zigbee-fan/src/test/test_fan_light.lua b/drivers/SmartThings/zigbee-fan/src/test/test_fan_light.lua index 0fa987e35a..b7994fb30b 100644 --- a/drivers/SmartThings/zigbee-fan/src/test/test_fan_light.lua +++ b/drivers/SmartThings/zigbee-fan/src/test/test_fan_light.lua @@ -48,6 +48,9 @@ test.register_message_test( message = { mock_base_device.id, Level.server.commands.MoveToLevelWithOnOff (mock_base_device, 254, 0) } } + }, + { + min_api_version = 19 } ) @@ -66,6 +69,9 @@ test.register_message_test( message = { mock_base_device.id, Level.server.commands.MoveToLevelWithOnOff (mock_base_device, 127, 0) } } + }, + { + min_api_version = 19 } ) @@ -84,6 +90,9 @@ test.register_message_test( message = { mock_base_device.id, Level.server.commands.MoveToLevelWithOnOff (mock_base_device, 127, 0) } } + }, + { + min_api_version = 19 } ) @@ -102,6 +111,9 @@ test.register_message_test( message = { mock_base_device.id, Level.server.commands.MoveToLevelWithOnOff (mock_base_device, 0, 0) } } + }, + { + min_api_version = 19 } ) @@ -124,6 +136,9 @@ test.register_message_test( direction = "send", message = { mock_base_device.id, FanControl.attributes.FanMode:read(mock_base_device) } } + }, + { + min_api_version = 19 } ) @@ -146,6 +161,9 @@ test.register_message_test( direction = "send", message = { mock_base_device.id, FanControl.attributes.FanMode:read(mock_base_device) } } + }, + { + min_api_version = 19 } ) @@ -163,6 +181,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("light", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -180,6 +201,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("light", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -197,6 +221,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("light", capabilities.switchLevel.level(100)) } + }, + { + min_api_version = 19 } ) @@ -214,6 +241,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("light", capabilities.switchLevel.level(50)) } + }, + { + min_api_version = 19 } ) @@ -231,6 +261,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("light", capabilities.switchLevel.level(0)) } + }, + { + min_api_version = 19 } ) @@ -252,6 +285,9 @@ test.register_message_test( direction = "send", message = { mock_base_device.id, FanControl.attributes.FanMode:read(mock_base_device) } } + }, + { + min_api_version = 19 } ) @@ -273,6 +309,9 @@ test.register_message_test( direction = "send", message = { mock_base_device.id, FanControl.attributes.FanMode:read(mock_base_device) } } + }, + { + min_api_version = 19 } ) @@ -294,6 +333,9 @@ test.register_message_test( direction = "send", message = { mock_base_device.id, FanControl.attributes.FanMode:read(mock_base_device) } } + }, + { + min_api_version = 19 } ) @@ -321,6 +363,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(1)) } + }, + { + min_api_version = 19 } ) @@ -348,6 +393,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(2)) } + }, + { + min_api_version = 19 } ) @@ -375,6 +423,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(3)) } + }, + { + min_api_version = 19 } ) @@ -402,6 +453,9 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(4)) } + }, + { + min_api_version = 19 } ) @@ -429,7 +483,58 @@ test.register_message_test( direction = "send", message = mock_base_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(0)) } + }, + { + min_api_version = 19 } ) +test.register_message_test( + "Fan switch on command from main component", + { + { + channel = "capability", + direction = "receive", + message = { mock_base_device.id, { capability = "switch", component = "main", command = "on", args = {} } } + }, + { + channel = "zigbee", + direction = "send", + message = { mock_base_device.id, FanControl.attributes.FanMode:write(mock_base_device, 1) } + }, + { + channel = "zigbee", + direction = "send", + message = { mock_base_device.id, FanControl.attributes.FanMode:read(mock_base_device) } + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Fan switch off command from main component", + { + { + channel = "capability", + direction = "receive", + message = { mock_base_device.id, { capability = "switch", component = "main", command = "off", args = {} } } + }, + { + channel = "zigbee", + direction = "send", + message = { mock_base_device.id, FanControl.attributes.FanMode:write(mock_base_device, 0x00) } + }, + { + channel = "zigbee", + direction = "send", + message = { mock_base_device.id, FanControl.attributes.FanMode:read(mock_base_device) } + } + }, + { + min_api_version = 19 + } +) + test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_aqara_sensor.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_aqara_sensor.lua index 497395ac55..8915a9c87c 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_aqara_sensor.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_aqara_sensor.lua @@ -18,11 +18,17 @@ local t_utils = require "integration_test.utils" local zigbee_test_utils = require "integration_test.zigbee_test_utils" local clusters = require "st.zigbee.zcl.clusters" local capabilities = require "st.capabilities" +local cluster_base = require "st.zigbee.cluster_base" +local data_types = require "st.zigbee.data_types" local PowerConfiguration = clusters.PowerConfiguration local TemperatureMeasurement = clusters.TemperatureMeasurement local RelativeHumidity = clusters.RelativeHumidity +local PRIVATE_CLUSTER_ID = 0xFCC0 +local PRIVATE_ATTRIBUTE_ID = 0x0009 +local MFG_CODE = 0x115F + local mock_device = test.mock_device.build_test_zigbee_device( { profile = t_utils.get_profile_definition("humidity-temp-battery-aqara.yml"), @@ -88,7 +94,10 @@ test.register_coroutine_test( PowerConfiguration.attributes.BatteryVoltage:configure_reporting(mock_device, 30, 3600, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -108,6 +117,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 })) } + }, + { + min_api_version = 19 } ) @@ -128,6 +140,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 0 })) } + }, + { + min_api_version = 19 } ) @@ -148,6 +163,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 100 })) } + }, + { + min_api_version = 19 } ) @@ -176,6 +194,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -196,7 +217,10 @@ test.register_coroutine_test( capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" }))) mock_device:expect_native_attr_handler_registration("temperatureMeasurement", "temperature") test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -215,6 +239,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.batteryLevel.battery.normal()) } + }, + { + min_api_version = 19 } ) @@ -234,6 +261,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.batteryLevel.battery.critical()) } + }, + { + min_api_version = 19 } ) @@ -253,6 +283,31 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.batteryLevel.battery.warning()) } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Added handler should send manufacturer attribute and initialize device state", + function() + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + test.socket.zigbee:__expect_send({ + mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, + PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.temperatureMeasurement.temperature({ value = 0, unit = "C" }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.relativeHumidityMeasurement.humidity(0))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.batteryLevel.battery("normal"))) + test.wait_for_events() + end, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_centralite_sensor.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_centralite_sensor.lua index c9b469376c..d83cf90b35 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_centralite_sensor.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_centralite_sensor.lua @@ -94,7 +94,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -183,7 +184,10 @@ test.register_coroutine_test( ) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) local function build_test_attr_report(device, value) @@ -225,6 +229,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 75 })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_ewelink_sensor.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_ewelink_sensor.lua index 35f557e850..f3da0ff49d 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_ewelink_sensor.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_ewelink_sensor.lua @@ -65,7 +65,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -111,7 +112,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_frient_air_quality_sensor.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_frient_air_quality_sensor.lua index e985dafce5..8e34296f85 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_frient_air_quality_sensor.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_frient_air_quality_sensor.lua @@ -84,7 +84,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -101,6 +102,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -117,12 +121,16 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) test.register_coroutine_test( "Configure should configure all necessary attributes", function() + test.timer.__create_and_queue_test_time_advance_timer(5, "oneshot") test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) test.socket.zigbee:__set_channel_ordering("relaxed") @@ -191,7 +199,30 @@ test.register_coroutine_test( mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + test.wait_for_events() + + --refresh happens after configure + test.mock_time.advance_time(5) + test.socket.zigbee:__expect_send({ + mock_device.id, + cluster_base.read_manufacturer_specific_attribute(mock_device, Frient_VOCMeasurement.ID, Frient_VOCMeasurement.attributes.MeasuredValue.ID, Frient_VOCMeasurement.ManufacturerSpecificCode):to_endpoint(0x26) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + TemperatureMeasurement.attributes.MeasuredValue:read(mock_device):to_endpoint(0x26) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + HumidityMeasurement.attributes.MeasuredValue:read(mock_device):to_endpoint(0x26) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + PowerConfiguration.attributes.BatteryVoltage:read(mock_device) + }) + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -210,6 +241,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 65 })) } + }, + { + min_api_version = 19 } ) @@ -226,6 +260,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -259,7 +296,10 @@ test.register_coroutine_test( ) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -287,7 +327,25 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Added handler should initialize VOC and air quality state", + function() + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.airQualitySensor.airQuality({ value = 0 }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.tvocHealthConcern.tvocHealthConcern({ value = "good" }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.tvocMeasurement.tvocLevel({ value = 0, unit = "ppb" }))) + test.wait_for_events() + end, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_frient_sensor.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_frient_sensor.lua index 5b9ef77634..ea610d0550 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_frient_sensor.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_frient_sensor.lua @@ -66,7 +66,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -83,6 +84,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -99,12 +103,16 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) test.register_coroutine_test( "Configure should configure all necessary attributes", function() + test.timer.__create_and_queue_test_time_advance_timer(5, "oneshot") test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) test.socket.zigbee:__set_channel_ordering("relaxed") test.socket.zigbee:__expect_send({ @@ -141,7 +149,26 @@ test.register_coroutine_test( TemperatureMeasurement.attributes.MeasuredValue:configure_reporting(mock_device, 0x001E, 0x0E10, 100) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + test.wait_for_events() + + test.mock_time.advance_time(5) + test.socket.zigbee:__expect_send({ + mock_device.id, + PowerConfiguration.attributes.BatteryVoltage:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + HumidityMeasurement.attributes.MeasuredValue:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) + }) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -160,6 +187,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 65 })) } + }, + { + min_api_version = 19 } ) @@ -184,12 +214,16 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) test.register_coroutine_test( "info_changed to check for necessary preferences settings: Temperature Sensitivity", function() + test.timer.__create_and_queue_test_time_advance_timer(5, "oneshot") local updates = { preferences = { temperatureSensitivity = 0.9, @@ -217,7 +251,25 @@ test.register_coroutine_test( ) }) test.wait_for_events() - end + + test.mock_time.advance_time(5) + test.socket.zigbee:__expect_send({ + mock_device.id, + PowerConfiguration.attributes.BatteryVoltage:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + HumidityMeasurement.attributes.MeasuredValue:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) + }) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_heiman_sensor.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_heiman_sensor.lua index 773bd3e9e4..276853904f 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_heiman_sensor.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_heiman_sensor.lua @@ -65,7 +65,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -122,7 +123,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_battery_sensor.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_battery_sensor.lua index f914f0a898..9a54d39994 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_battery_sensor.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_battery_sensor.lua @@ -46,6 +46,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 50.0 })) } + }, + { + min_api_version = 19 } ) @@ -65,6 +68,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 0.0 })) } + }, + { + min_api_version = 19 } ) @@ -84,6 +90,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 100.0 })) } + }, + { + min_api_version = 19 } ) @@ -108,7 +117,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_plaid_systems.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_plaid_systems.lua index 6bca6c4e1a..078b7a9d58 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_plaid_systems.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_plaid_systems.lua @@ -49,6 +49,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 })) } + }, + { + min_api_version = 19 } ) @@ -68,6 +71,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 0 })) } + }, + { + min_api_version = 19 } ) @@ -87,6 +93,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 100 })) } + }, + { + min_api_version = 19 } ) @@ -114,6 +123,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -137,7 +149,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc))) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -155,7 +170,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" }))) mock_device:expect_native_attr_handler_registration("temperatureMeasurement", "temperature") test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -190,6 +208,9 @@ test.register_message_test( TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) } }, + }, + { + min_api_version = 19 } ) @@ -227,6 +248,9 @@ test.register_message_test( TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) } }, + }, + { + min_api_version = 19 } ) @@ -261,7 +285,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature.lua index 6de1dceb18..a137b643c7 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature.lua @@ -46,6 +46,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -73,6 +76,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -92,6 +98,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 })) } + }, + { + min_api_version = 19 } ) @@ -126,7 +135,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -157,7 +169,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 }))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature_battery.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature_battery.lua index 341cd4bc20..a409ed903a 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature_battery.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature_battery.lua @@ -58,6 +58,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -85,6 +88,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -104,6 +110,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 })) } + }, + { + min_api_version = 19 } ) @@ -146,7 +155,10 @@ test.register_coroutine_test( }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -177,7 +189,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 }))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature_sensor.lua b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature_sensor.lua index 4282db0ffd..b8d7f05920 100644 --- a/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature_sensor.lua +++ b/drivers/SmartThings/zigbee-humidity-sensor/src/test/test_humidity_temperature_sensor.lua @@ -53,6 +53,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -80,6 +83,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -99,6 +105,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 })) } + }, + { + min_api_version = 19 } ) @@ -133,7 +142,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-illuminance-sensor/src/test/test_illuminance_sensor.lua b/drivers/SmartThings/zigbee-illuminance-sensor/src/test/test_illuminance_sensor.lua index 92e93119f5..0e8e3889f5 100644 --- a/drivers/SmartThings/zigbee-illuminance-sensor/src/test/test_illuminance_sensor.lua +++ b/drivers/SmartThings/zigbee-illuminance-sensor/src/test/test_illuminance_sensor.lua @@ -44,6 +44,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 137 })) } + }, + { + min_api_version = 19 } ) @@ -63,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -98,7 +104,10 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_send({ mock_device.id, IlluminanceMeasurement.attributes.MeasuredValue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-illuminance-sensor/src/test/test_illuminance_sensor_aqara.lua b/drivers/SmartThings/zigbee-illuminance-sensor/src/test/test_illuminance_sensor_aqara.lua index 557d4e2345..a532f6e4d8 100644 --- a/drivers/SmartThings/zigbee-illuminance-sensor/src/test/test_illuminance_sensor_aqara.lua +++ b/drivers/SmartThings/zigbee-illuminance-sensor/src/test/test_illuminance_sensor_aqara.lua @@ -9,6 +9,10 @@ local zigbee_test_utils = require "integration_test.zigbee_test_utils" local t_utils = require "integration_test.utils" local cluster_base = require "st.zigbee.cluster_base" local data_types = require "st.zigbee.data_types" +local messages = require "st.zigbee.messages" +local zb_const = require "st.zigbee.constants" +local write_attribute_response = require "st.zigbee.zcl.global_commands.write_attribute_response" +local zcl_messages = require "st.zigbee.zcl" test.add_package_capability("detectionFrequency.yaml") local IlluminanceMeasurement = clusters.IlluminanceMeasurement @@ -19,8 +23,10 @@ local detectionFrequency = capabilities["stse.detectionFrequency"] local PRIVATE_CLUSTER_ID = 0xFCC0 local PRIVATE_ATTRIBUTE_ID = 0x0009 local MFG_CODE = 0x115F +local FREQUENCY_ATTRIBUTE_ID = 0x0000 local FREQUENCY_DEFAULT_VALUE = 5 +local FREQUENCY_PREF = "frequencyPref" local mock_device = test.mock_device.build_test_zigbee_device( { @@ -51,7 +57,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", detectionFrequency.detectionFrequency(FREQUENCY_DEFAULT_VALUE, {visibility = {displayed = false}}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(100))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -89,7 +98,10 @@ test.register_coroutine_test( , data_types.Uint8, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -109,6 +121,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 137 })) } + }, + { + min_api_version = 19 } ) @@ -128,6 +143,61 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 + } +) + +local function build_write_attr_res(cluster, status) + local addr_header = messages.AddressHeader( + mock_device:get_short_address(), + mock_device.fingerprinted_endpoint_id, + zb_const.HUB.ADDR, + zb_const.HUB.ENDPOINT, + zb_const.HA_PROFILE_ID, + cluster + ) + local write_attribute_body = write_attribute_response.WriteAttributeResponse(status, {}) + local zcl_header = zcl_messages.ZclHeader({ + cmd = data_types.ZCLCommandId(write_attribute_body.ID) + }) + local message_body = zcl_messages.ZclMessageBody({ + zcl_header = zcl_header, + zcl_body = write_attribute_body + }) + return messages.ZigbeeMessageRx({ + address_header = addr_header, + body = message_body + }) +end + +test.register_coroutine_test( + "Handle setDetectionFrequency capability command", + function() + local frequency = 10 + test.socket.capability:__queue_receive({ mock_device.id, + { capability = "stse.detectionFrequency", component = "main", command = "setDetectionFrequency", args = { frequency } } }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, FREQUENCY_ATTRIBUTE_ID, + MFG_CODE, data_types.Uint16, frequency) }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Handle write attr res on PRIVATE_CLUSTER_ID emits detectionFrequency", + function() + mock_device:set_field(FREQUENCY_PREF, FREQUENCY_DEFAULT_VALUE) + test.socket.zigbee:__queue_receive({ mock_device.id, + build_write_attr_res(PRIVATE_CLUSTER_ID, 0x00) }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + detectionFrequency.detectionFrequency(FREQUENCY_DEFAULT_VALUE, { visibility = { displayed = false } }))) + end, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-lock/src/configurations.lua b/drivers/SmartThings/zigbee-lock/src/configurations.lua index a2429252b0..88e4e59f80 100644 --- a/drivers/SmartThings/zigbee-lock/src/configurations.lua +++ b/drivers/SmartThings/zigbee-lock/src/configurations.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 local clusters = require "st.zigbee.zcl.clusters" diff --git a/drivers/SmartThings/zigbee-lock/src/init.lua b/drivers/SmartThings/zigbee-lock/src/init.lua index ce6894b868..94f5adc0c4 100644 --- a/drivers/SmartThings/zigbee-lock/src/init.lua +++ b/drivers/SmartThings/zigbee-lock/src/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Zigbee Driver utilities local defaults = require "st.zigbee.defaults" @@ -445,12 +435,7 @@ local zigbee_lock_driver = { [capabilities.refresh.commands.refresh.NAME] = refresh } }, - sub_drivers = { - require("samsungsds"), - require("yale"), - require("yale-fingerprint-lock"), - require("lock-without-codes") - }, + sub_drivers = require("sub_drivers"), lifecycle_handlers = { doConfigure = do_configure, added = device_added, diff --git a/drivers/SmartThings/zigbee-lock/src/lazy_load_subdriver.lua b/drivers/SmartThings/zigbee-lock/src/lazy_load_subdriver.lua new file mode 100644 index 0000000000..0bee6d2a75 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/lazy_load_subdriver.lua @@ -0,0 +1,15 @@ +-- 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 version = require "version" + local ZigbeeDriver = require "st.zigbee" + if version.api >= 16 then + return ZigbeeDriver.lazy_load_sub_driver_v2(sub_driver_name) + elseif version.api >= 9 then + return ZigbeeDriver.lazy_load_sub_driver(require(sub_driver_name)) + else + return require(sub_driver_name) + end +end diff --git a/drivers/SmartThings/zigbee-lock/src/lock-without-codes/can_handle.lua b/drivers/SmartThings/zigbee-lock/src/lock-without-codes/can_handle.lua new file mode 100644 index 0000000000..543e43a8b1 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/lock-without-codes/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_lock_without_codes(opts, driver, device) + local FINGERPRINTS = require("lock-without-codes.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("lock-without-codes") + end + end + return false +end + +return can_handle_lock_without_codes diff --git a/drivers/SmartThings/zigbee-lock/src/lock-without-codes/fingerprints.lua b/drivers/SmartThings/zigbee-lock/src/lock-without-codes/fingerprints.lua new file mode 100644 index 0000000000..63ae82b46c --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/lock-without-codes/fingerprints.lua @@ -0,0 +1,9 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local LOCK_WITHOUT_CODES_FINGERPRINTS = { + { model = "E261-KR0B0Z0-HA" }, + { mfr = "Danalock", model = "V3-BTZB" } +} + +return LOCK_WITHOUT_CODES_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-lock/src/lock-without-codes/init.lua b/drivers/SmartThings/zigbee-lock/src/lock-without-codes/init.lua index 7272991459..e5c6de3408 100644 --- a/drivers/SmartThings/zigbee-lock/src/lock-without-codes/init.lua +++ b/drivers/SmartThings/zigbee-lock/src/lock-without-codes/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local configurationMap = require "configurations" local clusters = require "st.zigbee.zcl.clusters" @@ -19,19 +9,7 @@ local capabilities = require "st.capabilities" local DoorLock = clusters.DoorLock local PowerConfiguration = clusters.PowerConfiguration -local LOCK_WITHOUT_CODES_FINGERPRINTS = { - { model = "E261-KR0B0Z0-HA" }, - { mfr = "Danalock", model = "V3-BTZB" } -} -local function can_handle_lock_without_codes(opts, driver, device) - for _, fingerprint in ipairs(LOCK_WITHOUT_CODES_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local function device_init(driver, device) local configuration = configurationMap.get_device_configuration(device) @@ -95,7 +73,7 @@ local lock_without_codes = { } } }, - can_handle = can_handle_lock_without_codes + can_handle = require("lock-without-codes.can_handle"), } return lock_without_codes diff --git a/drivers/SmartThings/zigbee-lock/src/lock_utils.lua b/drivers/SmartThings/zigbee-lock/src/lock_utils.lua index 0a36a9685e..a02a59963c 100644 --- a/drivers/SmartThings/zigbee-lock/src/lock_utils.lua +++ b/drivers/SmartThings/zigbee-lock/src/lock_utils.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 local utils = require "st.utils" local capabilities = require "st.capabilities" local json = require "st.json" diff --git a/drivers/SmartThings/zigbee-lock/src/samsungsds/can_handle.lua b/drivers/SmartThings/zigbee-lock/src/samsungsds/can_handle.lua new file mode 100644 index 0000000000..c483b2fe27 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/samsungsds/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function samsungsds_can_handle(opts, driver, device, ...) + if device:get_manufacturer() == "SAMSUNG SDS" then + return true, require("samsungsds") + end + return false +end + +return samsungsds_can_handle diff --git a/drivers/SmartThings/zigbee-lock/src/samsungsds/init.lua b/drivers/SmartThings/zigbee-lock/src/samsungsds/init.lua index b529dd3fd1..fff290df5d 100644 --- a/drivers/SmartThings/zigbee-lock/src/samsungsds/init.lua +++ b/drivers/SmartThings/zigbee-lock/src/samsungsds/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local device_management = require "st.zigbee.device_management" local clusters = require "st.zigbee.zcl.clusters" @@ -112,9 +102,7 @@ local samsung_sds_driver = { added = device_added, init = device_init }, - can_handle = function(opts, driver, device, ...) - return device:get_manufacturer() == "SAMSUNG SDS" - end + can_handle = require("samsungsds.can_handle"), } return samsung_sds_driver diff --git a/drivers/SmartThings/zigbee-lock/src/sub_drivers.lua b/drivers/SmartThings/zigbee-lock/src/sub_drivers.lua new file mode 100644 index 0000000000..ff4bf8980d --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/sub_drivers.lua @@ -0,0 +1,11 @@ +-- 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("samsungsds"), + lazy_load_if_possible("yale"), + lazy_load_if_possible("yale-fingerprint-lock"), + lazy_load_if_possible("lock-without-codes"), +} +return sub_drivers diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_c2o_lock.lua b/drivers/SmartThings/zigbee-lock/src/test/test_c2o_lock.lua index b6fa3d1323..66b6b06d34 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_c2o_lock.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_c2o_lock.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 local test = require "integration_test" local clusters = require "st.zigbee.zcl.clusters" @@ -50,7 +39,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.LockState:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -81,7 +73,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -91,7 +86,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.LockState:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -101,7 +99,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "lock", component = "main", command = "lock", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.commands.LockDoor(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -111,7 +112,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "lock", component = "main", command = "unlock", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.commands.UnlockDoor(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -123,7 +127,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(5) test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.LockState:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -135,14 +142,20 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(5) test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.LockState:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "PinUsersSupported report should be a no-op", function () test.socket.zigbee:__queue_receive({ mock_device.id, DoorLock.attributes.NumberOfPINUsersSupported:build_test_attr_report(mock_device, 8)}) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_generic_lock_migration.lua b/drivers/SmartThings/zigbee-lock/src/test/test_generic_lock_migration.lua index ed4ce6e3cc..afae23fd9c 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_generic_lock_migration.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_generic_lock_migration.lua @@ -1,16 +1,5 @@ --- Copyright 2023 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2023 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 -- Mock out globals local test = require "integration_test" @@ -42,7 +31,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, DoorLock.attributes.NumberOfPINUsersSupported:read(mock_device)}) test.socket.zigbee:__queue_receive({mock_device.id, DoorLock.attributes.NumberOfPINUsersSupported:build_test_attr_report(mock_device, 8)}) mock_device:expect_metadata_update({profile = "base-lock"}) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_yale_fingerprint_bad_battery_reporter.lua b/drivers/SmartThings/zigbee-lock/src/test/test_yale_fingerprint_bad_battery_reporter.lua index d499d7ff66..6f74c5c0bf 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_yale_fingerprint_bad_battery_reporter.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_yale_fingerprint_bad_battery_reporter.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 -- Mock out globals local test = require "integration_test" @@ -55,6 +44,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(55)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock.lua b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock.lua index 80d10d092e..2ab9f45a65 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 -- Mock out globals local test = require "integration_test" @@ -86,7 +75,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) expect_reload_all_codes_messages() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -98,7 +90,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device)}) test.socket.zigbee:__expect_send({mock_device.id, DoorLock.attributes.LockState:read(mock_device)}) test.socket.zigbee:__expect_send({mock_device.id, Alarm.attributes.AlarmCount:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -115,6 +110,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked()) } + }, + { + min_api_version = 19 } ) @@ -132,6 +130,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -156,6 +157,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -186,6 +190,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["2"] = "Code 2"} ), { visibility = { displayed = false } })) } + }, + { + min_api_version = 19 } ) @@ -202,6 +209,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, DoorLock.server.commands.LockDoor(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -218,6 +228,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lockCodes.minCodeLength(4, { visibility = { displayed = false }})) } + }, + { + min_api_version = 19 } ) @@ -234,6 +247,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lockCodes.maxCodeLength(4, { visibility = { displayed = false }})) } + }, + { + min_api_version = 19 } ) @@ -251,6 +267,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lockCodes.maxCodes(16, { visibility = { displayed = false }})) } + }, + { + min_api_version = 19 } ) @@ -259,7 +278,10 @@ test.register_coroutine_test( function() test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "reloadAllCodes", args = {} } }) expect_reload_all_codes_messages() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -275,6 +297,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 1) } } + }, + { + min_api_version = 19 } ) @@ -314,7 +339,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({} ), { visibility = { displayed = false } }) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -361,7 +389,10 @@ test.register_coroutine_test( capabilities.lockCodes.codeChanged("1 set", { data = { codeName = "test" }, state_change = true }))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["1"] = "test"}), { visibility = { displayed = false } }))) - end + end, + { + min_api_version = 19 + } ) local function init_code_slot(slot_number, name, device) @@ -416,7 +447,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 renamed", {state_change = true}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["1"] = "foo"}), { visibility = { displayed = false } }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -431,7 +465,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 renamed", {state_change = true}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["1"] = "foo"}), { visibility = { displayed = false } }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -502,7 +539,10 @@ test.register_coroutine_test( DoorLock.server.commands.GetPINCode(mock_device, 4) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -534,7 +574,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 4) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -566,6 +609,9 @@ test.register_message_test( capabilities.lockCodes.codeChanged("0 set", { data = { codeName = "Master Code"}, state_change = true }) ) } + }, + { + min_api_version = 19 } ) @@ -602,6 +648,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1"}), { visibility = { displayed = false } })) } + }, + { + min_api_version = 19 } ) @@ -634,7 +683,10 @@ test.register_coroutine_test( ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({}), { visibility = { displayed = false } }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -688,7 +740,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({}), { visibility = { displayed = false } }))) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -716,7 +771,10 @@ test.register_coroutine_test( capabilities.lock.lock.unlocked({ data = { method = "keypad", codeId = "1", codeName = "Code 1" } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -779,7 +837,106 @@ test.register_coroutine_test( capabilities.lock.lock.locked() ) ) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Alarm code 0 should generate lock unknown event", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, Alarm.client.commands.Alarm.build_test_rx(mock_device, 0x00, DoorLock.ID) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lock.lock.unknown()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Alarm code 1 should generate lock unknown event", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, Alarm.client.commands.Alarm.build_test_rx(mock_device, 0x01, DoorLock.ID) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lock.lock.unknown()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Pin response for unoccupied slot with no existing code should generate unset event", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 0x05, + DoorLockUserStatus.OCCUPIED_DISABLED, + DoorLockUserType.UNRESTRICTED, + "" + ) + } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("5 unset", + { data = { codeName = "Code 5" }, state_change = true })) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Pin response for already-set slot should use changed change type", + function() + init_code_slot(1, "Code 1", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1"}), { visibility = { displayed = false } }))) + test.wait_for_events() + + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 0x01, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + } + ) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 changed", { data = { codeName = "Code 1" }, state_change = true }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1"}), { visibility = { displayed = false } }))) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock_code_migration.lua b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock_code_migration.lua index 1aa9432933..c1ab2927dc 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock_code_migration.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock_code_migration.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 -- Mock out globals local test = require "integration_test" @@ -72,7 +61,10 @@ test.register_coroutine_test( ) -- Validate migration complete flag mock_datastore.__assert_device_store_contains(mock_device.id, "migrationComplete", true) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -90,7 +82,10 @@ test.register_coroutine_test( mock_datastore.__assert_device_store_contains(mock_device.id, "__state_cache", nil) -- Validate migration complete flag mock_datastore.__assert_device_store_contains(mock_device.id, "migrationComplete", nil) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -132,7 +127,10 @@ test.register_coroutine_test( ) -- Validate migration complete flag mock_datastore.__assert_device_store_contains(mock_device.id, "migrationComplete", true) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -174,7 +172,10 @@ test.register_coroutine_test( ) -- Validate migration complete flag mock_datastore.__assert_device_store_contains(mock_device_no_data.id, "migrationComplete", true) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -237,7 +238,10 @@ test.register_coroutine_test( -- Verify the timer doesn't fire as it wasn't created test.mock_time.advance_time(4) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock_v10.lua b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock_v10.lua new file mode 100644 index 0000000000..57438c7f77 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock_v10.lua @@ -0,0 +1,850 @@ +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +-- Mock out globals +local test = require "integration_test" +local zigbee_test_utils = require "integration_test.zigbee_test_utils" +local t_utils = require "integration_test.utils" + +local clusters = require "st.zigbee.zcl.clusters" +local PowerConfiguration = clusters.PowerConfiguration +local DoorLock = clusters.DoorLock +local Alarm = clusters.Alarms +local capabilities = require "st.capabilities" +-- Note: This is not the proper way to test against previous versions. +-- Instead, testing should be run against different lua lib artifacts +local version = require "version" +version.api = 10 + +local DoorLockState = DoorLock.attributes.LockState +local OperationEventCode = DoorLock.types.OperationEventCode +local DoorLockUserStatus = DoorLock.types.DrlkUserStatus +local DoorLockUserType = DoorLock.types.DrlkUserType +local ProgrammingEventCode = DoorLock.types.ProgramEventCode + +local json = require "dkjson" + +local mock_device = test.mock_device.build_test_zigbee_device( + { profile = t_utils.get_profile_definition("base-lock.yml") } +) +zigbee_test_utils.prepare_zigbee_env_info() +local function test_init() + test.mock_device.add_test_device(mock_device)end + +test.set_test_init_function(test_init) + +local expect_reload_all_codes_messages = function() + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.SendPINOverTheAir:write(mock_device, + true) }) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.MaxPINCodeLength:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.MinPINCodeLength:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.NumberOfPINUsersSupported:read(mock_device) }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.scanCodes("Scanning", { visibility = { displayed = false } }))) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 0) }) +end + +test.register_coroutine_test( + "Configure should configure all necessary attributes and begin reading codes", + function() + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.wait_for_events() + + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) + test.socket.zigbee:__expect_send({ mock_device.id, zigbee_test_utils.build_bind_request(mock_device, + zigbee_test_utils.mock_hub_eui, + PowerConfiguration.ID) }) + test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:configure_reporting(mock_device, + 600, + 21600, + 1) }) + test.socket.zigbee:__expect_send({ mock_device.id, zigbee_test_utils.build_bind_request(mock_device, + zigbee_test_utils.mock_hub_eui, + DoorLock.ID) }) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.LockState:configure_reporting(mock_device, + 0, + 3600, + 0) }) + test.socket.zigbee:__expect_send({ mock_device.id, zigbee_test_utils.build_bind_request(mock_device, + zigbee_test_utils.mock_hub_eui, + Alarm.ID) }) + test.socket.zigbee:__expect_send({ mock_device.id, Alarm.attributes.AlarmCount:configure_reporting(mock_device, + 0, + 21600, + 0) }) + + mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) + test.wait_for_events() + + test.mock_time.advance_time(2) + expect_reload_all_codes_messages() + + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Refresh should read expected attributes", + function() + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.capability:__queue_receive({mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} }}) + + test.socket.zigbee:__expect_send({mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device)}) + test.socket.zigbee:__expect_send({mock_device.id, DoorLock.attributes.LockState:read(mock_device)}) + test.socket.zigbee:__expect_send({mock_device.id, Alarm.attributes.AlarmCount:read(mock_device)}) + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Lock status reporting should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, DoorLock.attributes.LockState:build_test_attr_report(mock_device, + DoorLockState.LOCKED) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lock.lock.locked()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Battery percentage report should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:build_test_attr_report(mock_device, + 55) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Lock operation event reporting should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, + DoorLock.client.commands.OperatingEventNotification.build_test_rx( + mock_device, + 0x02, + OperationEventCode.LOCK, + 0x0000, + "", + 0x0000, + "") } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "manual" } })) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Pin response reporting should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 0x02, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("2 set", + { data = { codeName = "Code 2" }, state_change = true })) + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["2"] = "Code 2"} ), { visibility = { displayed = false } })) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Sending the lock command should be handled", + { + { + channel = "capability", + direction = "receive", + message = { mock_device.id, { capability = "lock", component = "main", command = "lock", args = {} } } + }, + { + channel = "zigbee", + direction = "send", + message = { mock_device.id, DoorLock.server.commands.LockDoor(mock_device) } + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Min lock code length report should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, DoorLock.attributes.MinPINCodeLength:build_test_attr_report(mock_device, 4) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lockCodes.minCodeLength(4, { visibility = { displayed = false }})) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Max lock code length report should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, DoorLock.attributes.MaxPINCodeLength:build_test_attr_report(mock_device, 4) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lockCodes.maxCodeLength(4, { visibility = { displayed = false }})) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Max user code number report should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, DoorLock.attributes.NumberOfPINUsersSupported:build_test_attr_report(mock_device, + 16) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.lockCodes.maxCodes(16, { visibility = { displayed = false }})) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Reloading all codes of an unconfigured lock should generate correct attribute checks", + function() + test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "reloadAllCodes", args = {} } }) + expect_reload_all_codes_messages() + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Requesting a user code should be handled", + { + { + channel = "capability", + direction = "receive", + message = { mock_device.id, { capability = capabilities.lockCodes.ID, command = "requestCode", args = { 1 } } } + }, + { + channel = "zigbee", + direction = "send", + message = { mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 1) } + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Deleting a user code should be handled", + function() + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.socket.zigbee:__queue_receive({ mock_device.id, DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 0x01, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 set", + { data = { codeName = "Code 1" }, state_change = true }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode( {["1"] = "Code 1"} ), { visibility = { displayed = false }}) + )) + test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "deleteCode", args = { 1 } } }) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.attributes.SendPINOverTheAir:write(mock_device, + true) }) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.ClearPINCode(mock_device, 1) }) + test.wait_for_events() + + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 1) }) + test.socket.zigbee:__queue_receive({ mock_device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 0x01, + DoorLockUserType.UNRESTRICTED, + DoorLockUserStatus.AVAILABLE, + "")}) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 deleted", + { data = { codeName = "Code 1"}, state_change = true }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({} ), { visibility = { displayed = false } }) + )) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting a user code should result in the named code changed event firing", + function() + test.timer.__create_and_queue_test_time_advance_timer(4, "oneshot") + test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "setCode", args = { 1, "1234", "test" } } }) + test.socket.zigbee:__expect_send( + { + mock_device.id, + DoorLock.server.commands.SetPINCode(mock_device, + 1, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + } + ) + test.wait_for_events() + + test.mock_time.advance_time(4) + test.socket.zigbee:__expect_send( + { + mock_device.id, + DoorLock.server.commands.GetPINCode(mock_device, 1) + } + ) + + test.wait_for_events() + + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 0x01, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + } + ) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 set", { data = { codeName = "test" }, state_change = true }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "test"}), { visibility = { displayed = false } }))) + end, + { + min_api_version = 19 + } +) + +local function init_code_slot(slot_number, name, device) + test.timer.__create_and_queue_test_time_advance_timer(4, "oneshot") + test.socket.capability:__queue_receive({ device.id, { capability = capabilities.lockCodes.ID, command = "setCode", args = { slot_number, "1234", name } } }) + test.socket.zigbee:__expect_send( + { + device.id, + DoorLock.server.commands.SetPINCode(device, + slot_number, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + } + ) + test.wait_for_events() + test.mock_time.advance_time(4) + test.socket.zigbee:__expect_send( + { + device.id, + DoorLock.server.commands.GetPINCode(device, slot_number) + } + ) + test.wait_for_events() + test.socket.zigbee:__queue_receive( + { + device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + device, + slot_number, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + } + ) + test.socket.capability:__expect_send(device:generate_test_message("main", + capabilities.lockCodes.codeChanged(slot_number .. " set", { data = { codeName = name }, state_change = true })) + ) +end + +test.register_coroutine_test( + "Setting a user code name should be handled", + function() + init_code_slot(1, "initialName", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "initialName"}), { visibility = { displayed = false } }))) + test.wait_for_events() + + test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "nameSlot", args = { 1, "foo" } } }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 renamed", {state_change = true}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "foo"}), { visibility = { displayed = false } }))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting a user code name via setCode should be handled", + function() + init_code_slot(1, "initialName", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "initialName"}), { visibility = { displayed = false } }))) + test.wait_for_events() + + test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "setCode", args = { 1, "", "foo"} } }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 renamed", {state_change = true}))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "foo"}), { visibility = { displayed = false } }))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Calling updateCodes should send properly spaced commands", + function () + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "updateCodes", args = {{code1 = "1234", code2 = "2345", code3 = "3456", code4 = ""}}}}) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ + mock_device.id, + DoorLock.server.commands.SetPINCode(mock_device, + 1, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ + mock_device.id, + DoorLock.server.commands.SetPINCode(mock_device, + 2, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "2345" + ) + }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ + mock_device.id, + DoorLock.server.commands.SetPINCode(mock_device, + 3, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "3456" + ) + }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ + mock_device.id, DoorLock.server.commands.ClearPINCode(mock_device, 4) + }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ + mock_device.id, + DoorLock.server.commands.GetPINCode(mock_device, 1) + }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ + mock_device.id, + DoorLock.server.commands.GetPINCode(mock_device, 2) + }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ + mock_device.id, + DoorLock.server.commands.GetPINCode(mock_device, 3) + }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ + mock_device.id, + DoorLock.server.commands.GetPINCode(mock_device, 4) + }) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting all user codes should result in a code set event for each", + function () + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "updateCodes", args = {{code1 = "1234", code2 = "2345", code3 = "3456", code4 = ""}}}}) + test.socket.zigbee:__expect_send({mock_device.id, DoorLock.server.commands.SetPINCode(mock_device, 1, DoorLockUserStatus.OCCUPIED_ENABLED, DoorLockUserType.UNRESTRICTED, "1234")}) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 1) }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({mock_device.id, DoorLock.server.commands.SetPINCode(mock_device, 2, DoorLockUserStatus.OCCUPIED_ENABLED, DoorLockUserType.UNRESTRICTED, "2345")}) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 2) }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({mock_device.id, DoorLock.server.commands.SetPINCode(mock_device, 3, DoorLockUserStatus.OCCUPIED_ENABLED, DoorLockUserType.UNRESTRICTED, "3456")}) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 3) }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.ClearPINCode(mock_device, 4) }) + test.mock_time.advance_time(2) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 4) }) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Master code programming event should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { + mock_device.id, + DoorLock.client.commands.ProgrammingEventNotification.build_test_rx( + mock_device, + 0x00, + ProgrammingEventCode.MASTER_CODE_CHANGED, + 0, + "1234", + DoorLockUserType.MASTER_USER, + DoorLockUserStatus.OCCUPIED_ENABLED, + 0x0000, + "data" + ) + } + }, + + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("0 set", { data = { codeName = "Master Code"}, state_change = true }) + ) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "The lock reporting a single code has been set should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { + mock_device.id, + DoorLock.client.commands.ProgrammingEventNotification.build_test_rx( + mock_device, + 0x0, + ProgrammingEventCode.PIN_CODE_ADDED, + 1, + "1234", + DoorLockUserType.UNRESTRICTED, + DoorLockUserStatus.OCCUPIED_ENABLED, + 0x0000, + "data" + ) + } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 set", { data = { codeName = "Code 1"}, state_change = true })) + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1"}), { visibility = { displayed = false } })) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "The lock reporting a code has been deleted should be handled", + function() + init_code_slot(1, "Code 1", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1"}), { visibility = { displayed = false } }))) + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.ProgrammingEventNotification.build_test_rx( + mock_device, + 0x0, + ProgrammingEventCode.PIN_CODE_DELETED, + 1, + "1234", + DoorLockUserType.UNRESTRICTED, + DoorLockUserStatus.AVAILABLE, + 0x0000, + "data" + ) + } + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 deleted", { data = { codeName = "Code 1"}, state_change = true }) + ) + ) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({}), { visibility = { displayed = false } }))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "The lock reporting that all codes have been deleted should be handled", + function() + init_code_slot(1, "Code 1", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1"}), { visibility = { displayed = false } }))) + init_code_slot(2, "Code 2", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1", ["2"] = "Code 2"}), { visibility = { displayed = false } }))) + init_code_slot(3, "Code 3", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1", ["2"] = "Code 2", ["3"] = "Code 3"}), { visibility = { displayed = false } }))) + + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.ProgrammingEventNotification.build_test_rx( + mock_device, + 0x0, + ProgrammingEventCode.PIN_CODE_DELETED, + 0xFF, + "1234", + DoorLockUserType.UNRESTRICTED, + DoorLockUserStatus.AVAILABLE, + 0x0000, + "data" + ) + } + ) + + test.socket.capability:__set_channel_ordering("relaxed") + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 deleted", { data = { codeName = "Code 1"}, state_change = true }) + ) + ) + + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("2 deleted", { data = { codeName = "Code 2"}, state_change = true }) + ) + ) + + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("3 deleted", { data = { codeName = "Code 3"}, state_change = true }) + ) + ) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({}), { visibility = { displayed = false } }))) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "The lock reporting unlock via code should include the code info in the report", + function() + init_code_slot(1, "Code 1", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1"}), { visibility = { displayed = false } }))) + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.OperatingEventNotification.build_test_rx( + mock_device, + 0x00, -- 0 = keypad + OperationEventCode.UNLOCK, + 0x0001, + "1234", + 0x0000, + "" + ) + } + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lock.lock.unlocked({ data = { method = "keypad", codeId = "1", codeName = "Code 1" } }) + ) + ) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Lock state attribute reports (after the first) should be delayed if they come before event notifications ", + function() + init_code_slot(1, "Code 1", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "Code 1"}), { visibility = { displayed = false } }))) + test.socket.zigbee:__queue_receive({mock_device.id, DoorLock.attributes.LockState:build_test_attr_report(mock_device, DoorLockState.UNLOCKED)}) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lock.lock.unlocked() + ) + ) + test.mock_time.advance_time(2) + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.OperatingEventNotification.build_test_rx( + mock_device, + 0x00, -- 0 = keypad + OperationEventCode.UNLOCK, + 0x0001, + "1234", + 0x0000, + "" + ) + } + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lock.lock.unlocked({ data = { method = "keypad", codeId = "1", codeName = "Code 1" } }) + ) + ) + test.mock_time.advance_time(2) + test.timer.__create_and_queue_test_time_advance_timer(2.5, "oneshot") + test.socket.zigbee:__queue_receive({mock_device.id, DoorLock.attributes.LockState:build_test_attr_report(mock_device, DoorLockState.LOCKED)}) + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.OperatingEventNotification.build_test_rx( + mock_device, + 0x00, -- 0 = keypad + OperationEventCode.LOCK, + 0x0001, + "1234", + 0x0000, + "" + ) + } + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lock.lock.locked({ data = { method = "keypad", codeId = "1", codeName = "Code 1" } }) + ) + ) + test.mock_time.advance_time(2.5) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", + capabilities.lock.lock.locked() + ) + ) + end, + { + min_api_version = 19 + } +) + +test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_samsungsds.lua b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_samsungsds.lua index bac1554790..e421ab950e 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_samsungsds.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_samsungsds.lua @@ -74,7 +74,10 @@ test.register_coroutine_test( ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -91,6 +94,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked()) } + }, + { + min_api_version = 19 } ) @@ -108,6 +114,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()) } + }, + { + min_api_version = 19 } ) @@ -120,6 +129,9 @@ test.register_message_test( message = { mock_device.id, DoorLock.attributes.LockState:build_test_attr_report(mock_device, DoorLockState.NOT_FULLY_LOCKED) } } + }, + { + min_api_version = 19 } ) @@ -146,6 +158,9 @@ test.register_message_test( capabilities.lock.lock.locked({ data = { method = "keypad"} }) ) } + }, + { + min_api_version = 19 } ) @@ -172,6 +187,9 @@ test.register_message_test( capabilities.lock.lock.unlocked({ data = { method = "keypad"} }) ) } + }, + { + min_api_version = 19 } ) @@ -198,6 +216,9 @@ test.register_message_test( capabilities.lock.lock.locked({ data = { method = "keypad"} }) ) } + }, + { + min_api_version = 19 } ) @@ -224,6 +245,9 @@ test.register_message_test( capabilities.lock.lock.locked({ data = { method = "keypad"} }) ) } + }, + { + min_api_version = 19 } ) @@ -250,6 +274,9 @@ test.register_message_test( capabilities.lock.lock.unlocked({ data = { method = "keypad"} }) ) } + }, + { + min_api_version = 19 } ) @@ -276,6 +303,9 @@ test.register_message_test( capabilities.lock.lock.locked({ data = { method = "keypad"} }) ) } + }, + { + min_api_version = 19 } ) @@ -302,6 +332,9 @@ test.register_message_test( capabilities.lock.lock.locked({data = { method = "keypad"} }) ) } + }, + { + min_api_version = 19 } ) @@ -328,6 +361,9 @@ test.register_message_test( capabilities.lock.lock.unlocked({ data = { method = "keypad"} }) ) } + }, + { + min_api_version = 19 } ) @@ -352,6 +388,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "command" } })) } + }, + { + min_api_version = 19 } ) @@ -376,6 +415,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "command" } })) } + }, + { + min_api_version = 19 } ) @@ -400,6 +442,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "command" } })) } + }, + { + min_api_version = 19 } ) @@ -424,6 +469,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "command" } })) } + }, + { + min_api_version = 19 } ) @@ -448,6 +496,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "command" } })) } + }, + { + min_api_version = 19 } ) @@ -472,6 +523,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "auto" } })) } + }, + { + min_api_version = 19 } ) @@ -496,6 +550,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "command" } })) } + }, + { + min_api_version = 19 } ) @@ -520,6 +577,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "command" } })) } + }, + { + min_api_version = 19 } ) @@ -544,6 +604,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -568,6 +631,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -592,6 +658,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -616,6 +685,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -640,6 +712,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -664,6 +739,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "auto" } })) } + }, + { + min_api_version = 19 } ) @@ -688,6 +766,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -712,6 +793,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -736,6 +820,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "rfid" } })) } + }, + { + min_api_version = 19 } ) @@ -760,6 +847,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "rfid" } })) } + }, + { + min_api_version = 19 } ) @@ -784,6 +874,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "rfid" } })) } + }, + { + min_api_version = 19 } ) @@ -808,6 +901,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "rfid" } })) } + }, + { + min_api_version = 19 } ) @@ -832,6 +928,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "rfid" } })) } + }, + { + min_api_version = 19 } ) @@ -856,6 +955,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "auto" } })) } + }, + { + min_api_version = 19 } ) @@ -880,6 +982,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "rfid" } })) } + }, + { + min_api_version = 19 } ) @@ -904,6 +1009,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "rfid" } })) } + }, + { + min_api_version = 19 } ) @@ -928,6 +1036,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "fingerprint" } })) } + }, + { + min_api_version = 19 } ) @@ -952,6 +1063,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "fingerprint" } })) } + }, + { + min_api_version = 19 } ) @@ -976,6 +1090,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "fingerprint" } })) } + }, + { + min_api_version = 19 } ) @@ -1000,6 +1117,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "fingerprint" } })) } + }, + { + min_api_version = 19 } ) @@ -1024,6 +1144,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "fingerprint" } })) } + }, + { + min_api_version = 19 } ) @@ -1048,6 +1171,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "auto" } })) } + }, + { + min_api_version = 19 } ) @@ -1072,6 +1198,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "fingerprint" } })) } + }, + { + min_api_version = 19 } ) @@ -1096,6 +1225,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "fingerprint" } })) } + }, + { + min_api_version = 19 } ) @@ -1120,6 +1252,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "bluetooth" } })) } + }, + { + min_api_version = 19 } ) @@ -1144,6 +1279,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "bluetooth" } })) } + }, + { + min_api_version = 19 } ) @@ -1168,6 +1306,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "bluetooth" } })) } + }, + { + min_api_version = 19 } ) @@ -1192,6 +1333,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "bluetooth" } })) } + }, + { + min_api_version = 19 } ) @@ -1216,6 +1360,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "bluetooth" } })) } + }, + { + min_api_version = 19 } ) @@ -1240,6 +1387,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "auto" } })) } + }, + { + min_api_version = 19 } ) @@ -1264,6 +1414,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "bluetooth" } })) } + }, + { + min_api_version = 19 } ) @@ -1288,6 +1441,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked({ data = { method = "bluetooth" } })) } + }, + { + min_api_version = 19 } ) @@ -1308,7 +1464,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -1327,6 +1486,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.unlocked()) }, + }, + { + min_api_version = 19 } ) @@ -1341,6 +1503,9 @@ test.register_message_test( zigbee_test_utils.build_custom_command_id(mock_device, DoorLock.ID, SAMSUNG_SDS_MFR_SPECIFIC_COMMAND, SAMSUNG_SDS_MFR_CODE, "") } } + }, + { + min_api_version = 19 } ) @@ -1358,7 +1523,10 @@ test.register_coroutine_test( zigbee_test_utils.build_tx_custom_command_id(mock_device, DoorLock.ID, SAMSUNG_SDS_MFR_SPECIFIC_COMMAND, SAMSUNG_SDS_MFR_CODE, "1235") }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1371,7 +1539,10 @@ test.register_coroutine_test( } ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1388,7 +1559,10 @@ test.register_coroutine_test( test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(100))) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale-bad-battery-reporter.lua b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale-bad-battery-reporter.lua index ee1745e3b7..41445875ed 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale-bad-battery-reporter.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale-bad-battery-reporter.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 -- Mock out globals local test = require "integration_test" @@ -43,6 +32,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(55)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale-fingerprint-lock.lua b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale-fingerprint-lock.lua index 2255c063a3..9962cf59c5 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale-fingerprint-lock.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale-fingerprint-lock.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 -- Mock out globals local test = require "integration_test" @@ -43,6 +32,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lockCodes.maxCodes(30)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale.lua b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale.lua index 34b6881028..40d27348f6 100644 --- a/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale.lua +++ b/drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 -- Mock out globals local test = require "integration_test" @@ -56,7 +45,10 @@ test.register_coroutine_test( function() test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "reloadAllCodes", args = {} } }) expect_reload_all_codes_messages() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -95,7 +87,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) expect_reload_all_codes_messages() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -142,7 +137,10 @@ test.register_coroutine_test( ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["1"] = "test"}), { visibility = { displayed = false }}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -189,7 +187,10 @@ test.register_coroutine_test( ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["0"] = "test"}), { visibility = { displayed = false }}))) - end + end, + { + min_api_version = 19 + } ) @@ -215,6 +216,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("0 unset", { data = { codeName = "Code 0" }, state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -270,7 +274,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 renamed", {state_change = true}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["1"] = "foo"}), { visibility = { displayed = false }}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -312,7 +319,10 @@ test.register_coroutine_test( ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 failed", { state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -327,7 +337,113 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 renamed", {state_change = true}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["1"] = "foo"}), { visibility = { displayed = false }}))) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting a user code for a slot that is empty should indicate failure and unset", + function() + test.timer.__create_and_queue_test_time_advance_timer(4, "oneshot") + test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "setCode", args = { 1, "1234", "test" } } }) + test.socket.zigbee:__expect_send( + { + mock_device.id, + DoorLock.server.commands.SetPINCode(mock_device, + 1, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + } + ) + test.wait_for_events() + test.mock_time.advance_time(4) + test.socket.zigbee:__expect_send({ mock_device.id, DoorLock.server.commands.GetPINCode(mock_device, 1) }) + test.wait_for_events() + + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 1, + DoorLockUserStatus.OCCUPIED_DISABLED, + DoorLockUserType.UNRESTRICTED, + "" + ) + } + ) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 failed", { state_change = true }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 is not set", { state_change = true }))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Pin response for already-set slot without pending operation should use changed change type", + function() + init_code_slot(1, "initialName", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "initialName"}), { visibility = { displayed = false }}))) + test.wait_for_events() + + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 1, + DoorLockUserStatus.OCCUPIED_ENABLED, + DoorLockUserType.UNRESTRICTED, + "1234" + ) + } + ) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 changed", { data = { codeName = "initialName" }, state_change = true }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "initialName"}), { visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Pin response for already-set slot that is now empty should delete the code", + function() + init_code_slot(1, "initialName", mock_device) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({["1"] = "initialName"}), { visibility = { displayed = false }}))) + test.wait_for_events() + + test.socket.zigbee:__queue_receive( + { + mock_device.id, + DoorLock.client.commands.GetPINCodeResponse.build_test_rx( + mock_device, + 1, + DoorLockUserStatus.OCCUPIED_DISABLED, + DoorLockUserType.UNRESTRICTED, + "" + ) + } + ) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.codeChanged("1 deleted", { data = { codeName = "initialName" }, state_change = true }))) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.lockCodes.lockCodes(json.encode({}), { visibility = { displayed = false }}))) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/can_handle.lua b/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/can_handle.lua new file mode 100644 index 0000000000..a80632bf80 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local yale_fingerprint_lock_models = function(opts, driver, device) + local FINGERPRINTS = require("yale-fingerprint-lock.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("yale-fingerprint-lock") + end + end + return false +end + +return yale_fingerprint_lock_models diff --git a/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/fingerprints.lua b/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/fingerprints.lua new file mode 100644 index 0000000000..b3db27d719 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/fingerprints.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local YALE_FINGERPRINT_LOCK = { + { mfr = "ASSA ABLOY iRevo", model = "iZBModule01" }, + { mfr = "ASSA ABLOY iRevo", model = "c700000202" }, + { mfr = "ASSA ABLOY iRevo", model = "0700000001" }, + { mfr = "ASSA ABLOY iRevo", model = "06ffff2027" } +} + +return YALE_FINGERPRINT_LOCK diff --git a/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/init.lua b/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/init.lua index 9d0a0b4148..b78d043784 100644 --- a/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/init.lua +++ b/drivers/SmartThings/zigbee-lock/src/yale-fingerprint-lock/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local clusters = require "st.zigbee.zcl.clusters" local capabilities = require "st.capabilities" @@ -19,21 +9,7 @@ local LockCodes = capabilities.lockCodes local YALE_FINGERPRINT_MAX_CODES = 0x1E -local YALE_FINGERPRINT_LOCK = { - { mfr = "ASSA ABLOY iRevo", model = "iZBModule01" }, - { mfr = "ASSA ABLOY iRevo", model = "c700000202" }, - { mfr = "ASSA ABLOY iRevo", model = "0700000001" }, - { mfr = "ASSA ABLOY iRevo", model = "06ffff2027" } -} -local yale_fingerprint_lock_models = function(opts, driver, device) - for _, fingerprint in ipairs(YALE_FINGERPRINT_LOCK) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local handle_max_codes = function(driver, device, value) device:emit_event(LockCodes.maxCodes(YALE_FINGERPRINT_MAX_CODES), { visibility = { displayed = false } }) @@ -48,7 +24,7 @@ local yale_fingerprint_lock_driver = { } } }, - can_handle = yale_fingerprint_lock_models + can_handle = require("yale-fingerprint-lock.can_handle"), } return yale_fingerprint_lock_driver diff --git a/drivers/SmartThings/zigbee-lock/src/yale/can_handle.lua b/drivers/SmartThings/zigbee-lock/src/yale/can_handle.lua new file mode 100644 index 0000000000..54340c7811 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/yale/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function yale_can_handle(opts, driver, device, ...) + if device:get_manufacturer() == "ASSA ABLOY iRevo" or device:get_manufacturer() == "Yale" then + return true, require("yale") + end + return false +end + +return yale_can_handle diff --git a/drivers/SmartThings/zigbee-lock/src/yale/init.lua b/drivers/SmartThings/zigbee-lock/src/yale/init.lua index 73e984036e..c315fbfa06 100644 --- a/drivers/SmartThings/zigbee-lock/src/yale/init.lua +++ b/drivers/SmartThings/zigbee-lock/src/yale/init.lua @@ -1,16 +1,7 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + + -- Zigbee Spec Utils local clusters = require "st.zigbee.zcl.clusters" @@ -151,11 +142,8 @@ local yale_door_lock_driver = { [LockCodes.commands.setCode.NAME] = set_code } }, - - sub_drivers = { require("yale.yale-bad-battery-reporter") }, - can_handle = function(opts, driver, device, ...) - return device:get_manufacturer() == "ASSA ABLOY iRevo" or device:get_manufacturer() == "Yale" - end + sub_drivers = require("yale.sub_drivers"), + can_handle = require("yale.can_handle"), } return yale_door_lock_driver diff --git a/drivers/SmartThings/zigbee-lock/src/yale/sub_drivers.lua b/drivers/SmartThings/zigbee-lock/src/yale/sub_drivers.lua new file mode 100644 index 0000000000..4b546979d3 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/yale/sub_drivers.lua @@ -0,0 +1,8 @@ +-- 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("yale.yale-bad-battery-reporter"), +} +return sub_drivers diff --git a/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/can_handle.lua b/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/can_handle.lua new file mode 100644 index 0000000000..67169e9268 --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_bad_yale_lock_models = function(opts, driver, device) + local FINGERPRINTS = require("yale.yale-bad-battery-reporter.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("yale.yale-bad-battery-reporter") + end + end + return false +end + +return is_bad_yale_lock_models diff --git a/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/fingerprints.lua b/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/fingerprints.lua new file mode 100644 index 0000000000..cbb7c3404f --- /dev/null +++ b/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/fingerprints.lua @@ -0,0 +1,13 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local BAD_YALE_LOCK_FINGERPRINTS = { + { mfr = "Yale", model = "YRD220/240 TSDB" }, + { mfr = "Yale", model = "YRL220 TS LL" }, + { mfr = "Yale", model = "YRD210 PB DB" }, + { mfr = "Yale", model = "YRL210 PB LL" }, + { mfr = "ASSA ABLOY iRevo", model = "c700000202" }, + { mfr = "ASSA ABLOY iRevo", model = "06ffff2027" } +} + +return BAD_YALE_LOCK_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/init.lua b/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/init.lua index 59fdbf228b..3b77f32563 100644 --- a/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/init.lua +++ b/drivers/SmartThings/zigbee-lock/src/yale/yale-bad-battery-reporter/init.lua @@ -1,37 +1,11 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local clusters = require "st.zigbee.zcl.clusters" local capabilities = require "st.capabilities" -local BAD_YALE_LOCK_FINGERPRINTS = { - { mfr = "Yale", model = "YRD220/240 TSDB" }, - { mfr = "Yale", model = "YRL220 TS LL" }, - { mfr = "Yale", model = "YRD210 PB DB" }, - { mfr = "Yale", model = "YRL210 PB LL" }, - { mfr = "ASSA ABLOY iRevo", model = "c700000202" }, - { mfr = "ASSA ABLOY iRevo", model = "06ffff2027" } -} -local is_bad_yale_lock_models = function(opts, driver, device) - for _, fingerprint in ipairs(BAD_YALE_LOCK_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local battery_report_handler = function(driver, device, value) device:emit_event(capabilities.battery.battery(value.value)) @@ -46,7 +20,7 @@ local bad_yale_driver = { } } }, - can_handle = is_bad_yale_lock_models + can_handle = require("yale.yale-bad-battery-reporter.can_handle"), } return bad_yale_driver diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_all_capabilities_zigbee_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_all_capabilities_zigbee_motion.lua index 948d433c9f..088e211092 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_all_capabilities_zigbee_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_all_capabilities_zigbee_motion.lua @@ -46,6 +46,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -70,6 +73,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -94,6 +100,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -118,6 +127,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -142,6 +154,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -165,6 +180,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -181,6 +199,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 })) } + }, + { + min_api_version = 19 } ) @@ -197,6 +218,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -303,7 +327,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -388,7 +415,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -407,7 +435,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" }))) mock_device:expect_native_attr_handler_registration("temperatureMeasurement", "temperature") test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -424,7 +455,10 @@ test.register_coroutine_test( ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 79 }))) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aqara_high_precision.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aqara_high_precision.lua index e7bfcbf642..79bbd917c5 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aqara_high_precision.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aqara_high_precision.lua @@ -71,7 +71,10 @@ test.register_coroutine_test( sensitivityAdjustment.sensitivityAdjustment.Medium())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(100))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -91,7 +94,10 @@ test.register_coroutine_test( , data_types.Uint8, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -112,7 +118,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -134,7 +143,10 @@ test.register_coroutine_test( test.mock_time.advance_time(detect_duration) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) - end + end, + { + min_api_version = 19 + } ) local function build_write_attr_res(cluster, status) @@ -174,7 +186,10 @@ test.register_coroutine_test( local value = mock_device:get_field(PREF_CHANGED_VALUE) or 0 test.socket.capability:__expect_send(mock_device:generate_test_message("main", detectionFrequency.detectionFrequency(value, {visibility = {displayed = false}}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -188,7 +203,10 @@ test.register_coroutine_test( mock_device:set_field(PREF_CHANGED_VALUE, PREF_SENSITIVITY_VALUE_HIGH) test.socket.capability:__expect_send(mock_device:generate_test_message("main", sensitivityAdjustment.sensitivityAdjustment.High())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -202,7 +220,10 @@ test.register_coroutine_test( mock_device:set_field(PREF_CHANGED_VALUE, PREF_SENSITIVITY_VALUE_MEDIUM) test.socket.capability:__expect_send(mock_device:generate_test_message("main", sensitivityAdjustment.sensitivityAdjustment.Medium())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -216,7 +237,10 @@ test.register_coroutine_test( mock_device:set_field(PREF_CHANGED_VALUE, PREF_SENSITIVITY_VALUE_LOW) test.socket.capability:__expect_send(mock_device:generate_test_message("main", sensitivityAdjustment.sensitivityAdjustment.Low())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -251,7 +275,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, SENSITIVITY_ATTRIBUTE_ID, MFG_CODE , data_types.Uint8, PREF_SENSITIVITY_VALUE_LOW) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aqara_motion_illuminance.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aqara_motion_illuminance.lua index 2580af0ceb..2e4cf1993f 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aqara_motion_illuminance.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aqara_motion_illuminance.lua @@ -10,6 +10,10 @@ local data_types = require "st.zigbee.data_types" local capabilities = require "st.capabilities" local zigbee_test_utils = require "integration_test.zigbee_test_utils" local t_utils = require "integration_test.utils" +local messages = require "st.zigbee.messages" +local zb_const = require "st.zigbee.constants" +local write_attribute_response = require "st.zigbee.zcl.global_commands.write_attribute_response" +local zcl_messages = require "st.zigbee.zcl" test.add_package_capability("sensitivityAdjustment.yaml") test.add_package_capability("detectionFrequency.yaml") @@ -46,6 +50,29 @@ local function test_init() test.set_test_init_function(test_init) +local function build_write_attr_res(cluster, status) + local addr_header = messages.AddressHeader( + mock_device:get_short_address(), + mock_device.fingerprinted_endpoint_id, + zb_const.HUB.ADDR, + zb_const.HUB.ENDPOINT, + zb_const.HA_PROFILE_ID, + cluster + ) + local write_attribute_body = write_attribute_response.WriteAttributeResponse(status, {}) + local zcl_header = zcl_messages.ZclHeader({ + cmd = data_types.ZCLCommandId(write_attribute_body.ID) + }) + local message_body = zcl_messages.ZclMessageBody({ + zcl_header = zcl_header, + zcl_body = write_attribute_body + }) + return messages.ZigbeeMessageRx({ + address_header = addr_header, + body = message_body + }) +end + test.register_coroutine_test( "Handle added lifecycle", function() @@ -59,7 +86,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", detectionFrequency.detectionFrequency(PREF_FREQUENCY_VALUE_DEFAULT, {visibility = {displayed = false}}))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(100))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -79,7 +109,10 @@ test.register_coroutine_test( , data_types.Uint8, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -104,7 +137,10 @@ test.register_coroutine_test( test.mock_time.advance_time(detect_duration) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -120,7 +156,71 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, FREQUENCY_ATTRIBUTE_ID, MFG_CODE , data_types.Uint8, PREF_FREQUENCY_VALUE_DEFAULT) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Motion detected twice cancels existing timer and creates a new one", + function() + local detect_duration = PREF_FREQUENCY_VALUE_DEFAULT + -- Pre-register two timers: first will be cancelled, second will fire + test.timer.__create_and_queue_test_time_advance_timer(detect_duration, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(detect_duration, "oneshot") + local attr_report_data = { + { MOTION_ILLUMINANCE_ATTRIBUTE_ID, data_types.Int32.ID, 0x0001006E } -- 65646 + } + -- First motion event + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance(110)) + ) + test.wait_for_events() + -- Second motion event before first timer fires - cancels first timer + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance(110)) + ) + test.wait_for_events() + -- Only the second timer fires + test.mock_time.advance_time(detect_duration) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.motionSensor.motion.inactive())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "WriteAttributeResponse with PREF_FREQUENCY_KEY updates detection frequency", + function() + mock_device:set_field(PREF_CHANGED_KEY, PREF_FREQUENCY_KEY) + mock_device:set_field(PREF_CHANGED_VALUE, PREF_FREQUENCY_VALUE_DEFAULT) + test.socket.zigbee:__queue_receive({ + mock_device.id, + build_write_attr_res(PRIVATE_CLUSTER_ID, 0x00) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + detectionFrequency.detectionFrequency(PREF_FREQUENCY_VALUE_DEFAULT, {visibility = {displayed = false}}))) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aurora_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aurora_motion.lua index 1a5a292fc3..eb2a8c3adc 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aurora_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_aurora_motion.lua @@ -54,6 +54,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -78,6 +81,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -102,6 +108,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -126,6 +135,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -162,7 +174,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -204,7 +219,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_battery_voltage_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_battery_voltage_motion.lua index 737a594406..31ebd1c418 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_battery_voltage_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_battery_voltage_motion.lua @@ -50,7 +50,11 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } + ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_centralite_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_centralite_motion.lua index 1e35976fac..c6e49e32b6 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_centralite_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_centralite_motion.lua @@ -69,7 +69,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -92,7 +95,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device_old_firmware:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_compacta_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_compacta_motion.lua index 0660661d80..e8baf7897f 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_compacta_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_compacta_motion.lua @@ -75,7 +75,10 @@ test.register_coroutine_test( TemperatureMeasurement.attributes.MeasuredValue:configure_reporting(mock_device, 30, 300, 100):to_endpoint(0x03) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -96,7 +99,10 @@ test.register_coroutine_test( mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor.lua index 89d014dc90..e50eeac530 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor.lua @@ -69,42 +69,12 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(14)) } + }, + { + min_api_version = 19 } ) --- test.register_coroutine_test( --- "Health check should check all relevant attributes", --- function() --- test.wait_for_events() --- test.mock_time.advance_time(50000) --- test.socket.zigbee:__set_channel_ordering("relaxed") --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- IASZone.attributes.ZoneStatus:read(mock_device) --- } --- ) --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- OccupancySensing.attributes.Occupancy:read(mock_device):to_endpoint(OCCUPANCY_ENDPOINT) --- } --- ) --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- PowerConfiguration.attributes.BatteryVoltage:read(mock_device):to_endpoint(POWER_CONFIGURATION_ENDPOINT) --- } --- ) --- end, --- { --- test_init = function() --- test.mock_device.add_test_device(mock_device) --- test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check") --- end --- } --- ) - test.register_coroutine_test( "Refresh should read all necessary attributes", function() @@ -112,7 +82,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device):to_endpoint(POWER_CONFIGURATION_ENDPOINT)}) test.socket.zigbee:__expect_send({ mock_device.id, OccupancySensing.attributes.Occupancy:read(mock_device):to_endpoint(OCCUPANCY_ENDPOINT)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -130,6 +103,7 @@ test.register_coroutine_test( ) test.wait_for_events() + test.timer.__create_and_queue_test_time_advance_timer(5, "oneshot") test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) test.socket.zigbee:__expect_send({ @@ -227,7 +201,59 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + -- Advance time to trigger the do_refresh call scheduled in do_configure + test.wait_for_events() + test.mock_time.advance_time(5) + test.socket.zigbee:__expect_send({ + mock_device.id, + OccupancySensing.attributes.Occupancy:read(mock_device):to_endpoint(OCCUPANCY_ENDPOINT) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + PowerConfiguration.attributes.BatteryVoltage:read(mock_device):to_endpoint(POWER_CONFIGURATION_ENDPOINT) + }) + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Occupancy attribute handler emits motion active", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, OccupancySensing.attributes.Occupancy:build_test_attr_report(mock_device, 0x01) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Occupancy attribute handler emits motion inactive", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, OccupancySensing.attributes.Occupancy:build_test_attr_report(mock_device, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) + } + }, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -256,7 +282,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OccupancySensing.attributes.PIROccupiedToUnoccupiedDelay:write(mock_device, 200):to_endpoint(OCCUPANCY_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor2_pet.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor2_pet.lua index 6869412d49..0686d410cd 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor2_pet.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor2_pet.lua @@ -77,7 +77,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -93,6 +96,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(14)) } + }, + { + min_api_version = 19 } ) @@ -117,6 +123,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -136,6 +145,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 137 })) } + }, + { + min_api_version = 19 } ) @@ -187,7 +199,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, OccupancySensing.attributes.Occupancy:read(mock_device):to_endpoint(OCCUPANCY_ENDPOINT)}) test.socket.zigbee:__expect_send({mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device):to_endpoint(TEMPERATURE_MEASUREMENT_ENDPOINT)}) test.socket.zigbee:__expect_send({mock_device.id, IlluminanceMeasurement.attributes.MeasuredValue:read(mock_device):to_endpoint(ILLUMINANCE_ENDPOINT)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -342,7 +357,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -382,7 +400,10 @@ test.register_coroutine_test( temperatureSensitivity ):to_endpoint(TEMPERATURE_MEASUREMENT_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor_pro.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor_pro.lua index 9556a6e58e..dee4d52657 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor_pro.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_frient_motion_sensor_pro.lua @@ -80,7 +80,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -96,6 +99,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(14)) } + }, + { + min_api_version = 19 } ) @@ -113,6 +119,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -130,6 +139,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -154,6 +166,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -173,54 +188,12 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 137 })) } + }, + { + min_api_version = 19 } ) --- test.register_coroutine_test( --- "Health check should check all relevant attributes", --- function() --- test.wait_for_events() --- test.mock_time.advance_time(50000) --- test.socket.zigbee:__set_channel_ordering("relaxed") --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- IASZone.attributes.ZoneStatus:read(mock_device):to_endpoint(TAMPER_ENDPOINT) --- } --- ) --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- IlluminanceMeasurement.attributes.MeasuredValue:read(mock_device):to_endpoint(ILLUMINANCE_ENDPOINT) --- } --- ) --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- OccupancySensing.attributes.Occupancy:read(mock_device):to_endpoint(OCCUPANCY_ENDPOINT) --- } --- ) --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- PowerConfiguration.attributes.BatteryVoltage:read(mock_device):to_endpoint(POWER_CONFIGURATION_ENDPOINT) --- } --- ) --- test.socket.zigbee:__expect_send( --- { --- mock_device.id, --- TemperatureMeasurement.attributes.MeasuredValue:read(mock_device):to_endpoint(TEMPERATURE_MEASUREMENT_ENDPOINT) --- } --- ) --- end, --- { --- test_init = function() --- test.mock_device.add_test_device(mock_device) --- test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check") --- end --- } --- ) - test.register_coroutine_test( "Refresh should read all necessary attributes", function() @@ -231,7 +204,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, OccupancySensing.attributes.Occupancy:read(mock_device):to_endpoint(OCCUPANCY_ENDPOINT)}) test.socket.zigbee:__expect_send({mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device):to_endpoint(TEMPERATURE_MEASUREMENT_ENDPOINT)}) test.socket.zigbee:__expect_send({mock_device.id, IlluminanceMeasurement.attributes.MeasuredValue:read(mock_device):to_endpoint(ILLUMINANCE_ENDPOINT)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -389,7 +365,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -429,7 +408,50 @@ test.register_coroutine_test( temperatureSensitivity ):to_endpoint(TEMPERATURE_MEASUREMENT_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "IASZone attribute status handler: tamper detected", + { + { + channel = "zigbee", + direction = "receive", + -- ZoneStatus | Bit2: Tamper set to 1 + message = { mock_device.id, IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0004) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "IASZone attribute status handler: tamper clear", + { + { + channel = "zigbee", + direction = "receive", + -- ZoneStatus | Bit2: Tamper set to 0 + message = { mock_device.id, IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0000) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) + } + }, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_gator_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_gator_motion.lua index 7f47416e93..3635f43f76 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_gator_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_gator_motion.lua @@ -44,7 +44,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.active())) test.mock_time.advance_time(120) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -60,7 +63,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.presenceSensor.presence.present())) test.mock_time.advance_time(60) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.presenceSensor.presence.not_present())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -73,7 +79,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.open())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -86,7 +95,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -99,7 +111,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(100))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -112,7 +127,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(0))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -125,7 +143,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(10))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -140,7 +161,29 @@ test.register_coroutine_test( mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) test.wait_for_events() test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "ZoneStatusChangeNotification with alarm1 triggers motion active and inactive", + function() + test.timer.__create_and_queue_test_time_advance_timer(120, "oneshot") + test.socket.zigbee:__queue_receive( + { + mock_device.id, + IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0001, 0x00) + } + ) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.active())) + test.mock_time.advance_time(120) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_ikea_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_ikea_motion.lua index 12e0038c6c..f56fb96c1d 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_ikea_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_ikea_motion.lua @@ -58,6 +58,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -97,7 +100,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -117,7 +123,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(180) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -138,7 +147,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_add_hub_to_group(0xB9F2) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -197,7 +209,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, Groups.commands.AddGroup(mock_device, 0x0000) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -220,7 +235,38 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, Groups.commands.AddGroup(mock_device, 0x0000) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Second OnWithTimedOff cancels existing timer and resets motion", + function() + local frm_ctrl = FrameCtrl(0x01) + -- Pre-register two timers: first will be cancelled, second will fire + test.timer.__create_and_queue_test_time_advance_timer(0x0708/10, "oneshot") + test.timer.__create_and_queue_test_time_advance_timer(0x0708/10, "oneshot") + -- First motion event + local first_cmd = OnOff.server.commands.OnWithTimedOff.build_test_rx(mock_device, 0x00, 0x0708, 0x0000) + first_cmd.body.zcl_header.frame_ctrl = frm_ctrl + test.socket.zigbee:__queue_receive({mock_device.id, first_cmd}) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.active())) + test.wait_for_events() + -- Second motion event before first timer fires - cancels first timer + local second_cmd = OnOff.server.commands.OnWithTimedOff.build_test_rx(mock_device, 0x00, 0x0708, 0x0000) + second_cmd.body.zcl_header.frame_ctrl = frm_ctrl + test.socket.zigbee:__queue_receive({mock_device.id, second_cmd}) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.active())) + test.wait_for_events() + -- Only the second timer fires + test.mock_time.advance_time(180) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_samjin_sensor.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_samjin_sensor.lua index d966d301f3..09a7355b6a 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_samjin_sensor.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_samjin_sensor.lua @@ -93,7 +93,10 @@ test.register_coroutine_test( -- zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, IASZone.ID) -- }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -115,7 +118,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_sengled_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_sengled_motion.lua index 4450761c5d..745639cdf2 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_sengled_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_sengled_motion.lua @@ -44,7 +44,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:configure_reporting(mock_device, 0xFFFF, 0x0000, 0) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -93,7 +96,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_smartsense_motion_sensor.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_smartsense_motion_sensor.lua index f96322467f..8e15316aa0 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_smartsense_motion_sensor.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_smartsense_motion_sensor.lua @@ -67,7 +67,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.lqi(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.rssi({ value = -50, unit = "dBm" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -81,7 +84,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.active())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.lqi(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.rssi({ value = -50, unit = "dBm" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -95,7 +101,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.lqi(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.rssi({ value = -50, unit = "dBm" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -109,7 +118,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.active())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.lqi(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.rssi({ value = -50, unit = "dBm" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -122,7 +134,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.lqi(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.rssi({ value = -50, unit = "dBm" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -135,7 +150,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.active())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.lqi(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.rssi({ value = -50, unit = "dBm" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -149,7 +167,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.lqi(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.rssi({ value = -50, unit = "dBm" }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -159,7 +180,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.lqi(0))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.signalStrength.rssi({value = -100, unit = 'dBm'}))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_smartthings_motion.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_smartthings_motion.lua index 5211ce1982..02bd5bf744 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_smartthings_motion.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_smartthings_motion.lua @@ -53,7 +53,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_thirdreality_sensor.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_thirdreality_sensor.lua index ddeaf77ce4..16d018d803 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_thirdreality_sensor.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_thirdreality_sensor.lua @@ -68,7 +68,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device1:generate_test_message("main", capabilities.battery.battery(55)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -91,7 +94,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device1:generate_test_message("main", capabilities.battery.battery(100)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -114,7 +120,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device2:generate_test_message("main", capabilities.battery.battery(55)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -137,7 +146,32 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device2:generate_test_message("main", capabilities.battery.battery(100)) ) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Handle added lifecycle - reads ApplicationVersion", + { + { + channel = "device_lifecycle", + direction = "receive", + message = {mock_device1.id, "added"} + }, + { + channel = "zigbee", + direction = "send", + message = { + mock_device1.id, + Basic.attributes.ApplicationVersion:read(mock_device1) + } + } + }, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_iris.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_iris.lua index f0cd1053dc..5dcc3e57a1 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_iris.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_iris.lua @@ -54,7 +54,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -139,7 +142,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_nyce.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_nyce.lua index e368e852c8..0f25100055 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_nyce.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_nyce.lua @@ -44,6 +44,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -60,6 +63,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -86,7 +92,11 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } + ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_orvibo.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_orvibo.lua index 1f586bce88..e6d7fa615d 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_orvibo.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_motion_orvibo.lua @@ -44,6 +44,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -60,6 +63,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -76,6 +82,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -92,6 +101,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -116,7 +128,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -140,7 +155,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_plugin_motion_sensor.lua b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_plugin_motion_sensor.lua index 78634bbaa2..499e96f745 100644 --- a/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_plugin_motion_sensor.lua +++ b/drivers/SmartThings/zigbee-motion-sensor/src/test/test_zigbee_plugin_motion_sensor.lua @@ -47,6 +47,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -63,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -107,6 +113,9 @@ test.register_message_test( OccupancySensing.attributes.Occupancy:read(mock_device) } }, + }, + { + min_api_version = 19 } ) @@ -128,7 +137,10 @@ test.register_coroutine_test( ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter.lua b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter.lua index 5f96805360..1787af3b0d 100644 --- a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter.lua +++ b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter.lua @@ -90,7 +90,8 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) @@ -116,7 +117,8 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) @@ -141,7 +143,8 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) @@ -166,7 +169,8 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) @@ -189,6 +193,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 2.7, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -210,6 +217,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 0.027, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -279,7 +289,10 @@ test.register_coroutine_test( SimpleMetering.attributes.Divisor:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_1p.lua b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_1p.lua index 5308e11ee2..384e893b30 100644 --- a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_1p.lua +++ b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_1p.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local clusters = require "st.zigbee.zcl.clusters" local ElectricalMeasurement = clusters.ElectricalMeasurement @@ -7,6 +10,7 @@ local zigbee_test_utils = require "integration_test.zigbee_test_utils" local t_utils = require "integration_test.utils" local cluster_base = require "st.zigbee.cluster_base" local data_types = require "st.zigbee.data_types" +local constants = require "st.zigbee.constants" -- Mock out globals @@ -70,7 +74,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 2.0, unit = "kWh"})) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -87,6 +94,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.powerMeter.power({ value = 27.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -104,6 +114,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.powerMeter.power({ value = 27.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -121,6 +134,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.currentMeasurement.current({ value = 0.34, unit = "A" })) } + }, + { + min_api_version = 19 } ) @@ -138,6 +154,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.voltageMeasurement.voltage({ value = 220.0, unit = "V" })) } + }, + { + min_api_version = 19 } ) @@ -219,7 +238,118 @@ test.register_coroutine_test( ElectricalMeasurement.attributes.ACPowerDivisor:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "resetEnergyMeter command should send OnOff On to reset device", + { + { + channel = "capability", + direction = "receive", + message = { mock_device.id, { capability = "energyMeter", component = "main", command = "resetEnergyMeter", args = {} } } + }, + { + channel = "zigbee", + direction = "send", + message = { mock_device.id, clusters.OnOff.server.commands.On(mock_device) } + } + }, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.register_coroutine_test( + "refresh capability command should read device attributes", + function() + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "refresh", component = "main", command = "refresh", args = {} } + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + SimpleMetering.attributes.CurrentSummationDelivered:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + SimpleMetering.attributes.InstantaneousDemand:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + cluster_base.read_attribute(mock_device, data_types.ClusterId(SimpleMetering.ID), data_types.AttributeId(0x0001)) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + ElectricalMeasurement.attributes.ActivePower:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + ElectricalMeasurement.attributes.RMSVoltage:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + ElectricalMeasurement.attributes.RMSCurrent:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + ElectricalMeasurement.attributes.ACPowerMultiplier:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + ElectricalMeasurement.attributes.ACPowerDivisor:read(mock_device) + }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "energy handler resets offset when reading is below stored offset", + function() + -- Set an offset larger than the incoming value (100 raw / 100 = 1.0 kWh, offset = 5.0) + mock_device:set_field(constants.ENERGY_METER_OFFSET, 5.0, {persist = true}) + test.socket.zigbee:__queue_receive({ + mock_device.id, + SimpleMetering.attributes.CurrentSummationDelivered:build_test_attr_report(mock_device, 100) + }) + -- Offset resets to 0; raw_value_kilowatts = 1.0 - 0 = 1.0; no powerConsumptionReport (delta_tick < 15 min) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 1.0, unit = "kWh"})) + ) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "energy handler resets save tick when timer has slipped beyond 30 minutes", + function() + -- Advance time > 30 min so that curr_save_tick + 15*60 < os.time() is true + test.timer.__create_and_queue_test_time_advance_timer(40*60, "oneshot") + test.mock_time.advance_time(40*60) + test.socket.zigbee:__queue_receive({ + mock_device.id, + SimpleMetering.attributes.CurrentSummationDelivered:build_test_attr_report(mock_device, 100) + }) + -- raw_value = 100, divisor = 100, kWh = 1.0, watts = 1000.0; first report: deltaEnergy = 0.0 + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({energy = 1000.0, deltaEnergy = 0.0})) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 1.0, unit = "kWh"})) + ) + end, + { + min_api_version = 19 + } +) + +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_2p.lua b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_2p.lua index b85c955005..b6621e5673 100644 --- a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_2p.lua +++ b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_2p.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local clusters = require "st.zigbee.zcl.clusters" local ElectricalMeasurement = clusters.ElectricalMeasurement @@ -68,7 +71,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 2.0, unit = "kWh"})) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -85,6 +91,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.powerMeter.power({ value = 27.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -102,6 +111,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.currentMeasurement.current({ value = 0.34, unit = "A" })) } + }, + { + min_api_version = 19 } ) @@ -119,6 +131,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.voltageMeasurement.voltage({ value = 220.0, unit = "V" })) } + }, + { + min_api_version = 19 } ) @@ -136,6 +151,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseB", capabilities.powerMeter.power({ value = 27.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -153,6 +171,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseB", capabilities.currentMeasurement.current({ value = 0.34, unit = "A" })) } + }, + { + min_api_version = 19 } ) @@ -170,6 +191,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseB", capabilities.voltageMeasurement.voltage({ value = 220.0, unit = "V" })) } + }, + { + min_api_version = 19 } ) @@ -275,7 +299,11 @@ test.register_coroutine_test( SimpleMetering.attributes.InstantaneousDemand:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_3p.lua b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_3p.lua index fad26aad40..419d737b69 100644 --- a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_3p.lua +++ b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_3p.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local clusters = require "st.zigbee.zcl.clusters" local ElectricalMeasurement = clusters.ElectricalMeasurement @@ -67,7 +70,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 2.0, unit = "kWh"})) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -84,6 +90,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.powerMeter.power({ value = 27.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -101,6 +110,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.currentMeasurement.current({ value = 0.34, unit = "A" })) } + }, + { + min_api_version = 19 } ) @@ -118,6 +130,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseA", capabilities.voltageMeasurement.voltage({ value = 220.0, unit = "V" })) } + }, + { + min_api_version = 19 } ) @@ -135,6 +150,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseB", capabilities.powerMeter.power({ value = 27.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -152,6 +170,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseB", capabilities.currentMeasurement.current({ value = 0.34, unit = "A" })) } + }, + { + min_api_version = 19 } ) @@ -169,6 +190,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseB", capabilities.voltageMeasurement.voltage({ value = 220.0, unit = "V" })) } + }, + { + min_api_version = 19 } ) @@ -186,6 +210,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseC", capabilities.powerMeter.power({ value = 27.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -203,6 +230,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseC", capabilities.currentMeasurement.current({ value = 0.34, unit = "A" })) } + }, + { + min_api_version = 19 } ) @@ -220,6 +250,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("PhaseC", capabilities.voltageMeasurement.voltage({ value = 220.0, unit = "V" })) } + }, + { + min_api_version = 19 } ) @@ -349,7 +382,11 @@ test.register_coroutine_test( SimpleMetering.attributes.InstantaneousDemand:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_consumption_report_sihas.lua b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_consumption_report_sihas.lua index a4b8b8c037..56dd597d92 100644 --- a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_consumption_report_sihas.lua +++ b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_consumption_report_sihas.lua @@ -26,6 +26,7 @@ local zb_const = require "st.zigbee.constants" local zcl_messages = require "st.zigbee.zcl" local data_types = require "st.zigbee.data_types" local Status = require "st.zigbee.generated.types.ZclStatus" +local constants = require "st.zigbee.constants" local mock_device = test.mock_device.build_test_zigbee_device( @@ -97,6 +98,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 27.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -139,7 +143,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 2.0, unit = "kWh"})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -200,7 +207,10 @@ test.register_coroutine_test( ElectricalMeasurement.attributes.ACPowerDivisor:configure_reporting(mock_device, 1, 43200, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -225,9 +235,51 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) +test.register_coroutine_test( + "energy handler resets shinasystems offset when reading is below stored offset", + function() + -- divisor=1000; raw_value=100 -> 0.1 kWh; offset=0.5 -> 0.1 < 0.5 triggers reset + mock_device:set_field(constants.ENERGY_METER_OFFSET, 0.5, {persist = true}) + test.socket.zigbee:__queue_receive({ + mock_device.id, + SimpleMetering.attributes.CurrentSummationDelivered:build_test_attr_report(mock_device, 100) + }) + -- offset resets to 0; raw_value_kilowatts = 0.1; no powerConsumptionReport (delta_tick < 15 min) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 0.1, unit = "kWh"})) + ) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "shinasystems energy handler resets save tick when timer has slipped beyond 30 minutes", + function() + -- Advance time > 30 min so that curr_save_tick + 15*60 < os.time() is true + test.timer.__create_and_queue_test_time_advance_timer(40*60, "oneshot") + test.mock_time.advance_time(40*60) + test.socket.zigbee:__queue_receive({ + mock_device.id, + SimpleMetering.attributes.CurrentSummationDelivered:build_test_attr_report(mock_device, 1500) + }) + -- raw_value=1500, divisor=1000, kWh=1.5, watts=1500.0; first report: deltaEnergy=0.0 + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({energy = 1500.0, deltaEnergy = 0.0})) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 1.5, unit = "kWh"})) + ) + end, + { + min_api_version = 19 + } +) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_ezex.lua b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_ezex.lua index 7f582d55b7..8673e2d468 100644 --- a/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_ezex.lua +++ b/drivers/SmartThings/zigbee-power-meter/src/test/test_zigbee_power_meter_ezex.lua @@ -91,6 +91,9 @@ test.register_message_test( message = { mock_device.id, ElectricalMeasurement.attributes.ActivePower:build_test_attr_report(mock_device, 27) }, } + }, + { + min_api_version = 19 } ) @@ -127,6 +130,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 0.0015, unit = "kWh"})) } + }, + { + min_api_version = 19 } ) @@ -158,7 +164,10 @@ test.register_coroutine_test( SimpleMetering.attributes.CurrentSummationDelivered:configure_reporting(mock_device, 5, 3600, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -183,7 +192,8 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-presence-sensor/src/test/test_aqara_presence_sensor_fp1.lua b/drivers/SmartThings/zigbee-presence-sensor/src/test/test_aqara_presence_sensor_fp1.lua index 56740db3c8..dc630a78e4 100644 --- a/drivers/SmartThings/zigbee-presence-sensor/src/test/test_aqara_presence_sensor_fp1.lua +++ b/drivers/SmartThings/zigbee-presence-sensor/src/test/test_aqara_presence_sensor_fp1.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local cluster_base = require "st.zigbee.cluster_base" local t_utils = require "integration_test.utils" @@ -58,7 +61,10 @@ test.register_coroutine_test( data_types.Uint8, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -83,7 +89,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x010C, MFG_CODE, data_types.Uint8, updates.preferences["stse.sensitivity"]) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -108,7 +117,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESET_MODE, MFG_CODE, data_types.Uint8, 0x01) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -133,7 +145,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0146, MFG_CODE, data_types.Uint8, updates.preferences["stse.approachDistance"]) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -148,7 +163,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", PresenceSensor.presence("present"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +181,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", PresenceSensor.presence("not present"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -183,7 +204,10 @@ test.register_coroutine_test( test.mock_time.advance_time(movement_timer) test.socket.capability:__expect_send(mock_device:generate_test_message("main", MovementSensor.movement("noMovement"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -203,7 +227,10 @@ test.register_coroutine_test( test.mock_time.advance_time(movement_timer) test.socket.capability:__expect_send(mock_device:generate_test_message("main", MovementSensor.movement("noMovement"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -223,7 +250,10 @@ test.register_coroutine_test( test.mock_time.advance_time(movement_timer) test.socket.capability:__expect_send(mock_device:generate_test_message("main", MovementSensor.movement("noMovement"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -243,7 +273,10 @@ test.register_coroutine_test( test.mock_time.advance_time(movement_timer) test.socket.capability:__expect_send(mock_device:generate_test_message("main", MovementSensor.movement("noMovement"))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-presence-sensor/src/test/test_st_arrival_sensor_v1.lua b/drivers/SmartThings/zigbee-presence-sensor/src/test/test_st_arrival_sensor_v1.lua index 123edc9de1..8ecc7f1ff1 100644 --- a/drivers/SmartThings/zigbee-presence-sensor/src/test/test_st_arrival_sensor_v1.lua +++ b/drivers/SmartThings/zigbee-presence-sensor/src/test/test_st_arrival_sensor_v1.lua @@ -96,7 +96,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(7) end - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -114,7 +117,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -123,7 +127,10 @@ test.register_coroutine_test( function () add_device() add_device_after_switch_over() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -135,7 +142,10 @@ test.register_coroutine_test( }) test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("present"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -148,7 +158,10 @@ test.register_coroutine_test( test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_simple_device:generate_test_message("main", capabilities.battery.battery(100))) test.socket.capability:__expect_send(mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("present"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -161,7 +174,10 @@ test.register_coroutine_test( test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_simple_device:generate_test_message("main", capabilities.battery.battery(75))) test.socket.capability:__expect_send(mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("present"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -174,7 +190,10 @@ test.register_coroutine_test( test.socket.capability:__set_channel_ordering("relaxed") test.socket.capability:__expect_send(mock_simple_device:generate_test_message("main", capabilities.battery.battery(0))) test.socket.capability:__expect_send(mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("present"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -188,7 +207,7 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("not present")) ) end, { - test_init = function() end + test_init = function() end, min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-presence-sensor/src/test/test_zigbee_presence_sensor.lua b/drivers/SmartThings/zigbee-presence-sensor/src/test/test_zigbee_presence_sensor.lua index 6957148647..ba6defe3db 100644 --- a/drivers/SmartThings/zigbee-presence-sensor/src/test/test_zigbee_presence_sensor.lua +++ b/drivers/SmartThings/zigbee-presence-sensor/src/test/test_zigbee_presence_sensor.lua @@ -10,6 +10,7 @@ local PowerConfiguration = clusters.PowerConfiguration local capabilities = require "st.capabilities" local zigbee_test_utils = require "integration_test.zigbee_test_utils" local t_utils = require "integration_test.utils" +local presence_utils = require "presence_utils" -- Needed for building ConfigureReportingResponse msg local messages = require "st.zigbee.messages" @@ -77,7 +78,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -94,6 +96,9 @@ test.register_message_test( direction = "send", message = { mock_simple_device.id, IdentifyCluster.server.commands.Identify(mock_simple_device, 0x05) } } + }, + { + min_api_version = 19 } ) @@ -145,7 +150,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence.present())) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -178,7 +186,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_simple_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -186,7 +197,10 @@ test.register_coroutine_test( function () add_device() add_device_after_switch_over() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -200,7 +214,7 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("not present")) ) end, { - test_init = function() end + test_init = function() end, min_api_version = 19 } ) @@ -229,7 +243,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(121) test.socket.capability:__expect_send( mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("not present")) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -261,7 +278,10 @@ test.register_coroutine_test( test.mock_time.advance_time(305) test.socket.capability:__expect_send( mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("not present")) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -291,7 +311,110 @@ test.register_coroutine_test( PowerConfiguration.ID ) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "battery_config_response_handler cancels pre-existing recurring poll timer", + function() + -- Place a live timer in the field so the nil-check branch is taken. + local pre_timer = test.timer.__create_test_time_advance_timer(60, "interval") + mock_simple_device:set_field(presence_utils.RECURRING_POLL_TIMER, pre_timer) + test.socket.zigbee:__queue_receive({ + mock_simple_device.id, + build_config_response_msg(PowerConfiguration.ID, 0x00) + }) + -- poke() emits "present" for every inbound zigbee message + test.socket.capability:__expect_send( + mock_simple_device:generate_test_message("main", capabilities.presenceSensor.presence("present")) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "info_changed with changed check_interval cancels existing recurring poll timer", + function() + local pre_timer = test.timer.__create_test_time_advance_timer(60, "interval") + mock_simple_device:set_field(presence_utils.RECURRING_POLL_TIMER, pre_timer) + test.socket.device_lifecycle():__queue_receive( + mock_simple_device:generate_info_changed({ preferences = { check_interval = 100 } }) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +-- Build two additional mock devices (module-level) for checkInterval type variants. +-- The profile default sets checkInterval = 120 (number); we override after building. +local mock_device_str_interval = test.mock_device.build_test_zigbee_device( + { + profile = t_utils.get_profile_definition("smartthings-arrival-sensor.yml"), + zigbee_endpoints = { + [1] = { + id = 1, + manufacturer = "SmartThings", + model = "tagv4", + server_clusters = {0x0000, 0x0001, 0x0003} + } + } + } +) +mock_device_str_interval.preferences.checkInterval = "120" -- string → triggers elseif branch + +local mock_device_nil_interval = test.mock_device.build_test_zigbee_device( + { + profile = t_utils.get_profile_definition("smartthings-arrival-sensor.yml"), + zigbee_endpoints = { + [1] = { + id = 1, + manufacturer = "SmartThings", + model = "tagv4", + server_clusters = {0x0000, 0x0001, 0x0003} + } + } + } +) +mock_device_nil_interval.preferences.checkInterval = nil -- nil → triggers default-return branch + +test.register_coroutine_test( + "init with string checkInterval uses parsed value for presence timeout", + function() + test.mock_device.add_test_device(mock_device_str_interval) + test.timer.__create_and_queue_test_time_advance_timer(120, "oneshot") + test.socket.device_lifecycle:__queue_receive({ mock_device_str_interval.id, "init" }) + test.wait_for_events() + test.mock_time.advance_time(121) + test.socket.capability:__expect_send( + mock_device_str_interval:generate_test_message("main", capabilities.presenceSensor.presence("not present")) + ) + end, + { test_init = function() end, min_api_version = 19 + } +) + +test.register_coroutine_test( + "init with nil checkInterval uses default presence timeout", + function() + test.mock_device.add_test_device(mock_device_nil_interval) + test.timer.__create_and_queue_test_time_advance_timer(120, "oneshot") + test.socket.device_lifecycle:__queue_receive({ mock_device_nil_interval.id, "init" }) + test.wait_for_events() + test.mock_time.advance_time(121) + test.socket.capability:__expect_send( + mock_device_nil_interval:generate_test_message("main", capabilities.presenceSensor.presence("not present")) + ) + end, + { test_init = function() end, min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-range-extender/src/test/test_frient_zigbee_range_extender.lua b/drivers/SmartThings/zigbee-range-extender/src/test/test_frient_zigbee_range_extender.lua index 4aa03d2bca..e3013f4631 100644 --- a/drivers/SmartThings/zigbee-range-extender/src/test/test_frient_zigbee_range_extender.lua +++ b/drivers/SmartThings/zigbee-range-extender/src/test/test_frient_zigbee_range_extender.lua @@ -50,7 +50,10 @@ test.register_coroutine_test( PowerConfiguration.attributes.BatteryVoltage:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -91,7 +94,10 @@ test.register_coroutine_test( mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -107,6 +113,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) } + }, + { + min_api_version = 19 } ) @@ -123,6 +132,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.battery()) } + }, + { + min_api_version = 19 } ) @@ -139,6 +151,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -155,6 +170,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(50)) } + }, + { + min_api_version = 19 } ) @@ -171,7 +189,48 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) +test.register_message_test( + "ZoneStatusChangeNotification - mains should be handled", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0001, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Device added lifecycle should emit mains powerSource", + { + { + channel = "device_lifecycle", + direction = "receive", + message = { mock_device.id, "added" } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) + } + }, + { + min_api_version = 19 + } +) + test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-range-extender/src/test/test_zigbee_extend.lua b/drivers/SmartThings/zigbee-range-extender/src/test/test_zigbee_extend.lua index c76e228cef..1423b1ab90 100644 --- a/drivers/SmartThings/zigbee-range-extender/src/test/test_zigbee_extend.lua +++ b/drivers/SmartThings/zigbee-range-extender/src/test/test_zigbee_extend.lua @@ -28,7 +28,10 @@ test.register_coroutine_test( Basic.attributes.ZCLVersion:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) -- test.register_coroutine_test( diff --git a/drivers/SmartThings/zigbee-sensor/src/test/test_zigbee_sensor.lua b/drivers/SmartThings/zigbee-sensor/src/test/test_zigbee_sensor.lua index a87f7a0550..eaa8663726 100644 --- a/drivers/SmartThings/zigbee-sensor/src/test/test_zigbee_sensor.lua +++ b/drivers/SmartThings/zigbee-sensor/src/test/test_zigbee_sensor.lua @@ -119,7 +119,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({mock_device_generic_sensor.id, ZoneTypeAttribute:build_test_attr_report(mock_device_generic_sensor, 0x0015)}) mock_device_generic_sensor:expect_metadata_update({profile = ZIGBEE_GENERIC_CONTACT_SENSOR_PROFILE}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -128,7 +131,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({mock_device_generic_sensor.id, ZoneTypeAttribute:build_test_attr_report(mock_device_generic_sensor, 0x000d)}) mock_device_generic_sensor:expect_metadata_update({profile = ZIGBEE_GENERIC_MOTION_SENSOR_PROFILE}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -136,7 +142,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({mock_device_motion_illuminance.id, ZoneTypeAttribute:build_test_attr_report(mock_device_motion_illuminance, 0x000d)}) mock_device_motion_illuminance:expect_metadata_update({profile = ZIGBEE_GENERIC_MOTION_ILLUMINANCE_PROFILE}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -144,7 +153,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({mock_device_generic_sensor.id, ZoneTypeAttribute:build_test_attr_report(mock_device_generic_sensor, 0x002a)}) mock_device_generic_sensor:expect_metadata_update({profile = ZIGBEE_GENERIC_WATERLEAK_SENSOR_PROFILE}) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -160,6 +172,9 @@ test.register_message_test( direction = "send", message = mock_device_contact_sensor:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -176,6 +191,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_sensor:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -192,6 +210,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_illuminance:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -208,6 +229,9 @@ test.register_message_test( direction = "send", message = mock_device_waterleak_sensor:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -224,6 +248,9 @@ test.register_message_test( direction = "send", message = mock_device_contact_sensor:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -240,6 +267,9 @@ test.register_message_test( direction = "send", message = mock_device_contact_sensor:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -258,6 +288,9 @@ test.register_message_test( direction = "send", message = mock_device_contact_sensor:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -276,6 +309,9 @@ test.register_message_test( direction = "send", message = mock_device_contact_sensor:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -292,6 +328,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -308,6 +347,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -324,6 +366,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -340,6 +385,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -356,6 +404,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_illuminance:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -372,6 +423,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_illuminance:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -391,6 +445,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_illuminance:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 137 })) } + }, + { + min_api_version = 19 } ) @@ -407,6 +464,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_illuminance:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -423,6 +483,9 @@ test.register_message_test( direction = "send", message = mock_device_motion_illuminance:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -439,6 +502,9 @@ test.register_message_test( direction = "send", message = mock_device_waterleak_sensor:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -455,6 +521,9 @@ test.register_message_test( direction = "send", message = mock_device_waterleak_sensor:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -471,6 +540,9 @@ test.register_message_test( direction = "send", message = mock_device_waterleak_sensor:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -487,6 +559,9 @@ test.register_message_test( direction = "send", message = mock_device_waterleak_sensor:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -597,7 +672,10 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_send({ mock_device_contact_sensor.id, ZoneStatusAttribute:read(mock_device_contact_sensor) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -614,7 +692,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_send({ mock_device_motion_sensor.id, ZoneStatusAttribute:read(mock_device_motion_sensor) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -631,7 +712,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_send({ mock_device_motion_illuminance.id, ZoneStatusAttribute:read(mock_device_motion_illuminance) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -648,7 +732,10 @@ test.register_coroutine_test( } ) test.socket.zigbee:__expect_send({ mock_device_waterleak_sensor.id, ZoneStatusAttribute:read(mock_device_waterleak_sensor) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -719,7 +806,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device_contact_sensor.id, IASZone.attributes.ZoneStatus:read(mock_device_contact_sensor) }) mock_device_contact_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -782,7 +872,10 @@ test.register_coroutine_test( } ) mock_device_motion_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -845,7 +938,10 @@ test.register_coroutine_test( } ) mock_device_motion_illuminance:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -909,7 +1005,11 @@ test.register_coroutine_test( } ) mock_device_waterleak_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-siren/src/test/test_frient_siren.lua b/drivers/SmartThings/zigbee-siren/src/test/test_frient_siren.lua index 8140da64bd..13f3e9a913 100644 --- a/drivers/SmartThings/zigbee-siren/src/test/test_frient_siren.lua +++ b/drivers/SmartThings/zigbee-siren/src/test/test_frient_siren.lua @@ -257,7 +257,10 @@ test.register_coroutine_test( mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -374,7 +377,10 @@ test.register_coroutine_test( capabilities.alarm.alarm.off() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -402,7 +408,10 @@ test.register_coroutine_test( -- Expect the OFF command get_siren_OFF_commands() test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -429,7 +438,10 @@ test.register_coroutine_test( -- Expect the OFF command get_siren_OFF_commands() test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -442,7 +454,10 @@ test.register_coroutine_test( }) get_siren_OFF_commands() test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -499,7 +514,10 @@ test.register_coroutine_test( -- stop the siren -- Expect the OFF command get_siren_OFF_commands() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -582,7 +600,10 @@ test.register_coroutine_test( ) -- Expect the OFF command get_siren_OFF_commands() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -658,7 +679,10 @@ test.register_coroutine_test( -- stop the siren -- Expect the OFF command get_siren_OFF_commands(expectedWarningDuration) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -682,7 +706,10 @@ test.register_coroutine_test( -- Expect the command with given configuration get_squawk_command_new_fw( SquawkMode.SOUND_FOR_SYSTEM_IS_ARMED, IaswdLevel.VERY_HIGH_LEVEL ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -705,7 +732,10 @@ test.register_coroutine_test( -- Expect the command with given configuration get_squawk_command_older_fw( SquawkMode.SOUND_FOR_SYSTEM_IS_ARMED, IaswdLevel.VERY_HIGH_LEVEL ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -747,7 +777,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) -- Expect the command with given configuration get_squawk_command_new_fw(SquawkMode.SOUND_FOR_SYSTEM_IS_DISARMED, IaswdLevel.MEDIUM_LEVEL) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -789,7 +822,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) -- Expect the command with given configuration get_squawk_command_older_fw(SquawkMode.SOUND_FOR_SYSTEM_IS_DISARMED, IaswdLevel.MEDIUM_LEVEL) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -843,7 +879,10 @@ test.register_coroutine_test( ) -- Expect the command with given configuration get_squawk_command_new_fw(SquawkMode.SOUND_FOR_SYSTEM_IS_DISARMED, IaswdLevel.MEDIUM_LEVEL) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -874,7 +913,10 @@ test.register_coroutine_test( } ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -918,7 +960,10 @@ test.register_coroutine_test( } ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -934,6 +979,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) } + }, + { + min_api_version = 19 } ) @@ -950,6 +998,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.battery()) } + }, + { + min_api_version = 19 } ) @@ -966,6 +1017,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -982,6 +1036,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(50)) } + }, + { + min_api_version = 19 } ) @@ -998,7 +1055,136 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 + } +) + +local function build_sw_version_attr_report(device, fw_bytes) + local zcl_messages_mod = require "st.zigbee.zcl" + local messages_mod = require "st.zigbee.messages" + local zb_const_mod = require "st.zigbee.constants" + local report_attr = require "st.zigbee.zcl.global_commands.report_attribute" + local zcl_cmds_mod = require "st.zigbee.zcl.global_commands" + + local attr_record = report_attr.ReportAttributeAttributeRecord( + DEVELCO_BASIC_PRIMARY_SW_VERSION_ATTR, + data_types.CharString.ID, + fw_bytes + ) + local report_body = report_attr.ReportAttribute({ attr_record }) + local zclh = zcl_messages_mod.ZclHeader({ + cmd = data_types.ZCLCommandId(zcl_cmds_mod.REPORT_ATTRIBUTE_ID) + }) + local addrh = messages_mod.AddressHeader( + device:get_short_address(), + device:get_endpoint(Basic.ID), + zb_const_mod.HUB.ADDR, + zb_const_mod.HUB.ENDPOINT, + zb_const_mod.HA_PROFILE_ID, + Basic.ID + ) + local message_body = zcl_messages_mod.ZclMessageBody({ zcl_header = zclh, zcl_body = report_body }) + return messages_mod.ZigbeeMessageRx({ address_header = addrh, body = message_body }) +end + +test.register_coroutine_test( + "SW version attr handler with new firmware should configure battery percentage", + function() + mock_device:set_field(PRIMARY_SW_VERSION, nil, {persist = true}) + mock_device:set_field("_frient_battery_config_applied", nil, {persist = true}) + + -- Binary "\x01\x09\x03" -> hex "010903" (new firmware >= SIREN_FIXED_ENDIAN_SW_VERSION) + test.socket.zigbee:__queue_receive({ + mock_device.id, + build_sw_version_attr_report(mock_device, "\x01\x09\x03") + }) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "SW version attr handler with old firmware should configure battery voltage", + function() + mock_device:set_field(PRIMARY_SW_VERSION, nil, {persist = true}) + mock_device:set_field("_frient_battery_config_applied", nil, {persist = true}) + + -- Binary "\x01\x09\x01" -> hex "010901" (old firmware < SIREN_FIXED_ENDIAN_SW_VERSION) + test.socket.zigbee:__queue_receive({ + mock_device.id, + build_sw_version_attr_report(mock_device, "\x01\x09\x01") + }) + test.wait_for_events() + end, + { + min_api_version = 19 } ) -test.run_registered_tests() \ No newline at end of file +test.register_coroutine_test( + "doConfigure with existing sw_version should call configure_battery_handling", + function() + mock_device:set_field(PRIMARY_SW_VERSION, "010903", {persist = true}) + mock_device:set_field("_frient_battery_config_applied", nil, {persist = true}) + + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) + + test.socket.zigbee:__expect_send({ + mock_device.id, + IASWD.attributes.MaxDuration:write(mock_device, ALARM_DEFAULT_MAX_DURATION) + }) + + test.socket.zigbee:__expect_send({ + mock_device.id, + zigbee_test_utils.build_bind_request( + mock_device, + zigbee_test_utils.mock_hub_eui, + PowerConfiguration.ID, + 0x2B + ):to_endpoint(0x2B) + }) + + test.socket.zigbee:__expect_send({ + mock_device.id, + PowerConfiguration.attributes.BatteryPercentageRemaining:configure_reporting( + mock_device, 30, 21600, 1) + }) + + test.socket.zigbee:__expect_send({ + mock_device.id, + zigbee_test_utils.build_bind_request( + mock_device, + zigbee_test_utils.mock_hub_eui, + IASZone.ID, + 0x2B + ):to_endpoint(0x2B) + }) + + test.socket.zigbee:__expect_send({ + mock_device.id, + IASZone.attributes.ZoneStatus:configure_reporting(mock_device, 0, 21600, 1) + }) + + test.socket.zigbee:__expect_send({ + mock_device.id, + IASZone.attributes.IASCIEAddress:write(mock_device, zigbee_test_utils.mock_hub_eui) + }) + + test.socket.zigbee:__expect_send({ + mock_device.id, + IASZone.server.commands.ZoneEnrollResponse(mock_device, IasEnrollResponseCode.SUCCESS, 0x00) + }) + + mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) + end, + { + min_api_version = 19 + } +) + +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-siren/src/test/test_frient_siren_tamper.lua b/drivers/SmartThings/zigbee-siren/src/test/test_frient_siren_tamper.lua index 810e691849..bbc34efe64 100644 --- a/drivers/SmartThings/zigbee-siren/src/test/test_frient_siren_tamper.lua +++ b/drivers/SmartThings/zigbee-siren/src/test/test_frient_siren_tamper.lua @@ -64,6 +64,24 @@ local mock_device = test.mock_device.build_test_zigbee_device( } ) +local mock_device_112 = test.mock_device.build_test_zigbee_device( + { + profile = t_utils.get_profile_definition("frient-siren-battery-source-tamper.yml"), + zigbee_endpoints = { + [0x01] = { + id = 0x01, + manufacturer = "frient A/S", + model = "SIRZB-112", + server_clusters = { Scenes.ID, OnOff.ID} + }, + [0x2B] = { + id = 0x2B, + server_clusters = { Basic.ID, Identify.ID, PowerConfiguration.ID, Groups.ID, IASZone.ID, IASWD.ID } + } + } + } +) + zigbee_test_utils.prepare_zigbee_env_info() local function test_init() test.mock_device.add_test_device(mock_device) @@ -257,7 +275,10 @@ test.register_coroutine_test( mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -381,7 +402,10 @@ test.register_coroutine_test( capabilities.tamperAlert.tamper.clear() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -409,7 +433,10 @@ test.register_coroutine_test( -- Expect the OFF command get_siren_OFF_commands() test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -436,7 +463,10 @@ test.register_coroutine_test( -- Expect the OFF command get_siren_OFF_commands() test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -449,7 +479,10 @@ test.register_coroutine_test( }) get_siren_OFF_commands() test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -507,7 +540,10 @@ test.register_coroutine_test( -- stop the siren -- Expect the OFF command get_siren_OFF_commands() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -590,7 +626,10 @@ test.register_coroutine_test( ) -- Expect the OFF command get_siren_OFF_commands() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -666,7 +705,10 @@ test.register_coroutine_test( -- stop the siren -- Expect the OFF command get_siren_OFF_commands(expectedWarningDuration) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -689,7 +731,10 @@ test.register_coroutine_test( -- Expect the command with given configuration get_squawk_command_new_fw( SquawkMode.SOUND_FOR_SYSTEM_IS_ARMED, IaswdLevel.VERY_HIGH_LEVEL ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -712,7 +757,10 @@ test.register_coroutine_test( -- Expect the command with given configuration get_squawk_command_older_fw( SquawkMode.SOUND_FOR_SYSTEM_IS_ARMED, IaswdLevel.VERY_HIGH_LEVEL ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -754,7 +802,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) -- Expect the command with given configuration get_squawk_command_new_fw(SquawkMode.SOUND_FOR_SYSTEM_IS_DISARMED, IaswdLevel.MEDIUM_LEVEL) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -796,7 +847,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) -- Expect the command with given configuration get_squawk_command_older_fw(SquawkMode.SOUND_FOR_SYSTEM_IS_DISARMED, IaswdLevel.MEDIUM_LEVEL) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -850,7 +904,10 @@ test.register_coroutine_test( ) -- Expect the command with given configuration get_squawk_command_new_fw(SquawkMode.SOUND_FOR_SYSTEM_IS_DISARMED, IaswdLevel.MEDIUM_LEVEL) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -881,7 +938,10 @@ test.register_coroutine_test( } ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -927,7 +987,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -950,7 +1013,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -974,7 +1038,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -991,6 +1056,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -1007,6 +1075,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(50)) } + }, + { + min_api_version = 19 } ) @@ -1023,7 +1094,49 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) -test.run_registered_tests() \ No newline at end of file +local function get_siren_OFF_commands_112(duration) + local expectedSirenOFFConfiguration = SirenConfiguration(0x00) + expectedSirenOFFConfiguration:set_warning_mode(WarningMode.STOP) + expectedSirenOFFConfiguration:set_siren_level(IaswdLevel.LOW_LEVEL) + + test.socket.zigbee:__expect_send({ + mock_device_112.id, + IASWD.server.commands.StartWarning( + mock_device_112, + expectedSirenOFFConfiguration, + data_types.Uint16(duration and duration or ALARM_DURATION_TEST_VALUE), + data_types.Uint8(0x00), + data_types.Enum8(0x00) + ) + }) +end + +test.register_coroutine_test( + "SIRZB-112 alarm off command should be handled via frient sub-driver", + function() + mock_device_112:set_field(PRIMARY_SW_VERSION, "010903", {persist = true}) + mock_device_112:set_field(ALARM_DURATION, ALARM_DURATION_TEST_VALUE, {persist = true}) + + test.socket.capability:__queue_receive({ + mock_device_112.id, + { capability = "alarm", component = "main", command = "off", args = {} } + }) + + get_siren_OFF_commands_112() + test.wait_for_events() + end, + { test_init = function() + test.mock_device.add_test_device(mock_device_112) + end, + min_api_version = 19 + } +) + +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-siren/src/test/test_ozom_siren.lua b/drivers/SmartThings/zigbee-siren/src/test/test_ozom_siren.lua index f05c58468f..5c767317b0 100644 --- a/drivers/SmartThings/zigbee-siren/src/test/test_ozom_siren.lua +++ b/drivers/SmartThings/zigbee-siren/src/test/test_ozom_siren.lua @@ -60,6 +60,9 @@ test.register_message_test( data_types.Enum8(0)) } } + }, + { + min_api_version = 19 } ) @@ -94,7 +97,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -118,7 +124,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-siren/src/test/test_zigbee_siren.lua b/drivers/SmartThings/zigbee-siren/src/test/test_zigbee_siren.lua index 3dc707a297..e6b5062322 100644 --- a/drivers/SmartThings/zigbee-siren/src/test/test_zigbee_siren.lua +++ b/drivers/SmartThings/zigbee-siren/src/test/test_zigbee_siren.lua @@ -67,6 +67,9 @@ test.register_message_test( data_types.Uint8(40), data_types.Enum8(3)) } } + }, + { + min_api_version = 19 } ) @@ -87,6 +90,9 @@ test.register_message_test( data_types.Uint8(0x28), data_types.Enum8(0)) } } + }, + { + min_api_version = 19 } ) @@ -107,6 +113,9 @@ test.register_message_test( data_types.Uint8(40), data_types.Enum8(3)) } } + }, + { + min_api_version = 19 } ) @@ -127,6 +136,9 @@ test.register_message_test( data_types.Uint8(40), data_types.Enum8(0)) } } + }, + { + min_api_version = 19 } ) @@ -147,6 +159,9 @@ test.register_message_test( data_types.Uint8(40), data_types.Enum8(0)) } } + }, + { + min_api_version = 19 } ) @@ -167,6 +182,9 @@ test.register_message_test( data_types.Uint8(40), data_types.Enum8(3)) } } + }, + { + min_api_version = 19 } ) @@ -229,7 +247,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -250,6 +271,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -290,7 +314,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -337,7 +362,76 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.alarm.alarm.siren())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) - end + end, + { + min_api_version = 19 + } +) + +local function build_default_response_zigbee_msg() + local zcl_messages = require "st.zigbee.zcl" + local messages = require "st.zigbee.messages" + local zb_const = require "st.zigbee.constants" + local buf_lib = require "st.buf" + local buf_from_str = function(str) return buf_lib.Reader(str) end + local frame = "\x00\x00" + local default_response = zcl_cmds.DefaultResponse.deserialize(buf_from_str(frame)) + local zclh = zcl_messages.ZclHeader({ cmd = data_types.ZCLCommandId(zcl_cmds.DefaultResponse.ID) }) + local addrh = messages.AddressHeader( + mock_device:get_short_address(), + mock_device:get_endpoint(data_types.ClusterId(IASWD.ID)), + zb_const.HUB.ADDR, zb_const.HUB.ENDPOINT, zb_const.HA_PROFILE_ID, IASWD.ID) + local message_body = zcl_messages.ZclMessageBody({ zcl_header = zclh, zcl_body = default_response }) + return messages.ZigbeeMessageRx({ address_header = addrh, body = message_body }) +end + +test.register_coroutine_test( + "Default response with OFF alarm command should emit off events", + function() + mock_device:set_field("alarmCommand", 0, {persist = true}) + test.socket.zigbee:__queue_receive({ mock_device.id, build_default_response_zigbee_msg() }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.alarm.alarm.off())) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Default response with STROBE alarm command should emit strobe event and timer off", + function() + test.timer.__create_and_queue_test_time_advance_timer(180, "oneshot") + mock_device:set_field("alarmCommand", 2, {persist = true}) + test.socket.zigbee:__queue_receive({ mock_device.id, build_default_response_zigbee_msg() }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.alarm.alarm.strobe())) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) + test.mock_time.advance_time(180) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.alarm.alarm.off())) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Default response with BOTH alarm command should emit both event", + function() + test.timer.__create_and_queue_test_time_advance_timer(180, "oneshot") + mock_device:set_field("alarmCommand", 3, {persist = true}) + test.socket.zigbee:__queue_receive({ mock_device.id, build_default_response_zigbee_msg() }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.alarm.alarm.both())) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) + test.mock_time.advance_time(180) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.alarm.alarm.off())) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -356,7 +450,10 @@ test.register_coroutine_test( data_types.Uint16(0x0032), data_types.Uint8(40), data_types.Enum8(0)) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_aqara_gas_detector.lua b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_aqara_gas_detector.lua index 4c1dcb1552..652807aa91 100644 --- a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_aqara_gas_detector.lua +++ b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_aqara_gas_detector.lua @@ -63,7 +63,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", sensitivityAdjustment.sensitivityAdjustment.High())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", selfCheck.selfCheckState.idle())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", lifeTimeReport.lifeTimeState.normal())) - end + end, + { + min_api_version = 19 + } ) @@ -81,7 +84,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, config_attr_message}) test.socket.zigbee:__expect_send({mock_device.id, write_attr_messge}) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) @@ -97,7 +103,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.gasDetector.gas.detected())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -112,7 +121,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.gasDetector.gas.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -127,7 +139,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.audioMute.mute.muted())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -142,7 +157,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.audioMute.mute.unmuted())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -153,7 +171,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_MUTE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +184,10 @@ test.register_coroutine_test( { capability = "audioMute", component = "main", command = "unmute", args = {} } }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.audioMute.mute.muted())) - end + end, + { + min_api_version = 19 + } ) @@ -180,7 +204,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", selfCheck.selfCheckState.selfCheckCompleted())) - end + end, + { + min_api_version = 19 + } ) @@ -194,7 +221,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_SELF_CHECK_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) @@ -211,7 +241,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", lifeTimeReport.lifeTimeState.endOfLife())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -226,7 +259,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", lifeTimeReport.lifeTimeState.normal())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -241,9 +277,81 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", sensitivityAdjustment.sensitivityAdjustment.Low())) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "selfCheck report should be handled, idle", + function() + local attr_report_data = { + { PRIVATE_SELF_CHECK_ATTRIBUTE_ID, data_types.Uint8.ID, 0x00 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + selfCheck.selfCheckState.idle())) + end, + { + min_api_version = 19 + } ) +test.register_coroutine_test( + "sensitivityAdjustment report should be handled, High", + function() + local attr_report_data = { + { PRIVATE_SENSITIVITY_ADJUSTMENT_ATTRIBUTE_ID, data_types.Uint8.ID, 0x02 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + sensitivityAdjustment.sensitivityAdjustment.High())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Capability on command should be handled : setSensitivityAdjustment High", + function() + local attr_report_data = { + { PRIVATE_SENSITIVITY_ADJUSTMENT_ATTRIBUTE_ID, data_types.Uint8.ID, 0x02 } + } + test.socket.capability:__queue_receive({ mock_device.id, + { capability = sensitivityAdjustmentId, component = "main", command = "setSensitivityAdjustment", args = {"High"}} + }) + test.socket.zigbee:__expect_send({ mock_device.id, + cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + PRIVATE_SENSITIVITY_ADJUSTMENT_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 0x02) + }) + test.wait_for_events() + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + sensitivityAdjustment.sensitivityAdjustment.High()) + ) + test.wait_for_events() + test.socket.capability:__queue_receive({ mock_device.id, + { capability = sensitivityAdjustmentId, component = "main", command = "setSensitivityAdjustment", args = {"High"}} + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + sensitivityAdjustment.sensitivityAdjustment.High()) + ) + end, + { + min_api_version = 19 + } +) test.register_coroutine_test( @@ -274,7 +382,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", sensitivityAdjustment.sensitivityAdjustment.Low()) ) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_aqara_smoke_detector.lua b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_aqara_smoke_detector.lua index 1af67b36cd..74c4c6e371 100644 --- a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_aqara_smoke_detector.lua +++ b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_aqara_smoke_detector.lua @@ -7,13 +7,10 @@ local capabilities = require "st.capabilities" local clusters = require "st.zigbee.zcl.clusters" local cluster_base = require "st.zigbee.cluster_base" local data_types = require "st.zigbee.data_types" - - local PowerConfiguration = clusters.PowerConfiguration local selfCheck = capabilities["stse.selfCheck"] local selfCheckId = "stse.selfCheck" - test.add_package_capability("selfCheck.yaml") local PRIVATE_CLUSTER_ID = 0xFCC0 @@ -23,8 +20,6 @@ local PRIVATE_MUTE_ATTRIBUTE_ID = 0x0126 local PRIVATE_SELF_CHECK_ATTRIBUTE_ID = 0x0127 local PRIVATE_SMOKE_ZONE_STATUS_ATTRIBUTE_ID = 0x013A - - local mock_device = test.mock_device.build_test_zigbee_device( { profile = t_utils.get_profile_definition("smoke-battery-aqara.yml"), @@ -39,15 +34,11 @@ local mock_device = test.mock_device.build_test_zigbee_device( } ) - - zigbee_test_utils.prepare_zigbee_env_info() local function test_init() test.mock_device.add_test_device(mock_device) end - - test.set_test_init_function(test_init) test.register_coroutine_test( @@ -58,7 +49,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.audioMute.mute.unmuted())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", selfCheck.selfCheckState.idle())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(100))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -86,10 +80,12 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 0x01) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) - test.register_coroutine_test( "smokeDetector report should be handled", function() @@ -102,11 +98,12 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected())) - end + end, + { + min_api_version = 19 + } ) - - test.register_coroutine_test( "audioMute report should be handled", function() @@ -119,11 +116,12 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.audioMute.mute.muted())) - end + end, + { + min_api_version = 19 + } ) - - test.register_coroutine_test( "Capability on command should be handled : device mute", function() @@ -132,11 +130,12 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_MUTE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) - end + end, + { + min_api_version = 19 + } ) - - test.register_coroutine_test( "selfCheck report should be handled", function() @@ -149,11 +148,12 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", selfCheck.selfCheckState.selfCheckCompleted())) - end + end, + { + min_api_version = 19 + } ) - - test.register_coroutine_test( "Capability on command should be handled : device selfCheck", function() @@ -163,10 +163,65 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_SELF_CHECK_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) +test.register_coroutine_test( + "smokeDetector report should be handled, smoke clear", + function() + local attr_report_data = { + { PRIVATE_SMOKE_ZONE_STATUS_ATTRIBUTE_ID, data_types.Uint16.ID, 0x0000 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.smokeDetector.smoke.clear())) + end, + { + min_api_version = 19 + } +) +test.register_coroutine_test( + "audioMute report should be handled, unmuted", + function() + local attr_report_data = { + { PRIVATE_MUTE_ATTRIBUTE_ID, data_types.Uint8.ID, 0x00 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + capabilities.audioMute.mute.unmuted())) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "selfCheck report should be handled, idle", + function() + local attr_report_data = { + { PRIVATE_SELF_CHECK_ATTRIBUTE_ID, data_types.Uint8.ID, 0x00 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, PRIVATE_CLUSTER_ID, attr_report_data, MFG_CODE) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", + selfCheck.selfCheckState.idle())) + end, + { + min_api_version = 19 + } +) test.register_message_test( "Battery voltage report should be handled", @@ -181,8 +236,10 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) - test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_frient_heat_detector.lua b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_frient_heat_detector.lua index 364aae57a0..06415f6e00 100644 --- a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_frient_heat_detector.lua +++ b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_frient_heat_detector.lua @@ -74,7 +74,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -193,7 +196,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -209,6 +215,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(14)) } + }, + { + min_api_version = 19 } ) @@ -225,7 +234,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -241,7 +253,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -259,7 +274,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -283,6 +301,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -323,7 +344,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -358,7 +380,10 @@ test.register_coroutine_test( test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -391,7 +416,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -425,7 +453,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -458,7 +489,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -492,7 +526,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -566,7 +603,48 @@ test.register_coroutine_test( string.format("Version mismatch! Expected '%s' but got '%s'", expected_hex, stored_version or "nil")) end - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "IASZone attribute report should be handled: detected", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0001) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "IASZone attribute report should be handled: cleared", + function() + test.timer.__create_and_queue_test_time_advance_timer(6, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0000) + }) + test.mock_time.advance_time(6) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_frient_smoke_detector.lua b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_frient_smoke_detector.lua index fa012a321b..6ca8a3a0d9 100644 --- a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_frient_smoke_detector.lua +++ b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_frient_smoke_detector.lua @@ -28,6 +28,12 @@ local DEVELCO_BASIC_PRIMARY_SW_VERSION_ATTR = 0x8000 local DEVELCO_MANUFACTURER_CODE = 0x1015 local cluster_base = require "st.zigbee.cluster_base" local defaultWarningDuration = 240 +local messages = require "st.zigbee.messages" +local default_response = require "st.zigbee.zcl.global_commands.default_response" +local zb_const = require "st.zigbee.constants" +local Status = require "st.zigbee.generated.types.ZclStatus" +local zcl_messages = require "st.zigbee.zcl" +local ALARM_COMMAND = "alarmCommand" local mock_device = test.mock_device.build_test_zigbee_device( @@ -75,7 +81,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -194,7 +203,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -210,6 +222,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(14)) } + }, + { + min_api_version = 19 } ) @@ -227,6 +242,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -244,6 +262,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.tested()) } + }, + { + min_api_version = 19 } ) @@ -262,7 +283,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -286,6 +310,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -363,7 +390,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -398,7 +426,10 @@ test.register_coroutine_test( test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -431,7 +462,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -465,7 +499,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -498,7 +535,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -532,7 +572,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -606,7 +649,106 @@ test.register_coroutine_test( string.format("Version mismatch! Expected '%s' but got '%s'", expected_hex, stored_version or "nil")) end - end + end, + { + min_api_version = 19 + } +) + +local function build_default_response_msg(device, cluster, command, status) + local addr_header = messages.AddressHeader( + device:get_short_address(), + device.fingerprinted_endpoint_id, + zb_const.HUB.ADDR, + zb_const.HUB.ENDPOINT, + zb_const.HA_PROFILE_ID, + cluster + ) + local default_response_body = default_response.DefaultResponse(command, status) + local zcl_header = zcl_messages.ZclHeader({ + cmd = data_types.ZCLCommandId(default_response_body.ID) + }) + local message_body = zcl_messages.ZclMessageBody({ + zcl_header = zcl_header, + zcl_body = default_response_body + }) + return messages.ZigbeeMessageRx({ + address_header = addr_header, + body = message_body + }) +end + +test.register_message_test( + "IASZone attribute report should be handled: detected", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0001) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", smokeDetector.smoke.detected()) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "IASZone attribute report should be handled: clear", + function() + test.timer.__create_and_queue_test_time_advance_timer(6, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0000) + }) + test.mock_time.advance_time(6) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", smokeDetector.smoke.clear()) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "default_response_handler: siren active, emit siren then off after delay", + function() + mock_device:set_field(ALARM_COMMAND, 1) + test.timer.__create_and_queue_test_time_advance_timer(ALARM_DEFAULT_MAX_DURATION, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + build_default_response_msg(mock_device, IASWD.ID, IASWD.server.commands.StartWarning.ID, Status.SUCCESS) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", alarm.alarm.siren())) + test.mock_time.advance_time(ALARM_DEFAULT_MAX_DURATION) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", alarm.alarm.off())) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "default_response_handler: alarm off, emit off", + function() + mock_device:set_field(ALARM_COMMAND, 0) + test.socket.zigbee:__queue_receive({ + mock_device.id, + build_default_response_msg(mock_device, IASWD.ID, IASWD.server.commands.StartWarning.ID, Status.SUCCESS) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", alarm.alarm.off())) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_zigbee_smoke_detector.lua b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_zigbee_smoke_detector.lua index b27713fa19..af1ee02936 100644 --- a/drivers/SmartThings/zigbee-smoke-detector/src/test/test_zigbee_smoke_detector.lua +++ b/drivers/SmartThings/zigbee-smoke-detector/src/test/test_zigbee_smoke_detector.lua @@ -43,6 +43,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "smokeDetector", capability_attr_id = "smoke" } } }, + }, + { + min_api_version = 19 } ) @@ -67,6 +70,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "smokeDetector", capability_attr_id = "smoke" } } }, + }, + { + min_api_version = 19 } ) @@ -91,6 +97,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "smokeDetector", capability_attr_id = "smoke" } } }, + }, + { + min_api_version = 19 } ) @@ -115,6 +124,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "smokeDetector", capability_attr_id = "smoke" } } }, + }, + { + min_api_version = 19 } ) @@ -131,6 +143,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -228,7 +243,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -265,7 +283,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-sound-sensor/src/test/test_zigbee_sound_sensor.lua b/drivers/SmartThings/zigbee-sound-sensor/src/test/test_zigbee_sound_sensor.lua index 4ab2f31e92..3ea9dfbdd9 100644 --- a/drivers/SmartThings/zigbee-sound-sensor/src/test/test_zigbee_sound_sensor.lua +++ b/drivers/SmartThings/zigbee-sound-sensor/src/test/test_zigbee_sound_sensor.lua @@ -121,7 +121,10 @@ test.register_coroutine_test( PollControl.attributes.CheckInInterval:write(mock_device, data_types.Uint32(6480)) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -187,7 +190,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -204,6 +208,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.soundSensor.sound.detected()) } + }, + { + min_api_version = 19 } ) @@ -220,6 +227,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.soundSensor.sound.detected()) } + }, + { + min_api_version = 19 } ) @@ -236,6 +246,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.soundSensor.sound.not_detected()) } + }, + { + min_api_version = 19 } ) @@ -252,6 +265,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -276,6 +292,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -297,6 +316,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/aqara/multi-switch/init.lua b/drivers/SmartThings/zigbee-switch/src/aqara/multi-switch/init.lua index 9280a30d0d..4b2146f03c 100644 --- a/drivers/SmartThings/zigbee-switch/src/aqara/multi-switch/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/aqara/multi-switch/init.lua @@ -86,7 +86,7 @@ end local aqara_multi_switch_handler = { NAME = "Aqara Multi Switch Handler", lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(device_init), + init = configurations.reconfig_wrapper(device_init), added = device_added }, can_handle = require("aqara.multi-switch.can_handle"), diff --git a/drivers/SmartThings/zigbee-switch/src/color_temp_range_handlers/can_handle.lua b/drivers/SmartThings/zigbee-switch/src/color_temp_range_handlers/can_handle.lua new file mode 100644 index 0000000000..56cd729659 --- /dev/null +++ b/drivers/SmartThings/zigbee-switch/src/color_temp_range_handlers/can_handle.lua @@ -0,0 +1,12 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local capabilities = require "st.capabilities" + +return function(opts, driver, device) + if device:supports_capability(capabilities.colorTemperature) then + local subdriver = require("color_temp_range_handlers") + return true, subdriver + end + return false +end diff --git a/drivers/SmartThings/zigbee-switch/src/color_temp_range_handlers/init.lua b/drivers/SmartThings/zigbee-switch/src/color_temp_range_handlers/init.lua new file mode 100644 index 0000000000..761ac49736 --- /dev/null +++ b/drivers/SmartThings/zigbee-switch/src/color_temp_range_handlers/init.lua @@ -0,0 +1,72 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local capabilities = require "st.capabilities" +local clusters = require "st.zigbee.zcl.clusters" +local utils = require "st.utils" +local KELVIN_MAX = "_max_kelvin" +local KELVIN_MIN = "_min_kelvin" +local MIREDS_CONVERSION_CONSTANT = 1000000 +local COLOR_TEMPERATURE_KELVIN_MAX = 15000 +local COLOR_TEMPERATURE_KELVIN_MIN = 1000 +local COLOR_TEMPERATURE_MIRED_MAX = utils.round(MIREDS_CONVERSION_CONSTANT/COLOR_TEMPERATURE_KELVIN_MIN) -- 1000 +local COLOR_TEMPERATURE_MIRED_MIN = utils.round(MIREDS_CONVERSION_CONSTANT/COLOR_TEMPERATURE_KELVIN_MAX) -- 67 + +local function color_temp_min_mireds_handler(driver, device, value, zb_rx) + local temp_in_mired = value.value + local endpoint = zb_rx.address_header.src_endpoint.value + if temp_in_mired == nil then + return + end + if (temp_in_mired < COLOR_TEMPERATURE_MIRED_MIN or temp_in_mired > COLOR_TEMPERATURE_MIRED_MAX) then + device.log.warn_with({hub_logs = true}, string.format("Device reported a color temperature %d mired outside of sane range of %.2f-%.2f", temp_in_mired, COLOR_TEMPERATURE_MIRED_MIN, COLOR_TEMPERATURE_MIRED_MAX)) + return + end + local temp_in_kelvin = utils.round(MIREDS_CONVERSION_CONSTANT / temp_in_mired) + device:set_field(KELVIN_MAX..endpoint, temp_in_kelvin) + local min = device:get_field(KELVIN_MIN..endpoint) + if min ~= nil then + if temp_in_kelvin > min then + device:emit_event_for_endpoint(endpoint, capabilities.colorTemperature.colorTemperatureRange({ value = {minimum = min, maximum = temp_in_kelvin}})) + else + device.log.warn_with({hub_logs = true}, string.format("Device reported a max color temperature %d K that is not higher than the reported min color temperature %d K", min, temp_in_kelvin)) + end + end +end + +local function color_temp_max_mireds_handler(driver, device, value, zb_rx) + local temp_in_mired = value.value + local endpoint = zb_rx.address_header.src_endpoint.value + if temp_in_mired == nil then + return + end + if (temp_in_mired < COLOR_TEMPERATURE_MIRED_MIN or temp_in_mired > COLOR_TEMPERATURE_MIRED_MAX) then + device.log.warn_with({hub_logs = true}, string.format("Device reported a color temperature %d mired outside of sane range of %.2f-%.2f", temp_in_mired, COLOR_TEMPERATURE_MIRED_MIN, COLOR_TEMPERATURE_MIRED_MAX)) + return + end + local temp_in_kelvin = utils.round(MIREDS_CONVERSION_CONSTANT / temp_in_mired) + device:set_field(KELVIN_MIN..endpoint, temp_in_kelvin) + local max = device:get_field(KELVIN_MAX..endpoint) + if max ~= nil then + if temp_in_kelvin < max then + device:emit_event_for_endpoint(endpoint, capabilities.colorTemperature.colorTemperatureRange({ value = {minimum = temp_in_kelvin, maximum = max}})) + else + device.log.warn_with({hub_logs = true}, string.format("Device reported a min color temperature %d K that is not lower than the reported max color temperature %d K", temp_in_kelvin, max)) + end + end +end + +local color_temp_range_handlers = { + NAME = "Color temp range handlers", + zigbee_handlers = { + attr = { + [clusters.ColorControl.ID] = { + [clusters.ColorControl.attributes.ColorTempPhysicalMinMireds.ID] = color_temp_min_mireds_handler, + [clusters.ColorControl.attributes.ColorTempPhysicalMaxMireds.ID] = color_temp_max_mireds_handler + } + } + }, + can_handle = require("color_temp_range_handlers.can_handle") +} + +return color_temp_range_handlers diff --git a/drivers/SmartThings/zigbee-switch/src/configurations/init.lua b/drivers/SmartThings/zigbee-switch/src/configurations/init.lua index 01f42abf91..a5e55b3953 100644 --- a/drivers/SmartThings/zigbee-switch/src/configurations/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/configurations/init.lua @@ -84,7 +84,7 @@ configurations.handle_reporting_config_response = function(driver, device, zb_me end end -configurations.power_reconfig_wrapper = function(orig_function) +configurations.reconfig_wrapper = function(orig_function) local new_init = function(driver, device) local config_version = device:get_field(CONFIGURATION_VERSION_KEY) if config_version == nil or config_version < driver.current_config_version then @@ -92,6 +92,18 @@ configurations.power_reconfig_wrapper = function(orig_function) driver._reconfig_timer = driver:call_with_delay(5*60, configurations.check_and_reconfig_devices, "reconfig_power_devices") end end + + local capabilities = require "st.capabilities" + for id, _ in pairs(device.profile.components) do + if device:supports_capability(capabilities.colorTemperature, id) and + device:get_latest_state(id, capabilities.colorTemperature.ID, capabilities.colorTemperature.colorTemperatureRange.NAME) == nil then + local clusters = require "st.zigbee.zcl.clusters" + driver:call_with_delay(5*60, function() + device:send_to_component(id, clusters.ColorControl.attributes.ColorTempPhysicalMinMireds:read(device)) + device:send_to_component(id, clusters.ColorControl.attributes.ColorTempPhysicalMaxMireds:read(device)) + end) + end + end orig_function(driver, device) end return new_init diff --git a/drivers/SmartThings/zigbee-switch/src/ezex/init.lua b/drivers/SmartThings/zigbee-switch/src/ezex/init.lua index 6c2d9e45e3..ff1b2deb7b 100644 --- a/drivers/SmartThings/zigbee-switch/src/ezex/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/ezex/init.lua @@ -12,7 +12,7 @@ end local ezex_switch_handler = { NAME = "ezex switch handler", lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(do_init) + init = configurations.reconfig_wrapper(do_init) }, can_handle = require("ezex.can_handle"), } diff --git a/drivers/SmartThings/zigbee-switch/src/frient-IO/init.lua b/drivers/SmartThings/zigbee-switch/src/frient-IO/init.lua index 293583f442..d7601ab535 100644 --- a/drivers/SmartThings/zigbee-switch/src/frient-IO/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/frient-IO/init.lua @@ -478,7 +478,7 @@ local frient_bridge_handler = { }, lifecycle_handlers = { added = added_handler, - init = init_handler, + init = configurationMap.reconfig_wrapper(init_handler), doConfigure = configure_handler, infoChanged = info_changed_handler }, diff --git a/drivers/SmartThings/zigbee-switch/src/frient/init.lua b/drivers/SmartThings/zigbee-switch/src/frient/init.lua index a615c721f4..e546de1a14 100644 --- a/drivers/SmartThings/zigbee-switch/src/frient/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/frient/init.lua @@ -152,7 +152,7 @@ local frient_smart_plug = { }, }, lifecycle_handlers = { - init = device_init, + init = configurationMap.reconfig_wrapper(device_init), doConfigure = do_configure, added = device_added, }, diff --git a/drivers/SmartThings/zigbee-switch/src/hanssem/init.lua b/drivers/SmartThings/zigbee-switch/src/hanssem/init.lua index 083893448b..0ab333af8e 100644 --- a/drivers/SmartThings/zigbee-switch/src/hanssem/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/hanssem/init.lua @@ -50,7 +50,7 @@ local HanssemSwitch = { NAME = "Zigbee Hanssem Switch", lifecycle_handlers = { added = device_added, - init = configurations.power_reconfig_wrapper(device_init) + init = configurations.reconfig_wrapper(device_init) }, can_handle = require("hanssem.can_handle"), } diff --git a/drivers/SmartThings/zigbee-switch/src/ikea-xy-color-bulb/init.lua b/drivers/SmartThings/zigbee-switch/src/ikea-xy-color-bulb/init.lua index a026ac6564..a236f1c1cc 100644 --- a/drivers/SmartThings/zigbee-switch/src/ikea-xy-color-bulb/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/ikea-xy-color-bulb/init.lua @@ -147,7 +147,7 @@ end local ikea_xy_color_bulb = { NAME = "IKEA XY Color Bulb", lifecycle_handlers = { - init = configurationMap.power_reconfig_wrapper(device_init) + init = configurationMap.reconfig_wrapper(device_init) }, capability_handlers = { [capabilities.colorControl.ID] = { diff --git a/drivers/SmartThings/zigbee-switch/src/init.lua b/drivers/SmartThings/zigbee-switch/src/init.lua index aa245f5910..062ac68782 100644 --- a/drivers/SmartThings/zigbee-switch/src/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/init.lua @@ -80,7 +80,7 @@ local zigbee_switch_driver_template = { }, current_config_version = 1, lifecycle_handlers = { - init = configurationMap.power_reconfig_wrapper(device_init), + init = configurationMap.reconfig_wrapper(device_init), added = lazy_handler("lifecycle_handlers.device_added"), infoChanged = lazy_handler("lifecycle_handlers.info_changed"), doConfigure = lazy_handler("lifecycle_handlers.do_configure"), diff --git a/drivers/SmartThings/zigbee-switch/src/laisiao/init.lua b/drivers/SmartThings/zigbee-switch/src/laisiao/init.lua index 2833843793..22e5791b0e 100755 --- a/drivers/SmartThings/zigbee-switch/src/laisiao/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/laisiao/init.lua @@ -48,7 +48,7 @@ local laisiao_bath_heater = { capabilities.switch, }, lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(device_init), + init = configurations.reconfig_wrapper(device_init), }, capability_handlers = { [capabilities.switch.ID] = { diff --git a/drivers/SmartThings/zigbee-switch/src/lifecycle_handlers/do_configure.lua b/drivers/SmartThings/zigbee-switch/src/lifecycle_handlers/do_configure.lua index 465969a755..4058a953bb 100644 --- a/drivers/SmartThings/zigbee-switch/src/lifecycle_handlers/do_configure.lua +++ b/drivers/SmartThings/zigbee-switch/src/lifecycle_handlers/do_configure.lua @@ -17,4 +17,11 @@ return function(self, device) device:send(clusters.SimpleMetering.attributes.Divisor:read(device)) device:send(clusters.SimpleMetering.attributes.Multiplier:read(device)) end + + if device:supports_capability(capabilities.colorTemperature) then + local clusters = require "st.zigbee.zcl.clusters" + -- min and max for color temperature + device:send(clusters.ColorControl.attributes.ColorTempPhysicalMinMireds:read(device)) + device:send(clusters.ColorControl.attributes.ColorTempPhysicalMaxMireds:read(device)) + end end diff --git a/drivers/SmartThings/zigbee-switch/src/multi-switch-no-master/init.lua b/drivers/SmartThings/zigbee-switch/src/multi-switch-no-master/init.lua index ba0ed07ae3..bac6368ad2 100644 --- a/drivers/SmartThings/zigbee-switch/src/multi-switch-no-master/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/multi-switch-no-master/init.lua @@ -49,7 +49,7 @@ end local multi_switch_no_master = { NAME = "multi switch no master", lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(device_init), + init = configurations.reconfig_wrapper(device_init), added = device_added }, can_handle = require("multi-switch-no-master.can_handle"), diff --git a/drivers/SmartThings/zigbee-switch/src/robb/init.lua b/drivers/SmartThings/zigbee-switch/src/robb/init.lua index 1a8c2948c3..aa2487c87a 100644 --- a/drivers/SmartThings/zigbee-switch/src/robb/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/robb/init.lua @@ -32,7 +32,7 @@ local robb_dimmer_handler = { } }, lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(do_init) + init = configurations.reconfig_wrapper(do_init) }, can_handle = require("robb.can_handle"), } diff --git a/drivers/SmartThings/zigbee-switch/src/sub_drivers.lua b/drivers/SmartThings/zigbee-switch/src/sub_drivers.lua index c232b40329..5dcf24ca74 100644 --- a/drivers/SmartThings/zigbee-switch/src/sub_drivers.lua +++ b/drivers/SmartThings/zigbee-switch/src/sub_drivers.lua @@ -34,5 +34,6 @@ return { lazy_load_if_possible("laisiao"), lazy_load_if_possible("tuya-multi"), lazy_load_if_possible("frient"), - lazy_load_if_possible("frient-IO") + lazy_load_if_possible("frient-IO"), + lazy_load_if_possible("color_temp_range_handlers") } diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua index b581c5c61e..6780c95fe8 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua @@ -99,6 +99,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -124,6 +127,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -149,6 +155,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -175,6 +184,9 @@ test.register_message_test( math.floor(57 * 0xFE / 100), 0) } } + }, + { + min_api_version = 19 } ) @@ -200,6 +212,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -217,6 +232,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 27000.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -242,6 +260,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "colorControl", capability_attr_id = "hue" } } } + }, + { + min_api_version = 19 } ) @@ -267,6 +288,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "colorControl", capability_attr_id = "saturation" } } } + }, + { + min_api_version = 19 } ) @@ -393,9 +417,14 @@ test.register_coroutine_test( mock_device.id, SimpleMetering.attributes.Divisor:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) -- test.register_coroutine_test( @@ -445,13 +474,15 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) test.register_coroutine_test( "configuration version below 1 config response not success", function() + test.timer.__create_and_queue_test_time_advance_timer(5*60, "oneshot") test.timer.__create_and_queue_test_time_advance_timer(5*60, "oneshot") assert(mock_device:get_field("_configuration_version") == nil) test.mock_device.add_test_device(mock_device) @@ -459,6 +490,8 @@ test.register_coroutine_test( test.wait_for_events() test.socket.zigbee:__expect_send({mock_device.id, ElectricalMeasurement.attributes.ActivePower:configure_reporting(mock_device, 5, 600, 5)}) test.socket.zigbee:__expect_send({mock_device.id, SimpleMetering.attributes.InstantaneousDemand:configure_reporting(mock_device, 5, 600, 5)}) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) }) test.mock_time.advance_time(5*60 + 1) test.wait_for_events() test.socket.zigbee:__queue_receive({mock_device.id, build_config_response_msg(mock_device, ElectricalMeasurement.ID, Status.UNSUPPORTED_ATTRIBUTE)}) @@ -469,13 +502,15 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) test.register_coroutine_test( "configuration version below 1 individual config response records ElectricalMeasurement", function() + test.timer.__create_and_queue_test_time_advance_timer(5*60, "oneshot") test.timer.__create_and_queue_test_time_advance_timer(5*60, "oneshot") assert(mock_device:get_field("_configuration_version") == nil) test.mock_device.add_test_device(mock_device) @@ -483,6 +518,8 @@ test.register_coroutine_test( test.wait_for_events() test.socket.zigbee:__expect_send({mock_device.id, ElectricalMeasurement.attributes.ActivePower:configure_reporting(mock_device, 5, 600, 5)}) test.socket.zigbee:__expect_send({mock_device.id, SimpleMetering.attributes.InstantaneousDemand:configure_reporting(mock_device, 5, 600, 5)}) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) }) test.mock_time.advance_time(5*60 + 1) test.wait_for_events() test.socket.zigbee:__queue_receive({mock_device.id, build_config_response_msg(mock_device, ElectricalMeasurement.ID, nil, ElectricalMeasurement.attributes.ActivePower.ID, Status.SUCCESS)}) @@ -492,13 +529,15 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) test.register_coroutine_test( "configuration version below 1 individual config response records SimpleMetering", function() + test.timer.__create_and_queue_test_time_advance_timer(5*60, "oneshot") test.timer.__create_and_queue_test_time_advance_timer(5*60, "oneshot") assert(mock_device:get_field("_configuration_version") == nil) test.mock_device.add_test_device(mock_device) @@ -506,6 +545,8 @@ test.register_coroutine_test( test.wait_for_events() test.socket.zigbee:__expect_send({mock_device.id, ElectricalMeasurement.attributes.ActivePower:configure_reporting(mock_device, 5, 600, 5)}) test.socket.zigbee:__expect_send({mock_device.id, SimpleMetering.attributes.InstantaneousDemand:configure_reporting(mock_device, 5, 600, 5)}) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) }) test.mock_time.advance_time(5*60 + 1) test.wait_for_events() test.socket.zigbee:__queue_receive({mock_device.id, build_config_response_msg(mock_device, SimpleMetering.ID, nil, SimpleMetering.attributes.InstantaneousDemand.ID, Status.SUCCESS)}) @@ -515,7 +556,8 @@ test.register_coroutine_test( { test_init = function() -- no op to override auto device add on startup - end + end, + min_api_version = 19 } ) @@ -550,7 +592,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device)}) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) -- This tests that our code responsible for handling conversion errors from Kelvin<->Mireds works as expected @@ -566,6 +611,19 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({mock_device.id, ColorControl.attributes.ColorTemperatureMireds:build_test_attr_report(mock_device, 556)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperature(1800))) mock_device:expect_native_attr_handler_registration("colorTemperature", "colorTemperature") + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Color temperature range report test", + function() + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.zigbee:__queue_receive({mock_device.id, clusters.ColorControl.attributes.ColorTempPhysicalMaxMireds:build_test_attr_report(mock_device, 370)}) + test.socket.zigbee:__queue_receive({mock_device.id, clusters.ColorControl.attributes.ColorTempPhysicalMinMireds:build_test_attr_report(mock_device, 153)}) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({minimum = 2703, maximum = 6536}))) end ) @@ -587,7 +645,10 @@ test.register_coroutine_test( --- offset should be reset by a reading under the previous offset test.socket.zigbee:__queue_receive({mock_device.id, SimpleMetering.attributes.CurrentSummationDelivered:build_test_attr_report(mock_device, 14)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 14.0, unit = "kWh" }))) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua index ce4bb13957..d1cd3c7b72 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua @@ -52,7 +52,10 @@ test.register_coroutine_test( mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({ minimum = 2700, maximum = 6000 }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -104,7 +107,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -128,7 +134,10 @@ test.register_coroutine_test( ColorControl.commands.MoveToColorTemperature(mock_device, temp_in_mired, 0x0000) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -140,7 +149,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_POWER_STATE_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua index c521ba3e44..aeec82d57e 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua @@ -54,7 +54,10 @@ test.register_coroutine_test( mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({ minimum = 2700, maximum = 6000 }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -109,7 +112,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -133,7 +139,10 @@ test.register_coroutine_test( ColorControl.commands.MoveToColorTemperature(mock_device, temp_in_mired, 0x0000) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -145,7 +154,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_POWER_STATE_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -157,7 +169,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, TURN_OFF_INDICATOR_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -167,7 +182,10 @@ test.register_coroutine_test( preferences = { ["stse.lightFadeInTimeInSec"] = 1 } })) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnTransitionTime:write(mock_device, 10) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -177,7 +195,45 @@ test.register_coroutine_test( preferences = { ["stse.lightFadeOutTimeInSec"] = 1 } })) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OffTransitionTime:write(mock_device, 10) }) - end + end, + { + min_api_version = 19 + } +) + +local mock_device_cwacn1 = test.mock_device.build_test_zigbee_device( + { + profile = t_utils.get_profile_definition("aqara-light.yml"), + preferences = { ["stse.lightFadeInTimeInSec"] = 0, ["stse.lightFadeOutTimeInSec"] = 0 }, + fingerprinted_endpoint_id = 0x01, + zigbee_endpoints = { + [1] = { + id = 1, + manufacturer = "LUMI", + model = "lumi.light.cwacn1", + server_clusters = { 0x0006, 0x0008, 0x0300 } + } + } + } +) + +test.register_coroutine_test( + "Handle added lifecycle for lumi.light.cwacn1 model (colorTemperatureRange max = 6500)", + function() + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.device_lifecycle:__queue_receive({ mock_device_cwacn1.id, "added" }) + + test.socket.zigbee:__expect_send({ + mock_device_cwacn1.id, cluster_base.write_manufacturer_specific_attribute(mock_device_cwacn1, PRIVATE_CLUSTER_ID, + PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) + test.socket.capability:__expect_send(mock_device_cwacn1:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({ minimum = 2700, maximum = 6500 }))) + end, + { + test_init = function() + test.mock_device.add_test_device(mock_device_cwacn1) + end, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_smart_plug.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_smart_plug.lua index 0d51bd11c2..0320900511 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_smart_plug.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_smart_plug.lua @@ -76,7 +76,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 0.0, unit = "Wh" })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -115,7 +118,10 @@ test.register_coroutine_test( SimpleMetering.attributes.CurrentSummationDelivered:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -131,7 +137,10 @@ test.register_coroutine_test( AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(ENERGY_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -145,7 +154,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -159,7 +171,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -170,7 +185,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -181,7 +199,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -200,7 +221,10 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(ENERGY_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -232,7 +256,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 1000000.0 })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -244,7 +271,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_POWER_STATE_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -256,7 +286,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, MAX_POWER_ATTRIBUTE_ID, MFG_CODE, data_types.SinglePrecisionFloat, SinglePrecisionFloat(0, 6, 0.5625)) }) - end + end, + { + min_api_version = 19 + } ) -- with standard cluster @@ -282,7 +315,10 @@ test.register_coroutine_test( ElectricalMeasurement.attributes.ActivePower:read(mock_standard) }) test.socket.zigbee:__expect_send({ mock_standard.id, SimpleMetering.attributes.CurrentSummationDelivered:read(mock_standard) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -305,7 +341,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_standard:generate_test_message("main", capabilities.powerMeter.power({ value = 10.0, unit = "W" })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -327,7 +366,10 @@ test.register_coroutine_test( mock_standard:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 10 })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_smart_plug_t1.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_smart_plug_t1.lua index 8a544caf13..ea404f542f 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_smart_plug_t1.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_smart_plug_t1.lua @@ -77,7 +77,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 0.0, unit = "Wh" })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -116,7 +119,10 @@ test.register_coroutine_test( SimpleMetering.attributes.CurrentSummationDelivered:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -132,7 +138,10 @@ test.register_coroutine_test( AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(ENERGY_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -146,7 +155,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -160,7 +172,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +186,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -182,7 +200,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -201,7 +222,10 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(ENERGY_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -233,7 +257,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 1000000.0 })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -245,7 +272,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_POWER_STATE_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -257,7 +287,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, MAX_POWER_ATTRIBUTE_ID, MFG_CODE, data_types.SinglePrecisionFloat, SinglePrecisionFloat(0, 6, 0.5625)) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -269,7 +302,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_TURN_OFF_INDICATOR_LIGHT_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) -- with standard cluster @@ -295,7 +331,10 @@ test.register_coroutine_test( ElectricalMeasurement.attributes.ActivePower:read(mock_standard) }) test.socket.zigbee:__expect_send({ mock_standard.id, SimpleMetering.attributes.CurrentSummationDelivered:read(mock_standard) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -318,7 +357,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_standard:generate_test_message("main", capabilities.powerMeter.power({ value = 10.0, unit = "W" })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -340,7 +382,10 @@ test.register_coroutine_test( mock_standard:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 10 })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_module.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_module.lua index f27d84cfc6..0e5783e0ba 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_module.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_module.lua @@ -54,7 +54,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 0.0, unit = "Wh" })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -68,7 +71,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -82,7 +88,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -93,7 +102,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -104,7 +116,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -123,7 +138,10 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(ENERGY_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -147,7 +165,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 1000000.0 })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -159,7 +180,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_POWER_STATE_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +195,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, ELECTRIC_SWITCH_TYPE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_module_no_power.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_module_no_power.lua index 840aadacb9..478647e819 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_module_no_power.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_module_no_power.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( function() test.socket.zigbee:__set_channel_ordering("relaxed") test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -57,7 +60,10 @@ test.register_coroutine_test( { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) -end +end, +{ + min_api_version = 19 +} ) test.register_coroutine_test( @@ -67,7 +73,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, OnOff.attributes.OnOff:build_test_attr_report(mock_device, true):from_endpoint(0x01) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -77,7 +86,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, OnOff.attributes.OnOff:build_test_attr_report(mock_device, false):from_endpoint(0x01) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -88,7 +100,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -99,7 +114,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -111,7 +129,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_POWER_STATE_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -123,7 +144,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, ELECTRIC_SWITCH_TYPE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_no_power.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_no_power.lua index 207e7bf21b..6fb6269226 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_no_power.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_no_power.lua @@ -97,7 +97,10 @@ test.register_coroutine_test( data_types.Uint8, 1) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.supportedButtonValues({ "pushed" }, { visibility = { displayed = false } }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -118,7 +121,10 @@ test.register_coroutine_test( { visibility = { displayed = false } }))) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.button.supportedButtonValues({ "pushed" }, { visibility = { displayed = false } }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -142,7 +148,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_base_device:generate_test_message("main", capabilities.button.supportedButtonValues({ "pushed" }, { visibility = { displayed = false } }))) test.socket.capability:__expect_send(mock_base_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = false }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -153,7 +162,10 @@ test.register_coroutine_test( { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +175,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, OnOff.attributes.OnOff:build_test_attr_report(mock_device, true):from_endpoint(0x01) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -173,7 +188,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, OnOff.attributes.OnOff:build_test_attr_report(mock_device, true):from_endpoint(0x02) }) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.switch.switch.on())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -183,7 +201,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, OnOff.attributes.OnOff:build_test_attr_report(mock_device, false):from_endpoint(0x01) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -193,7 +214,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, OnOff.attributes.OnOff:build_test_attr_report(mock_device, false):from_endpoint(0x02) }) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.switch.switch.off())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -204,7 +228,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -215,7 +242,10 @@ test.register_coroutine_test( mock_child:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -226,7 +256,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -237,7 +270,10 @@ test.register_coroutine_test( mock_child:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -251,7 +287,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -265,7 +304,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.button.button.pushed({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) @@ -279,7 +321,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_POWER_STATE_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -291,7 +336,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, CHANGE_TO_WIRELESS_SWITCH_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 0) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_power.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_power.lua index a02ef37aa2..6251e277e1 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_power.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_switch_power.lua @@ -84,7 +84,10 @@ test.register_coroutine_test( { visibility = { displayed = false } }))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = false }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -97,7 +100,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.button.supportedButtonValues({ "pushed" }, { visibility = { displayed = false } }))) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.button.button.pushed({ state_change = false }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -113,7 +119,10 @@ test.register_coroutine_test( AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(ENERGY_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -127,7 +136,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -141,7 +153,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -155,7 +170,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -169,7 +187,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(POWER_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -180,7 +201,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -191,7 +215,10 @@ test.register_coroutine_test( mock_child:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -202,7 +229,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -213,7 +243,10 @@ test.register_coroutine_test( mock_child:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -227,7 +260,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -241,7 +277,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.button.button.pushed({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -260,7 +299,10 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_send({ mock_device.id, AnalogInput.attributes.PresentValue:read(mock_device):to_endpoint(ENERGY_METER_ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -284,7 +326,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 1000000.0 })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -296,7 +341,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, RESTORE_POWER_STATE_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, true) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -308,7 +356,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, CHANGE_TO_WIRELESS_SWITCH_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 0) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_wall_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_wall_switch.lua index 3711116d99..95b56b2af7 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_wall_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_wall_switch.lua @@ -58,7 +58,10 @@ test.register_coroutine_test( OnOff.attributes.OnOff:build_test_attr_report(mock_device, true):from_endpoint(0x01) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.on())) mock_device:expect_native_attr_handler_registration("switch", "switch") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -68,7 +71,10 @@ test.register_coroutine_test( OnOff.attributes.OnOff:build_test_attr_report(mock_device, true):from_endpoint(0x02) }) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.switch.switch.on())) mock_device:expect_native_attr_handler_registration("switch", "switch") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -78,7 +84,10 @@ test.register_coroutine_test( OnOff.attributes.OnOff:build_test_attr_report(mock_device, false):from_endpoint(0x01) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) mock_device:expect_native_attr_handler_registration("switch", "switch") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -88,7 +97,10 @@ test.register_coroutine_test( OnOff.attributes.OnOff:build_test_attr_report(mock_device, false):from_endpoint(0x02) }) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.switch.switch.off())) mock_device:expect_native_attr_handler_registration("switch", "switch") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -99,7 +111,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -110,7 +125,10 @@ test.register_coroutine_test( mock_child:expect_native_cmd_handler_registration("switch", "on") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -121,7 +139,10 @@ test.register_coroutine_test( mock_device:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -132,7 +153,10 @@ test.register_coroutine_test( mock_child:expect_native_cmd_handler_registration("switch", "off") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -146,7 +170,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -160,7 +187,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_child:generate_test_message("main", capabilities.button.button.pushed({ state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -172,7 +202,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, CHANGE_TO_WIRELESS_SWITCH_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 0) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aurora_relay.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aurora_relay.lua index 57d6576955..c583aab35e 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aurora_relay.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aurora_relay.lua @@ -40,7 +40,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ElectricalMeasurement.attributes.ACPowerDivisor:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ElectricalMeasurement.attributes.ACPowerMultiplier:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, SimpleMetering.attributes.InstantaneousDemand:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -64,6 +67,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -88,6 +94,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -112,7 +121,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 60.0, unit = "W" })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_bad_data_type.lua b/drivers/SmartThings/zigbee-switch/src/test/test_bad_data_type.lua index b30f49df23..a65a0a1f92 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_bad_data_type.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_bad_data_type.lua @@ -41,6 +41,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_bad_device_kind.lua b/drivers/SmartThings/zigbee-switch/src/test/test_bad_device_kind.lua index bd8ce15b10..60b0f7709f 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_bad_device_kind.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_bad_device_kind.lua @@ -32,7 +32,9 @@ test.register_coroutine_test("zwave_device_handled", function() test.socket.device_lifecycle:__queue_receive({ mock_device.id, "infoChanged", dkjson.encode(mock_device.raw_st_data) }) test.wait_for_events() end, - nil + { + min_api_version = 19 + } ) test.register_message_test( @@ -41,6 +43,9 @@ test.register_message_test( channel = "capability", direction = "receive", message = { mock_device.id, { capability = "switch", component = "main", command = "on", args = { } } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_cree_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_cree_bulb.lua index 8841c5a53d..7d2b0a6abc 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_cree_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_cree_bulb.lua @@ -64,7 +64,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -72,7 +75,10 @@ test.register_coroutine_test( function() test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.capability:__expect_send(mock_device:generate_test_message("main",capabilities.switchLevel.level(100))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -82,7 +88,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -93,7 +102,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.server.commands.MoveToLevelWithOnOff(mock_device, 144, 0xFFFF) }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_duragreen_color_temp_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_duragreen_color_temp_bulb.lua index 55c491e77d..b9733d25c8 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_duragreen_color_temp_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_duragreen_color_temp_bulb.lua @@ -73,8 +73,13 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -111,7 +116,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -139,7 +145,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -158,7 +167,10 @@ test.register_coroutine_test( command } ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_enbrighten_metering_dimmer.lua b/drivers/SmartThings/zigbee-switch/src/test/test_enbrighten_metering_dimmer.lua index 3b5a5b93b1..e123a6724c 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_enbrighten_metering_dimmer.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_enbrighten_metering_dimmer.lua @@ -128,7 +128,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -152,6 +155,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOffCluster.server.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -176,6 +182,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOffCluster.server.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -203,6 +212,9 @@ test.register_message_test( LevelCluster.server.commands.MoveToLevelWithOnOff(mock_device, math.floor(57 * 254 / 100)) } } + }, + { + min_api_version = 19 } ) @@ -230,6 +242,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -246,6 +261,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 33.3, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -262,6 +280,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 0.5555, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_frient_IO_module.lua b/drivers/SmartThings/zigbee-switch/src/test/test_frient_IO_module.lua index c9d5f9b75e..3b44ff375f 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_frient_IO_module.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_frient_IO_module.lua @@ -520,7 +520,10 @@ test.register_coroutine_test( assert(child2_native, "expected Output 2 child to register native switch handler") local parent_native = mock_parent_device:get_field("frient_io_native_72") assert(parent_native, "expected parent device to register native switch handler for input 3") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -551,7 +554,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_output_child_1:generate_test_message("main", Switch.switch.off())) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -608,7 +614,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_parent_device.id, direct_off }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -629,7 +638,10 @@ test.register_coroutine_test( }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -677,7 +689,10 @@ test.register_coroutine_test( }) test.socket.zigbee:__expect_send({ mock_parent_device.id, build_unbind(mock_parent_device, ZIGBEE_ENDPOINTS.INPUT_3, ZIGBEE_ENDPOINTS.OUTPUT_2) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_frient_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_frient_switch.lua index 4290d6ebbe..3e730e989c 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_frient_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_frient_switch.lua @@ -79,6 +79,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) } + }, + { + min_api_version = 19 } ) @@ -113,7 +116,11 @@ test.register_message_test("Current divisor, multiplier, summation should be han direction = "send", message = mock_device:generate_test_message("main", capabilities.currentMeasurement.current({ value = 200.0, unit = "A" })) }, - }) + }, + { + min_api_version = 19 + } +) test.register_coroutine_test("Refresh command should read all necessary attributes", function() test.socket.zigbee:__set_channel_ordering("relaxed") @@ -144,7 +151,11 @@ test.register_coroutine_test("Refresh command should read all necessary attribut test.socket.zigbee:__expect_send( {mock_device.id, OnOff.attributes.OnOff:read(mock_device) } ) -end) +end, +{ + min_api_version = 19 +} +) test.register_message_test( "Handle switch ON report", @@ -167,6 +178,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -191,6 +205,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -220,6 +237,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -242,6 +262,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 0.027, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -252,7 +275,10 @@ test.register_coroutine_test( assert(mock_device:get_field(constants.SIMPLE_METERING_DIVISOR_KEY) == 1000) assert(mock_device:get_field(constants.ELECTRICAL_MEASUREMENT_DIVISOR_KEY) == 1000) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test("doConfigure should send bind request, read attributes and configure reporting", function() @@ -313,7 +339,11 @@ test.register_coroutine_test("doConfigure should send bind request, read attribu test.socket.zigbee:__expect_send({mock_device.id, Alarms.attributes.AlarmCount:read(mock_device)}) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test( "Alarm report should be handled", @@ -325,7 +355,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.powerSource.powerSource.unknown())) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_ge_link_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_ge_link_bulb.lua index d37dafe45d..4e8bfcb8fa 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_ge_link_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_ge_link_bulb.lua @@ -45,7 +45,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -59,7 +62,10 @@ test.register_coroutine_test( } test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed(updates)) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnOffTransitionTime:write(mock_device, 50) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -71,7 +77,10 @@ test.register_coroutine_test( } } test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed(updates)) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -101,7 +110,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -135,7 +147,50 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Handle infoChanged when dimOnOff changes from 1 to 0 should write transition time 0", + function() + -- First: change dimOnOff from default 0 to 1 (triggers write with dimRate=20) + test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed({ + preferences = { dimOnOff = 1 } + })) + test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnOffTransitionTime:write(mock_device, 20) }) + test.wait_for_events() + -- Now: change dimOnOff from 1 to 0 (driver old=1, new=0 -> writes 0) + test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed({ + preferences = { dimOnOff = 0 } + })) + test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnOffTransitionTime:write(mock_device, 0) }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Handle infoChanged when dimRate changes while dimOnOff is 1 should write new dimRate", + function() + -- First: change dimOnOff from default 0 to 1 (triggers write with dimRate=20) + test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed({ + preferences = { dimOnOff = 1 } + })) + test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnOffTransitionTime:write(mock_device, 20) }) + test.wait_for_events() + -- Now: change dimRate while dimOnOff stays 1 (driver old={dimOnOff=1,dimRate=20}, new={dimOnOff=1,dimRate=50}) + test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed({ + preferences = { dimOnOff = 1, dimRate = 50 } + })) + test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnOffTransitionTime:write(mock_device, 50) }) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_hanssem_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_hanssem_switch.lua index 96f4581310..bfe587bbe4 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_hanssem_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_hanssem_switch.lua @@ -126,6 +126,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -156,6 +159,9 @@ test.register_message_test( { device_uuid = mock_first_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -186,6 +192,9 @@ test.register_message_test( { device_uuid = mock_second_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -216,6 +225,9 @@ test.register_message_test( { device_uuid = mock_third_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -246,6 +258,9 @@ test.register_message_test( { device_uuid = mock_fourth_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -276,6 +291,9 @@ test.register_message_test( { device_uuid = mock_fifth_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -306,6 +324,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -336,6 +357,9 @@ test.register_message_test( { device_uuid = mock_first_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -366,6 +390,9 @@ test.register_message_test( { device_uuid = mock_second_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -396,6 +423,9 @@ test.register_message_test( { device_uuid = mock_third_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -426,6 +456,9 @@ test.register_message_test( { device_uuid = mock_fourth_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -456,6 +489,9 @@ test.register_message_test( { device_uuid = mock_fifth_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -485,6 +521,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x01) } } + }, + { + min_api_version = 19 } ) @@ -509,6 +548,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -533,6 +575,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) @@ -557,6 +602,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x04) } } + }, + { + min_api_version = 19 } ) @@ -581,6 +629,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x05) } } + }, + { + min_api_version = 19 } ) @@ -605,6 +656,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x06) } } + }, + { + min_api_version = 19 } ) @@ -629,6 +683,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x01) } } + }, + { + min_api_version = 19 } ) @@ -653,6 +710,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -677,6 +737,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) @@ -701,6 +764,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x04) } } + }, + { + min_api_version = 19 } ) @@ -725,6 +791,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x05) } } + }, + { + min_api_version = 19 } ) @@ -749,6 +818,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x06) } } + }, + { + min_api_version = 19 } ) @@ -796,7 +868,11 @@ test.register_coroutine_test( mock_base_device.id, OnOff.attributes.OnOff:read(mock_base_device):to_endpoint(0x01) }) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn.lua index 79e7a66b54..b3daa53bc9 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn.lua @@ -104,7 +104,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -142,7 +143,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -165,7 +167,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -188,7 +191,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -214,7 +218,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -283,7 +288,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -314,7 +320,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -350,7 +357,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm30_sn:generate_test_message("button1", capabilities.button.button.pushed_2x({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) -- Test temperature measurement @@ -370,6 +380,9 @@ test.register_message_test( direction = "send", message = mock_inovelli_vzm30_sn:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 25.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -390,6 +403,9 @@ test.register_message_test( direction = "send", message = mock_inovelli_vzm30_sn:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity(65)) } + }, + { + min_api_version = 19 } ) @@ -409,7 +425,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm30_sn:generate_test_message("main", capabilities.powerMeter.power({value = 200.0, unit = "W"})) ) - end + end, + { + min_api_version = 19 + } ) -- Test energy meter @@ -427,7 +446,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm30_sn:generate_test_message("main", capabilities.energyMeter.energy({value = 0.212, unit = "kWh"})) ) - end + end, + { + min_api_version = 19 + } ) -- Test energy meter reset command @@ -474,7 +496,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -531,7 +554,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_inovelli_vzm30_sn.id, RelativeHumidity.attributes.MeasuredValue:configure_reporting(mock_inovelli_vzm30_sn, 30, 3600, 50) }) mock_inovelli_vzm30_sn:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn_child.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn_child.lua index e40ead721a..201367b101 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn_child.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn_child.lua @@ -90,7 +90,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -143,7 +144,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device switch off command @@ -174,7 +178,10 @@ test.register_coroutine_test( utils.serialize_int(0, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device level command @@ -230,7 +237,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device color command @@ -290,7 +300,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device color temperature command @@ -350,7 +363,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn_preferences.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn_preferences.lua index 0726a2d575..a12be49120 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn_preferences.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm30_sn_preferences.lua @@ -61,7 +61,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter9 preference change @@ -83,7 +86,10 @@ test.register_coroutine_test( expected_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter52 preference change @@ -104,7 +110,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter258 preference change @@ -125,7 +134,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter11 preference change (VZM30-only, same as VZM31) @@ -146,7 +158,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter17 preference change (VZM30-only, same as VZM31) @@ -167,7 +182,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter22 preference change (VZM30-only, same as VZM31) @@ -188,7 +206,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test notificationChild preference change @@ -204,7 +225,10 @@ test.register_coroutine_test( }) test.socket.device_lifecycle:__queue_receive(mock_inovelli_vzm30_sn:generate_info_changed({preferences = {notificationChild = true}})) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn.lua index a3d57415b1..f777ce7b0c 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn.lua @@ -72,7 +72,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -95,7 +96,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -118,7 +120,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -144,7 +147,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -213,7 +217,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -244,7 +249,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -280,7 +286,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm31_sn:generate_test_message("button1", capabilities.button.button.pushed_2x({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) -- Test power meter from ElectricalMeasurement @@ -299,7 +308,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm31_sn:generate_test_message("main", capabilities.powerMeter.power({value = 200.0, unit = "W"})) ) - end + end, + { + min_api_version = 19 + } ) -- Test energy meter @@ -318,7 +330,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm31_sn:generate_test_message("main", capabilities.energyMeter.energy({value = 500.0, unit = "kWh"})) ) - end + end, + { + min_api_version = 19 + } ) -- Test energy meter reset command @@ -365,7 +380,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -415,7 +431,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_inovelli_vzm31_sn.id, clusters.ElectricalMeasurement.attributes.ACPowerMultiplier:read(mock_inovelli_vzm31_sn) }) mock_inovelli_vzm31_sn:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn_child.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn_child.lua index c6476cba5e..d26bcad631 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn_child.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn_child.lua @@ -79,7 +79,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -132,7 +133,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device switch off command @@ -163,7 +167,10 @@ test.register_coroutine_test( utils.serialize_int(0, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device level command @@ -219,7 +226,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device color command @@ -279,7 +289,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device color temperature command @@ -339,7 +352,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn_preferences.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn_preferences.lua index 64b0d51ee5..e8b22b0584 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn_preferences.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm31_sn_preferences.lua @@ -50,7 +50,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter9 preference change @@ -72,7 +75,10 @@ test.register_coroutine_test( expected_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter52 preference change @@ -93,7 +99,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter258 preference change @@ -114,7 +123,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter11 preference change (VZM31-only) @@ -135,7 +147,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter17 preference change (VZM31-only) @@ -156,7 +171,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter22 preference change (VZM31-only) @@ -177,7 +195,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test notificationChild preference change @@ -193,7 +214,10 @@ test.register_coroutine_test( }) test.socket.device_lifecycle:__queue_receive(mock_inovelli_vzm31_sn:generate_info_changed({preferences = {notificationChild = true}})) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn.lua index 0a288f27d4..501575ff45 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn.lua @@ -83,7 +83,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -116,7 +117,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -139,7 +141,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -162,7 +165,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -188,7 +192,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -257,7 +262,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -288,7 +294,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -324,7 +331,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm32_sn:generate_test_message("button1", capabilities.button.button.pushed_2x({ state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) -- Test illuminance measurement @@ -344,6 +354,9 @@ test.register_message_test( direction = "send", message = mock_inovelli_vzm32_sn:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({value = 13})) } + }, + { + min_api_version = 19 } ) @@ -364,6 +377,9 @@ test.register_message_test( direction = "send", message = mock_inovelli_vzm32_sn:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -384,6 +400,9 @@ test.register_message_test( direction = "send", message = mock_inovelli_vzm32_sn:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -404,7 +423,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm32_sn:generate_test_message("main", capabilities.powerMeter.power({value = 200.0, unit = "W"})) ) - end + end, + { + min_api_version = 19 + } ) -- Test energy meter @@ -421,7 +443,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_inovelli_vzm32_sn:generate_test_message("main", capabilities.energyMeter.energy({value = 0.212, unit = "kWh"})) ) - end + end, + { + min_api_version = 19 + } ) -- Test energy meter reset command @@ -468,7 +493,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -521,7 +547,11 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_inovelli_vzm32_sn.id, clusters.IlluminanceMeasurement.attributes.MeasuredValue:configure_reporting(mock_inovelli_vzm32_sn, 10, 600, 11761) }) mock_inovelli_vzm32_sn:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn_child.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn_child.lua index 26346c04a9..f2a6c79229 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn_child.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn_child.lua @@ -79,7 +79,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -132,7 +133,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device switch off command @@ -163,7 +167,10 @@ test.register_coroutine_test( utils.serialize_int(0, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device level command @@ -219,7 +226,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device color command @@ -279,7 +289,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) -- Test child device color temperature command @@ -339,7 +352,10 @@ test.register_coroutine_test( utils.serialize_int(notificationValue, 4, false, false) ) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn_preferences.lua b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn_preferences.lua index 28ae4829a0..5bfc25c66a 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn_preferences.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_inovelli_vzm32_sn_preferences.lua @@ -50,7 +50,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter9 preference change @@ -72,7 +75,10 @@ test.register_coroutine_test( expected_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter52 preference change @@ -93,7 +99,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test parameter258 preference change @@ -114,7 +123,10 @@ test.register_coroutine_test( new_param_value ) }) - end + end, + { + min_api_version = 19 + } ) -- Test notificationChild preference change @@ -130,7 +142,10 @@ test.register_coroutine_test( }) test.socket.device_lifecycle:__queue_receive(mock_inovelli_vzm32_sn:generate_info_changed({preferences = {notificationChild = true}})) - end + end, + { + min_api_version = 19 + } ) -- Test parameter101 preference change @@ -157,7 +172,11 @@ test.register_coroutine_test( mock_inovelli_vzm32_sn.id, expected_command }) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_jasco_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_jasco_switch.lua index 52ba3ef2a6..349a9ce3e7 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_jasco_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_jasco_switch.lua @@ -5,11 +5,14 @@ local test = require "integration_test" local clusters = require "st.zigbee.zcl.clusters" local OnOffCluster = clusters.OnOff local SimpleMeteringCluster = clusters.SimpleMetering +local ElectricalMeasurementCluster = clusters.ElectricalMeasurement local capabilities = require "st.capabilities" local t_utils = require "integration_test.utils" +local zigbee_test_utils = require "integration_test.zigbee_test_utils" local mock_device = test.mock_device.build_test_zigbee_device({ profile = t_utils.get_profile_definition("switch-power-energy.yml"), + fingerprinted_endpoint_id = 0x01, zigbee_endpoints = { [1] = { id = 1, @@ -21,6 +24,8 @@ local mock_device = test.mock_device.build_test_zigbee_device({ } }) +zigbee_test_utils.prepare_zigbee_env_info() + local function test_init() mock_device:set_field("_configuration_version", 1, {persist = true}) test.mock_device.add_test_device(mock_device) @@ -49,6 +54,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOffCluster.server.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -73,6 +81,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOffCluster.server.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -89,6 +100,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 33.3, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -110,6 +124,38 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 0.5555, unit = "kWh" })) } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "doConfigure lifecycle should call refresh and configure on device", + function() + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) + -- device:refresh() reads + test.socket.zigbee:__expect_send({ mock_device.id, OnOffCluster.attributes.OnOff:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, SimpleMeteringCluster.attributes.InstantaneousDemand:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, SimpleMeteringCluster.attributes.CurrentSummationDelivered:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ElectricalMeasurementCluster.attributes.ActivePower:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ElectricalMeasurementCluster.attributes.ACPowerDivisor:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ElectricalMeasurementCluster.attributes.ACPowerMultiplier:read(mock_device) }) + -- device:configure() bind requests and configure_reporting + test.socket.zigbee:__expect_send({ mock_device.id, zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, OnOffCluster.ID) }) + test.socket.zigbee:__expect_send({ mock_device.id, OnOffCluster.attributes.OnOff:configure_reporting(mock_device, 0, 300) }) + test.socket.zigbee:__expect_send({ mock_device.id, zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, SimpleMeteringCluster.ID) }) + test.socket.zigbee:__expect_send({ mock_device.id, SimpleMeteringCluster.attributes.InstantaneousDemand:configure_reporting(mock_device, 5, 3600, 5) }) + test.socket.zigbee:__expect_send({ mock_device.id, SimpleMeteringCluster.attributes.CurrentSummationDelivered:configure_reporting(mock_device, 5, 3600, 1) }) + test.socket.zigbee:__expect_send({ mock_device.id, zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, ElectricalMeasurementCluster.ID) }) + test.socket.zigbee:__expect_send({ mock_device.id, ElectricalMeasurementCluster.attributes.ActivePower:configure_reporting(mock_device, 5, 3600, 5) }) + test.socket.zigbee:__expect_send({ mock_device.id, ElectricalMeasurementCluster.attributes.ACPowerDivisor:configure_reporting(mock_device, 1, 43200, 1) }) + test.socket.zigbee:__expect_send({ mock_device.id, ElectricalMeasurementCluster.attributes.ACPowerMultiplier:configure_reporting(mock_device, 1, 43200, 1) }) + mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) + end, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_laisiao_bath_heather.lua b/drivers/SmartThings/zigbee-switch/src/test/test_laisiao_bath_heather.lua index 0457c0eb62..b6237eff0e 100755 --- a/drivers/SmartThings/zigbee-switch/src/test/test_laisiao_bath_heather.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_laisiao_bath_heather.lua @@ -48,6 +48,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -65,6 +68,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch2", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -82,6 +88,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch3", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -99,6 +108,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch4", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -116,6 +128,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch5", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -133,6 +148,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch6", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -150,6 +168,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch7", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -167,6 +188,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch8", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -186,6 +210,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -203,6 +230,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch2", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -220,6 +250,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch3", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -237,6 +270,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch4", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -254,6 +290,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch5", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -271,6 +310,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch6", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -288,6 +330,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch7", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -305,6 +350,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("switch8", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -315,7 +363,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch2", command = "on", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -325,7 +376,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch3", command = "on", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x03) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -335,7 +389,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch4", command = "on", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x04) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -345,7 +402,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch5", command = "on", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x05) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -355,7 +415,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch6", command = "on", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x06) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -365,7 +428,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch7", command = "on", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x07) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -375,7 +441,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch8", command = "on", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device):to_endpoint(0x08) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -385,7 +454,10 @@ test.register_coroutine_test( { capability = "switch", component = "main", command = "off", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x01) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -395,7 +467,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch2", command = "off", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -405,7 +480,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch3", command = "off", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x03) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -415,7 +493,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch4", command = "off", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x04) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -425,7 +506,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch5", command = "off", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x05) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -435,7 +519,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch6", command = "off", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x06) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -445,7 +532,10 @@ test.register_coroutine_test( { capability = "switch", component = "switch7", command = "off", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x07) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -455,7 +545,30 @@ test.register_coroutine_test( { capability = "switch", component = "switch8", command = "off", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.Off(mock_device):to_endpoint(0x08) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "component main Capability on command emits on then off after delay", + function() + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + test.socket.capability:__queue_receive({ mock_device.id, + { capability = "switch", component = "main", command = "on", args = {} } }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.switch.switch.on()) + ) + test.wait_for_events() + test.mock_time.advance_time(1) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.switch.switch.off()) + ) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch.lua index 1ff11bd754..0a4be10929 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch.lua @@ -37,6 +37,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("switch1", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -54,6 +57,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("switch2", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -70,6 +76,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("switch3", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -87,6 +96,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("switch1", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -103,6 +115,9 @@ test.register_message_test( direction = "send", message = { mock_simple_device.id, OnOff.server.commands.On(mock_simple_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch_no_master.lua b/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch_no_master.lua index 0f00d47fdb..4f01185c1b 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch_no_master.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch_no_master.lua @@ -103,6 +103,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -133,6 +136,9 @@ test.register_message_test( { device_uuid = mock_first_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -163,6 +169,9 @@ test.register_message_test( { device_uuid = mock_second_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -193,6 +202,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -223,6 +235,9 @@ test.register_message_test( { device_uuid = mock_first_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -253,6 +268,9 @@ test.register_message_test( { device_uuid = mock_second_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -277,6 +295,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device) } } + }, + { + min_api_version = 19 } ) @@ -301,6 +322,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -325,6 +349,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) @@ -349,6 +376,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device) } } + }, + { + min_api_version = 19 } ) @@ -373,6 +403,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -397,6 +430,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) @@ -473,7 +509,52 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_base_device.id, OnOff.attributes.OnOff:read(mock_base_device):to_endpoint(2) }) test.socket.zigbee:__expect_send({ mock_base_device.id, OnOff.attributes.OnOff:read(mock_base_device):to_endpoint(3) }) mock_base_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } +) + +local mock_non_mns_device = test.mock_device.build_test_zigbee_device( + { + label = "Generic Switch 1", + profile = profile, + zigbee_endpoints = { + [1] = { + id = 1, + manufacturer = "GenericMfr", + model = "GenericModel-DualSwitch", + server_clusters = { 0x0006 } + }, + [2] = { + id = 2, + manufacturer = "GenericMfr", + model = "GenericModel-DualSwitch", + server_clusters = { 0x0006 } + } + }, + fingerprinted_endpoint_id = 0x01 + } +) + +test.register_coroutine_test( + "device added lifecycle creates child device for secondary OnOff endpoint", + function() + test.socket.device_lifecycle:__queue_receive({ mock_non_mns_device.id, "added" }) + mock_non_mns_device:expect_device_create({ + type = "EDGE_CHILD", + label = "Generic Switch 1 2", + profile = "basic-switch", + parent_device_id = mock_non_mns_device.id, + parent_assigned_child_key = "02" + }) + end, + { + test_init = function() + test.mock_device.add_test_device(mock_non_mns_device) + end, + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch_power.lua b/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch_power.lua index 4e35d5067d..4511a2e610 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch_power.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_multi_switch_power.lua @@ -116,7 +116,8 @@ test.register_coroutine_test( { test_init = function() -- no op to avoid auto device add and immediate init event on driver startup - end + end, + min_api_version = 19 } ) @@ -139,7 +140,8 @@ test.register_coroutine_test( { test_init = function() -- no op to avoid auto device add and immediate init event on driver startup - end + end, + min_api_version = 19 } ) @@ -169,7 +171,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -199,7 +202,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -225,6 +229,9 @@ test.register_message_test( { device_uuid = mock_child_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -250,6 +257,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -275,6 +285,9 @@ test.register_message_test( { device_uuid = mock_child_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -300,6 +313,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -327,6 +343,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -354,6 +373,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -378,6 +400,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -402,6 +427,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x01) } } + }, + { + min_api_version = 19 } ) @@ -426,6 +454,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -450,6 +481,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x01) } } + }, + { + min_api_version = 19 } ) @@ -473,7 +507,10 @@ test.register_coroutine_test( mock_base_device.id, ElectricalMeasurement.attributes.ActivePower:read(mock_base_device):to_endpoint(0x01) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -489,7 +526,10 @@ test.register_coroutine_test( mock_parent_device.id, ElectricalMeasurement.attributes.ActivePower:read(mock_child_device):to_endpoint(0x02) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_on_off_zigbee_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_on_off_zigbee_bulb.lua index 7f0d412016..e1a6b4c1b4 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_on_off_zigbee_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_on_off_zigbee_bulb.lua @@ -45,6 +45,9 @@ test.register_message_test( { device_uuid = mock_simple_device.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -70,6 +73,9 @@ test.register_message_test( { device_uuid = mock_simple_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -95,6 +101,9 @@ test.register_message_test( { device_uuid = mock_simple_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -121,6 +130,9 @@ test.register_message_test( math.floor(57 * 0xFE / 100), 0) } } + }, + { + min_api_version = 19 } ) @@ -161,7 +173,10 @@ test.register_coroutine_test( 1) }) mock_simple_device:expect_metadata_update({provisioning_state = "PROVISIONED"}) - end + end, + { + min_api_version = 19 + } ) -- test.register_coroutine_test( diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_osram_iqbr30_light.lua b/drivers/SmartThings/zigbee-switch/src/test/test_osram_iqbr30_light.lua index 082aa0c5c2..9a3f8bdf3b 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_osram_iqbr30_light.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_osram_iqbr30_light.lua @@ -63,7 +63,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -71,7 +74,10 @@ test.register_coroutine_test( function() test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.capability:__expect_send(mock_device:generate_test_message("main",capabilities.switchLevel.level(100))) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -100,7 +106,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -130,7 +137,8 @@ test.register_message_test( } }, { - inner_block_ordering = "RELAXED" + inner_block_ordering = "RELAXED", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_osram_light.lua b/drivers/SmartThings/zigbee-switch/src/test/test_osram_light.lua index 8e2e847e2c..e956f63685 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_osram_light.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_osram_light.lua @@ -63,7 +63,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -71,7 +74,10 @@ test.register_coroutine_test( function() test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.capability:__expect_send(mock_device:generate_test_message("main",capabilities.switchLevel.level(100))) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -100,7 +106,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua index 68af9fdedb..61af32086d 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua @@ -65,7 +65,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -110,7 +113,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -135,7 +139,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -159,7 +166,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -188,7 +198,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device)}) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua index 24ec471c9d..401ed092bf 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua @@ -88,7 +88,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -141,7 +144,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -166,7 +170,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -190,7 +197,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -216,7 +226,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device)}) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -239,7 +252,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -252,7 +268,10 @@ test.register_coroutine_test( ColorControl.commands.MoveToColorTemperature(mock_device, 200, 0) } ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_robb_smarrt_2-wire_dimmer.lua b/drivers/SmartThings/zigbee-switch/src/test/test_robb_smarrt_2-wire_dimmer.lua index 1c815e2d7c..7638b23411 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_robb_smarrt_2-wire_dimmer.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_robb_smarrt_2-wire_dimmer.lua @@ -54,6 +54,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -78,6 +81,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -103,6 +109,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -120,6 +129,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 9.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -138,6 +150,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 15.0, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_robb_smarrt_knob_dimmer.lua b/drivers/SmartThings/zigbee-switch/src/test/test_robb_smarrt_knob_dimmer.lua index 3ed587916c..577e587dfc 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_robb_smarrt_knob_dimmer.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_robb_smarrt_knob_dimmer.lua @@ -54,6 +54,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -78,6 +81,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -103,6 +109,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -121,6 +130,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 15.0, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_sengled_color_temp_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_sengled_color_temp_bulb.lua index e2ddba42d3..4d0d0d6425 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_sengled_color_temp_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_sengled_color_temp_bulb.lua @@ -73,8 +73,13 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -111,7 +116,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -139,7 +145,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_sengled_dimmer_bulb_with_motion_sensor.lua b/drivers/SmartThings/zigbee-switch/src/test/test_sengled_dimmer_bulb_with_motion_sensor.lua index e28c4de0b6..f3a25f2186 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_sengled_dimmer_bulb_with_motion_sensor.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_sengled_dimmer_bulb_with_motion_sensor.lua @@ -67,7 +67,10 @@ test.register_coroutine_test( IASZone.attributes.ZoneStatus:configure_reporting(mock_device, 30, 300, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -78,7 +81,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -89,7 +95,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -108,7 +117,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -127,7 +139,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -146,7 +161,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -170,6 +188,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) @@ -194,6 +215,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "motionSensor", capability_attr_id = "motion" } } }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_sinope_dimmer.lua b/drivers/SmartThings/zigbee-switch/src/test/test_sinope_dimmer.lua index 0859138a8c..345c84059a 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_sinope_dimmer.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_sinope_dimmer.lua @@ -71,7 +71,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(updates.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -103,7 +107,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(updates.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( "infochanged to check for necessary preferences settings or updated when ledIntensity and minimalIntensity preference settings are zero with swBuild > 106", @@ -138,7 +146,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(updates.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -170,7 +182,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(updates.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -196,7 +212,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(600, data_types.Uint16, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -218,7 +238,11 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed(updates)) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -254,7 +278,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(updates.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -286,7 +314,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(updates.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_message_test( @@ -326,6 +358,9 @@ test.register_message_test( Basic.attributes.ApplicationVersion:read(mock_device) } }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_sinope_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_sinope_switch.lua index 34e5f78640..d6c5ee2b14 100755 --- a/drivers/SmartThings/zigbee-switch/src/test/test_sinope_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_sinope_switch.lua @@ -55,7 +55,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(device_info_copy.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -78,7 +82,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(device_info_copy.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -101,7 +109,11 @@ test.register_coroutine_test( data_types.validate_or_build_type(device_info_copy.preferences.ledIntensity, data_types.Uint8, "payload"))}) test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } + ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_switch_power.lua b/drivers/SmartThings/zigbee-switch/src/test/test_switch_power.lua index 04c17b15de..ce9fd12cb1 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_switch_power.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_switch_power.lua @@ -123,7 +123,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, SimpleMetering.attributes.Divisor:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, SimpleMetering.attributes.Multiplier:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -176,7 +179,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -236,7 +240,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_aurora_relay_device.id, ElectricalMeasurement.attributes.ACPowerMultiplier:read(mock_aurora_relay_device) }) test.socket.zigbee:__expect_send({ mock_aurora_relay_device.id, SimpleMetering.attributes.InstantaneousDemand:read(mock_aurora_relay_device) }) mock_aurora_relay_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -303,7 +310,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_vimar_device.id, ElectricalMeasurement.attributes.ACPowerMultiplier:read(mock_vimar_device) }) test.socket.zigbee:__expect_send({ mock_vimar_device.id, SimpleMetering.attributes.InstantaneousDemand:read(mock_vimar_device) }) mock_vimar_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi.lua b/drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi.lua index a00f74bddf..6d1c3ed59b 100755 --- a/drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi.lua @@ -1,82 +1,85 @@ --- Copyright 2025 SmartThings, Inc. --- Licensed under the Apache License, Version 2.0 - -local test = require "integration_test" -local clusters = require "st.zigbee.zcl.clusters" -local BasicCluster = clusters.Basic -local OnOffCluster = clusters.OnOff -local t_utils = require "integration_test.utils" -local zigbee_test_utils = require "integration_test.zigbee_test_utils" - -local profile = t_utils.get_profile_definition("basic-switch.yml") - -local mock_device = test.mock_device.build_test_zigbee_device({ - label = "Zigbee Switch", - profile = profile, - zigbee_endpoints = { - [1] = { - id = 1, - manufacturer = "_TZ123fas", - server_clusters = { 0x0006 }, - }, - [2] = { - id = 2, - manufacturer = "_TZ123fas", - server_clusters = { 0x0006 }, - }, - }, - fingerprinted_endpoint_id = 0x01 -}) - -zigbee_test_utils.prepare_zigbee_env_info() - -local function test_init() - mock_device:set_field("_configuration_version", 1, {persist = true}) - test.mock_device.add_test_device(mock_device) -end - -test.set_test_init_function(test_init) - -test.register_coroutine_test( - "lifecycle configure event should configure device", - function () - test.socket.zigbee:__set_channel_ordering("relaxed") - test.socket.device_lifecycle:__queue_receive({mock_device.id, "doConfigure"}) - test.socket.zigbee:__expect_send({ - mock_device.id, - OnOffCluster.attributes.OnOff:read(mock_device) - }) - test.socket.zigbee:__expect_send({ - mock_device.id, - OnOffCluster.attributes.OnOff:read(mock_device):to_endpoint(0x02) - }) - test.socket.zigbee:__expect_send({ - mock_device.id, - OnOffCluster.attributes.OnOff:configure_reporting(mock_device, 0, 300):to_endpoint(1) - }) - test.socket.zigbee:__expect_send({ - mock_device.id, - OnOffCluster.attributes.OnOff:configure_reporting(mock_device, 0, 300):to_endpoint(2) - }) - test.socket.zigbee:__expect_send({ - mock_device.id, - zigbee_test_utils.build_bind_request(mock_device, - zigbee_test_utils.mock_hub_eui, - OnOffCluster.ID, 1):to_endpoint(1) - }) - test.socket.zigbee:__expect_send({ - mock_device.id, - zigbee_test_utils.build_bind_request(mock_device, - zigbee_test_utils.mock_hub_eui, - OnOffCluster.ID, 2):to_endpoint(2) - }) - test.socket.zigbee:__expect_send({ - mock_device.id, - zigbee_test_utils.build_attribute_read(mock_device, BasicCluster.ID, {0x0004, 0x0000, 0x0001, 0x0005, 0x0007, 0xfffe}) - }) - - mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end -) - -test.run_registered_tests() +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local test = require "integration_test" +local clusters = require "st.zigbee.zcl.clusters" +local BasicCluster = clusters.Basic +local OnOffCluster = clusters.OnOff +local t_utils = require "integration_test.utils" +local zigbee_test_utils = require "integration_test.zigbee_test_utils" + +local profile = t_utils.get_profile_definition("basic-switch.yml") + +local mock_device = test.mock_device.build_test_zigbee_device({ + label = "Zigbee Switch", + profile = profile, + zigbee_endpoints = { + [1] = { + id = 1, + manufacturer = "_TZ123fas", + server_clusters = { 0x0006 }, + }, + [2] = { + id = 2, + manufacturer = "_TZ123fas", + server_clusters = { 0x0006 }, + }, + }, + fingerprinted_endpoint_id = 0x01 +}) + +zigbee_test_utils.prepare_zigbee_env_info() + +local function test_init() + mock_device:set_field("_configuration_version", 1, {persist = true}) + test.mock_device.add_test_device(mock_device) +end + +test.set_test_init_function(test_init) + +test.register_coroutine_test( + "lifecycle configure event should configure device", + function () + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.device_lifecycle:__queue_receive({mock_device.id, "doConfigure"}) + test.socket.zigbee:__expect_send({ + mock_device.id, + OnOffCluster.attributes.OnOff:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + OnOffCluster.attributes.OnOff:read(mock_device):to_endpoint(0x02) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + OnOffCluster.attributes.OnOff:configure_reporting(mock_device, 0, 300):to_endpoint(1) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + OnOffCluster.attributes.OnOff:configure_reporting(mock_device, 0, 300):to_endpoint(2) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + zigbee_test_utils.build_bind_request(mock_device, + zigbee_test_utils.mock_hub_eui, + OnOffCluster.ID, 1):to_endpoint(1) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + zigbee_test_utils.build_bind_request(mock_device, + zigbee_test_utils.mock_hub_eui, + OnOffCluster.ID, 2):to_endpoint(2) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + zigbee_test_utils.build_attribute_read(mock_device, BasicCluster.ID, {0x0004, 0x0000, 0x0001, 0x0005, 0x0007, 0xfffe}) + }) + + mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) + end, + { + min_api_version = 19 + } +) + +test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi_switch.lua index 1ff11bd754..0a4be10929 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi_switch.lua @@ -37,6 +37,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("switch1", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -54,6 +57,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("switch2", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -70,6 +76,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("switch3", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -87,6 +96,9 @@ test.register_message_test( direction = "send", message = mock_simple_device:generate_test_message("switch1", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -103,6 +115,9 @@ test.register_message_test( direction = "send", message = { mock_simple_device.id, OnOff.server.commands.On(mock_simple_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_wallhero_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_wallhero_switch.lua index ce1a9e2882..2940de9cc1 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_wallhero_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_wallhero_switch.lua @@ -118,6 +118,23 @@ local mock_seventh_child = test.mock_device.build_test_child_device( } ) +-- Single button device matching WALL HERO fingerprint (used to test button capability events) +local mock_button_device = test.mock_device.build_test_zigbee_device( + { + label = "WALL HERO Switch 1", + profile = scene_switch_profile_def, + zigbee_endpoints = { + [1] = { + id = 1, + manufacturer = "WALL HERO", + model = "ACL-401S1I", + server_clusters = { 0x0003, 0x0004, 0x0005, 0x0006 } + } + }, + fingerprinted_endpoint_id = 0x01 + } +) + zigbee_test_utils.prepare_zigbee_env_info() local function test_init() @@ -129,7 +146,9 @@ local function test_init() test.mock_device.add_test_device(mock_fourth_child) test.mock_device.add_test_device(mock_fifth_child) test.mock_device.add_test_device(mock_sixth_child) - test.mock_device.add_test_device(mock_seventh_child)end + test.mock_device.add_test_device(mock_seventh_child) + test.mock_device.add_test_device(mock_button_device) +end test.set_test_init_function(test_init) @@ -161,6 +180,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -191,6 +213,9 @@ test.register_message_test( { device_uuid = mock_first_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -221,6 +246,9 @@ test.register_message_test( { device_uuid = mock_second_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -251,6 +279,9 @@ test.register_message_test( { device_uuid = mock_third_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -281,6 +312,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -311,6 +345,9 @@ test.register_message_test( { device_uuid = mock_first_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -341,6 +378,9 @@ test.register_message_test( { device_uuid = mock_second_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -371,6 +411,9 @@ test.register_message_test( { device_uuid = mock_third_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -383,7 +426,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_parent_device.id, cluster_base.write_manufacturer_specific_attribute(mock_parent_device, 0x0006, 0x6000, 0x1235, data_types.Uint8, 0x01) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -395,7 +441,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_parent_device.id, cluster_base.write_manufacturer_specific_attribute(mock_parent_device, 0x0006, 0x6000, 0x1235, data_types.Uint8, 0x00) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -424,6 +473,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x01) } } + }, + { + min_api_version = 19 } ) @@ -448,6 +500,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -472,6 +527,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) @@ -496,6 +554,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x04) } } + }, + { + min_api_version = 19 } ) @@ -521,6 +582,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x01) } } + }, + { + min_api_version = 19 } ) @@ -545,6 +609,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -569,6 +636,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) @@ -593,6 +663,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x04) } } + }, + { + min_api_version = 19 } ) @@ -607,7 +680,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_fourth_child:generate_test_message("main", capabilities.button.button.pushed( { state_change = true } ))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -620,7 +696,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_fifth_child:generate_test_message("main", capabilities.button.button.pushed( { state_change = true } ))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -633,7 +712,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_sixth_child:generate_test_message("main", capabilities.button.button.pushed( { state_change = true } ))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -646,7 +728,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_seventh_child:generate_test_message("main", capabilities.button.button.pushed( { state_change = true } ))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -707,7 +792,24 @@ test.register_coroutine_test( mock_base_device.id, OnOff.attributes.OnOff:read(mock_base_device):to_endpoint(0x01) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "device_added lifecycle event should emit button capability events for button device", + function() + test.socket.device_lifecycle:__queue_receive({ mock_button_device.id, "added" }) + test.socket.capability:__expect_send(mock_button_device:generate_test_message("main", + capabilities.button.numberOfButtons({ value = 1 }, { visibility = { displayed = false } }))) + test.socket.capability:__expect_send(mock_button_device:generate_test_message("main", + capabilities.button.supportedButtonValues({ "pushed" }, { visibility = { displayed = false } }))) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_white_color_temp_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_white_color_temp_bulb.lua index f024aa45be..80d36fdec1 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_white_color_temp_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_white_color_temp_bulb.lua @@ -73,8 +73,13 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -111,7 +116,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -139,7 +145,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) test.socket.zigbee:__expect_send({mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_yanmi_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_yanmi_switch.lua index 61ad14e75d..b5f6b3ea89 100755 --- a/drivers/SmartThings/zigbee-switch/src/test/test_yanmi_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_yanmi_switch.lua @@ -99,6 +99,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -129,6 +132,9 @@ test.register_message_test( { device_uuid = mock_first_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -159,6 +165,9 @@ test.register_message_test( { device_uuid = mock_second_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -190,6 +199,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -220,6 +232,9 @@ test.register_message_test( { device_uuid = mock_first_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -250,6 +265,9 @@ test.register_message_test( { device_uuid = mock_second_child.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -280,6 +298,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x01) } } + }, + { + min_api_version = 19 } ) @@ -304,6 +325,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -328,6 +352,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.On(mock_parent_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) @@ -355,6 +382,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x01) } } + }, + { + min_api_version = 19 } ) @@ -379,6 +409,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -403,6 +436,9 @@ test.register_message_test( direction = "send", message = { mock_parent_device.id, OnOff.server.commands.Off(mock_parent_device):to_endpoint(0x03) } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_ezex_switch.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_ezex_switch.lua index 8995523952..13e5d3bba0 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_ezex_switch.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_ezex_switch.lua @@ -52,6 +52,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -76,6 +79,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -92,6 +98,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 9.766, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -116,6 +125,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -132,6 +144,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 0.009766, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_metering_plug_power_consumption_report.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_metering_plug_power_consumption_report.lua index d701bd89aa..a7988b9681 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_metering_plug_power_consumption_report.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_metering_plug_power_consumption_report.lua @@ -64,6 +64,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({value = 0.042, unit = "kWh"})) } + }, + { + min_api_version = 19 } ) @@ -80,6 +83,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 32.0, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -145,7 +151,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, SimpleMetering.attributes.CurrentSummationDelivered:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_metering_plug_rexense.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_metering_plug_rexense.lua index e1519a4d1a..a6fbabf429 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_metering_plug_rexense.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zigbee_metering_plug_rexense.lua @@ -47,6 +47,9 @@ test.register_message_test( direction = "send", message = { mock_simple_device.id, OnOff.server.commands.On(mock_simple_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) @@ -68,6 +71,9 @@ test.register_message_test( direction = "send", message = { mock_simple_device.id, OnOff.server.commands.Off(mock_simple_device):to_endpoint(0x02) } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zll_color_temp_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zll_color_temp_bulb.lua index 1a13044f48..4a46c58828 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zll_color_temp_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zll_color_temp_bulb.lua @@ -42,7 +42,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -63,7 +66,8 @@ test.register_coroutine_test( test_init = function() test.mock_device.add_test_device(mock_device) test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "polling") - end + end, + min_api_version = 19 } ) @@ -80,7 +84,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -96,7 +103,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -112,7 +122,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -129,7 +142,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zll_dimmer.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zll_dimmer.lua index 71305fba20..d1bb3db974 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zll_dimmer.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zll_dimmer.lua @@ -65,7 +65,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -73,7 +76,10 @@ test.register_coroutine_test( function() test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.capability:__expect_send(mock_device:generate_test_message("main",capabilities.switchLevel.level(100))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -83,7 +89,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -147,7 +156,8 @@ test.register_coroutine_test( test_init = function() test.mock_device.add_test_device(mock_device) test.timer.__create_and_queue_test_time_advance_timer(5*60, "interval", "polling") - end + end, + min_api_version = 19 } ) @@ -159,7 +169,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.server.commands.MoveToLevelWithOnOff(mock_device, 144, 0xFFFF) }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zll_dimmer_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zll_dimmer_bulb.lua index 0ac17313d3..b925cd62d2 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zll_dimmer_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zll_dimmer_bulb.lua @@ -61,7 +61,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -71,7 +74,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -81,7 +87,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -101,7 +110,8 @@ test.register_coroutine_test( test_init = function() test.mock_device.add_test_device(mock_device) test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "polling") - end + end, + min_api_version = 19 } ) @@ -120,7 +130,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -138,7 +151,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -156,7 +172,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgb_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgb_bulb.lua index a8384d1b13..3c4dd1c320 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgb_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgb_bulb.lua @@ -83,7 +83,10 @@ test.register_coroutine_test( } ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -95,7 +98,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -107,7 +113,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -129,7 +138,8 @@ test.register_coroutine_test( test_init = function() test.mock_device.add_test_device(mock_device) test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "polling") - end + end, + min_api_version = 19 } ) @@ -150,7 +160,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -170,7 +183,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -190,7 +206,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) local test_data = { @@ -235,7 +254,11 @@ for _, data in ipairs(test_data) do test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } + ) end @@ -280,7 +303,11 @@ for _, data in ipairs(test_data) do test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } + ) end @@ -319,7 +346,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -357,7 +387,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -381,7 +414,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentX:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentY:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -393,7 +429,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorControl.hue(75))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorControl.saturation(65))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -405,7 +444,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorControl.hue(75))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorControl.saturation(65))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -417,7 +459,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorControl.hue(75))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorControl.saturation(65))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -429,7 +474,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorControl.hue(75))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorControl.saturation(65))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua index cf53f7e359..988a83989c 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua @@ -83,8 +83,13 @@ test.register_coroutine_test( ColorControl.attributes.CurrentSaturation:configure_reporting(mock_device, 1, 3600, 16) } ) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) }) + test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -97,7 +102,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -120,7 +128,8 @@ test.register_coroutine_test( test_init = function() test.mock_device.add_test_device(mock_device) test.timer.__create_and_queue_test_time_advance_timer(5*60, "interval", "polling") - end + end, + min_api_version = 19 } ) @@ -142,7 +151,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +175,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -184,7 +199,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -206,7 +224,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -231,7 +252,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -256,7 +280,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -283,7 +310,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentHue:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.CurrentSaturation:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-switch/src/wallhero/init.lua b/drivers/SmartThings/zigbee-switch/src/wallhero/init.lua index 1e0e7eb26e..5ad97bfb29 100644 --- a/drivers/SmartThings/zigbee-switch/src/wallhero/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/wallhero/init.lua @@ -102,7 +102,7 @@ local wallheroswitch = { NAME = "Zigbee Wall Hero Switch", lifecycle_handlers = { added = device_added, - init = configurations.power_reconfig_wrapper(device_init), + init = configurations.reconfig_wrapper(device_init), infoChanged = device_info_changed }, zigbee_handlers = { diff --git a/drivers/SmartThings/zigbee-switch/src/zigbee-dimmer-power-energy/init.lua b/drivers/SmartThings/zigbee-switch/src/zigbee-dimmer-power-energy/init.lua index dc37bf1181..869678ef24 100644 --- a/drivers/SmartThings/zigbee-switch/src/zigbee-dimmer-power-energy/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zigbee-dimmer-power-energy/init.lua @@ -41,7 +41,7 @@ local zigbee_dimmer_power_energy_handler = { } }, lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(device_init), + init = configurations.reconfig_wrapper(device_init), doConfigure = do_configure, }, can_handle = require("zigbee-dimmer-power-energy.can_handle"), diff --git a/drivers/SmartThings/zigbee-switch/src/zigbee-dimming-light/init.lua b/drivers/SmartThings/zigbee-switch/src/zigbee-dimming-light/init.lua index dc8629c57b..880e947163 100644 --- a/drivers/SmartThings/zigbee-switch/src/zigbee-dimming-light/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zigbee-dimming-light/init.lua @@ -48,7 +48,7 @@ end local zigbee_dimming_light = { NAME = "Zigbee Dimming Light", lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(device_init), + init = configurations.reconfig_wrapper(device_init), added = device_added, doConfigure = do_configure }, diff --git a/drivers/SmartThings/zigbee-switch/src/zigbee-dual-metering-switch/init.lua b/drivers/SmartThings/zigbee-switch/src/zigbee-dual-metering-switch/init.lua index b1d10f94a6..f88c6396f5 100644 --- a/drivers/SmartThings/zigbee-switch/src/zigbee-dual-metering-switch/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zigbee-dual-metering-switch/init.lua @@ -52,7 +52,7 @@ local zigbee_dual_metering_switch = { } }, lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(device_init), + init = configurations.reconfig_wrapper(device_init), added = device_added }, can_handle = require("zigbee-dual-metering-switch.can_handle"), diff --git a/drivers/SmartThings/zigbee-switch/src/zigbee-metering-plug-power-consumption-report/init.lua b/drivers/SmartThings/zigbee-switch/src/zigbee-metering-plug-power-consumption-report/init.lua index 53a7e1eb99..1845878f19 100644 --- a/drivers/SmartThings/zigbee-switch/src/zigbee-metering-plug-power-consumption-report/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zigbee-metering-plug-power-consumption-report/init.lua @@ -41,7 +41,7 @@ local zigbee_metering_plug_power_conumption_report = { } }, lifecycle_handlers = { - init = configurations.power_reconfig_wrapper(device_init), + init = configurations.reconfig_wrapper(device_init), doConfigure = do_configure }, can_handle = require("zigbee-metering-plug-power-consumption-report.can_handle"), diff --git a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua index 3478b39bd5..b464b30acc 100644 --- a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua @@ -3,6 +3,7 @@ local device_lib = require "st.device" local clusters = require "st.zigbee.zcl.clusters" +local configurationMap = require "configurations" local function set_up_zll_polling(driver, device) local INFREQUENT_POLL_COUNTER = "_infrequent_poll_counter" @@ -33,7 +34,7 @@ end local ZLL_polling = { NAME = "ZLL Polling", lifecycle_handlers = { - init = set_up_zll_polling + init = configurationMap.reconfig_wrapper(set_up_zll_polling) }, can_handle = require("zll-polling.can_handle"), } diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_aqara_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_aqara_thermostat.lua index e026edb5f8..bce1f03b95 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_aqara_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_aqara_thermostat.lua @@ -75,7 +75,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_THERM0STAT_VALVE_DETECTION_SWITCH_ID, MFG_CODE, data_types.Uint8, 0x01) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -87,7 +90,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_ANTIFREEZE_MODE_TEMPERATURE_SETTING_ID, MFG_CODE, data_types.Uint32, 500) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -112,7 +118,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -147,7 +156,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", valveCalibration.calibrationState.calibrationFailure())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -176,7 +188,10 @@ test.register_coroutine_test( capabilities.thermostatMode.thermostatMode.antifreezing())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", invisibleCapabilities.invisibleCapabilities({"thermostatHeatingSetpoint"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -241,7 +256,10 @@ test.register_coroutine_test( capabilities.valve.valve.open())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", invisibleCapabilities.invisibleCapabilities({"thermostatHeatingSetpoint"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -266,7 +284,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("ChildLock", capabilities.lock.lock.locked())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -282,7 +303,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(48)) ) - end + end, + { + min_api_version = 19 + } ) -- test.register_coroutine_test("ControlSequenceOfOperation reporting should create the appropriate events", function() @@ -326,7 +350,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.manual()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -337,7 +364,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_VALVE_SWITCH_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 0x01) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -348,7 +378,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_VALVE_CALIBRATION_ID, MFG_CODE, data_types.Uint8, 0x01) }) - end + end, + { + min_api_version = 19 + } ) @@ -360,7 +393,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_CHILD_LOCK_ID, MFG_CODE, data_types.Uint8, 0x01) }) - end + end, + { + min_api_version = 19 + } ) --]] test.register_coroutine_test( @@ -432,7 +468,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(100)) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_centralite_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_centralite_thermostat.lua index 206333ffa7..6188e8327b 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_centralite_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_centralite_thermostat.lua @@ -46,6 +46,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -63,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -80,6 +86,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -108,7 +117,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -136,7 +148,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_danfoss_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_danfoss_thermostat.lua index 98727e563e..aba128d9ec 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_danfoss_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_danfoss_thermostat.lua @@ -42,6 +42,9 @@ test.register_message_test( direction = "send", message = mock_device_danfoss:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -50,7 +53,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({ mock_device_danfoss.id, Thermostat.attributes.LocalTemperature:build_test_attr_report(mock_device_danfoss, 2100) }) test.socket.capability:__expect_send(mock_device_danfoss:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.0, unit = "C"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -58,14 +64,20 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({ mock_device_danfoss.id, Thermostat.attributes.OccupiedHeatingSetpoint:build_test_attr_report(mock_device_danfoss, 2100) }) test.socket.capability:__expect_send(mock_device_danfoss:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 21.0, unit = "C"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Thermostat cooling setpoint reporting should not create setpoint events, the mode is not supported Danfoss", function () test.socket.zigbee:__queue_receive({ mock_device_danfoss.id, Thermostat.attributes.OccupiedCoolingSetpoint:build_test_attr_report(mock_device_danfoss, 2100) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -88,7 +100,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device_danfoss:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -104,6 +119,9 @@ test.register_message_test( direction = "send", message = mock_device_danfoss:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_fidure_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_fidure_thermostat.lua index 1f7a03f049..a6c72695fc 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_fidure_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_fidure_thermostat.lua @@ -61,7 +61,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -73,6 +76,9 @@ test.register_message_test( message = { mock_device.id, Thermostat.attributes.ThermostatRunningMode:build_test_attr_report(mock_device, 3), } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_leviton_rc.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_leviton_rc.lua index 6e6cdb0305..a62cb6a2a2 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_leviton_rc.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_leviton_rc.lua @@ -51,7 +51,10 @@ test.register_coroutine_test( mock_device.id, FanControl.attributes.FanMode:configure_reporting(mock_device, 5, 1800, nil):to_endpoint(ENDPOINT)}) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -65,7 +68,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device):to_endpoint(ENDPOINT) }) test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device):to_endpoint(ENDPOINT) }) test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.LocalTemperature:read(mock_device):to_endpoint(ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -73,7 +79,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.LocalTemperature:build_test_attr_report(mock_device, 2100) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 21.0, unit = "C"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -81,7 +90,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.SystemMode:build_test_attr_report(mock_device, Thermostat.attributes.SystemMode.OFF) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.off())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -90,7 +102,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.ControlSequenceOfOperation:build_test_attr_report(mock_device, 0x02)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({"auto", "cool", "heat", "emergency heat"},{visibility = {displayed = false }}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -98,7 +113,10 @@ test.register_coroutine_test( function () test.socket.zigbee:__queue_receive({ mock_device.id, FanControl.attributes.FanMode:build_test_attr_report(mock_device, FanControl.attributes.FanMode.AUTO) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatFanMode.thermostatFanMode.auto())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -110,7 +128,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.cool())) test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.OccupiedCoolingSetpoint:build_test_attr_report(mock_device, 2100) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({value = 21.0, unit = "C"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -122,7 +143,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.emergency_heat())) test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:build_test_attr_report(mock_device, 2100) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({value = 21.0, unit = "C"}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -133,7 +157,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.SystemMode:build_test_attr_report(mock_device, Thermostat.attributes.SystemMode.COOL)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.cool())) test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:build_test_attr_report(mock_device, 2100) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -144,7 +171,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.SystemMode:build_test_attr_report(mock_device, Thermostat.attributes.SystemMode.EMERGENCY_HEATING)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.emergency_heat())) test.socket.zigbee:__queue_receive({ mock_device.id, Thermostat.attributes.OccupiedCoolingSetpoint:build_test_attr_report(mock_device, 2100) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -153,7 +183,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { component = "main", capability = capabilities.thermostatHeatingSetpoint.ID, command = "setHeatingSetpoint", args = {21} } }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({value = 21.0, unit = "C"}))) test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device, 2100):to_endpoint(ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -162,7 +195,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { component = "main", capability = capabilities.thermostatCoolingSetpoint.ID, command = "setCoolingSetpoint", args = {21} } }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({value = 21.0, unit = "C"}))) test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.OccupiedCoolingSetpoint:write(mock_device, 2100):to_endpoint(ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -170,7 +206,10 @@ test.register_coroutine_test( function () test.socket.capability:__queue_receive({ mock_device.id, { component = "main", capability = capabilities.thermostatMode.ID, command = "setThermostatMode", args = {"cool"} } }) test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.SystemMode:write(mock_device, 3):to_endpoint(ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -178,7 +217,10 @@ test.register_coroutine_test( function () test.socket.capability:__queue_receive({ mock_device.id, { component = "main", capability = capabilities.thermostatFanMode.ID, command = "setThermostatFanMode", args = {"auto"} } }) test.socket.zigbee:__expect_send( { mock_device.id, FanControl.attributes.FanMode:write(mock_device, 5):to_endpoint(ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -209,7 +251,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device):to_endpoint(ENDPOINT) }) test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device):to_endpoint(ENDPOINT) }) test.socket.zigbee:__expect_send( { mock_device.id, Thermostat.attributes.LocalTemperature:read(mock_device):to_endpoint(ENDPOINT) }) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_popp_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_popp_thermostat.lua index ecff7883da..abf082dc0a 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_popp_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_popp_thermostat.lua @@ -67,6 +67,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -95,7 +98,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -114,7 +120,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, Thermostat.ID, EXTERNAL_WINDOW_OPEN_DETECTION, MFG_CODE, data_types.Boolean, false) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -133,7 +142,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, Thermostat.ID, EXTERNAL_WINDOW_OPEN_DETECTION, MFG_CODE, data_types.Boolean, true) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -154,7 +166,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedHeatingSetpoint:configure_reporting(mock_device, 5, 300, 50) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -173,6 +188,9 @@ test.register_message_test( { ThermostatMode.thermostatMode.heat.NAME, ThermostatMode.thermostatMode.eco.NAME }, { visibility = { displayed = false } })) } + }, + { + min_api_version = 19 } ) @@ -234,6 +252,9 @@ test.register_message_test( MFG_CODE) } } + }, + { + min_api_version = 19 } ) @@ -268,7 +289,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" }))) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -293,7 +317,10 @@ test.register_coroutine_test( capabilities.battery.battery(batt_perc))) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -327,7 +354,10 @@ test.register_coroutine_test( Thermostat.attributes.SystemMode:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -361,7 +391,10 @@ test.register_coroutine_test( Thermostat.attributes.SystemMode:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -375,7 +408,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.eco())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -424,7 +460,10 @@ test.register_coroutine_test( EXTERNAL_WINDOW_OPEN_DETECTION, MFG_CODE )}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -438,7 +477,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, Thermostat.ID, attr_report_data, MFG_CODE) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -452,7 +494,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, Thermostat.ID, attr_report_data, MFG_CODE) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_resideo_dt300st_m000.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_resideo_dt300st_m000.lua index 4c7f4bdcaf..22004cb322 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_resideo_dt300st_m000.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_resideo_dt300st_m000.lua @@ -100,7 +100,11 @@ test.register_coroutine_test("Configure should configure all necessary attribute mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) -end) +end, +{ + min_api_version = 19 +} +) -------------------------------------------------------------------------------- -- Parent thermostat device @@ -119,7 +123,11 @@ test.register_coroutine_test("Refresh should read all necessary attributes", fun for _, attribute in pairs(attributes) do test.socket.zigbee:__expect_send({mock_device.id, attribute:read(mock_device)}) end -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Temperature reporting should create the appropriate events", function() test.socket.zigbee:__queue_receive({mock_device.id, @@ -129,7 +137,11 @@ test.register_coroutine_test("Temperature reporting should create the appropriat value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Thermostat mode reporting should create the appropriate events", function() test.socket.zigbee:__queue_receive({mock_device.id, @@ -142,7 +154,11 @@ test.register_coroutine_test("Thermostat mode reporting should create the approp Thermostat.attributes.SystemMode.HEAT)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatMode .thermostatMode.heat())) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("ControlSequenceOfOperation reporting should create the appropriate events", function() test.socket.zigbee:__queue_receive({mock_device.id, @@ -154,7 +170,11 @@ test.register_coroutine_test("ControlSequenceOfOperation reporting should create displayed = false } }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create the appropriate events", function() test.socket.zigbee:__queue_receive({mock_device.id, @@ -165,7 +185,11 @@ test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create th value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the heating setpoint should generate the appropriate messages", function() test.socket.capability:__queue_receive({mock_device.id, { @@ -176,7 +200,11 @@ test.register_coroutine_test("Setting the heating setpoint should generate the a }}) test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device, 2100)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to away should generate the appropriate messages", function() test.socket.capability:__queue_receive({mock_device.id, { @@ -188,7 +216,11 @@ test.register_coroutine_test("Setting the thermostat mode to away should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_device, Thermostat.attributes.SystemMode.OFF)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to heat should generate the appropriate messages", function() test.socket.capability:__queue_receive({mock_device.id, { @@ -200,7 +232,11 @@ test.register_coroutine_test("Setting the thermostat mode to heat should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_device, Thermostat.attributes.SystemMode.HEAT)}) -end) +end, +{ + min_api_version = 19 +} +) -------------------------------------------------------------------------------- -- First child thermostat device @@ -219,7 +255,11 @@ test.register_coroutine_test("Refresh should read all necessary attributes with for _, attribute in pairs(attributes) do test.socket.zigbee:__expect_send({mock_device.id, attribute:read(mock_first_child)}) end -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Temperature reporting should create the appropriate events with first child device", function() test.socket.zigbee:__queue_receive({mock_first_child.id, @@ -229,7 +269,11 @@ test.register_coroutine_test("Temperature reporting should create the appropriat value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Thermostat mode reporting should create the appropriate events with first child device", function() test.socket.zigbee:__queue_receive({mock_first_child.id, @@ -242,7 +286,11 @@ test.register_coroutine_test("Thermostat mode reporting should create the approp Thermostat.attributes.SystemMode.HEAT)}) test.socket.capability:__expect_send(mock_first_child:generate_test_message("main", capabilities.thermostatMode .thermostatMode.heat())) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("ControlSequenceOfOperation reporting should create the appropriate events with first child device", function() test.socket.zigbee:__queue_receive({mock_first_child.id, @@ -254,7 +302,11 @@ test.register_coroutine_test("ControlSequenceOfOperation reporting should create displayed = false } }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create the appropriate events with first child device", function() test.socket.zigbee:__queue_receive({mock_first_child.id, @@ -265,7 +317,11 @@ test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create th value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the heating setpoint should generate the appropriate messages with first child device", function() test.socket.capability:__queue_receive({mock_first_child.id, { @@ -276,7 +332,11 @@ test.register_coroutine_test("Setting the heating setpoint should generate the a }}) test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_first_child, 2100)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to away should generate the appropriate messages with first child device", function() test.socket.capability:__queue_receive({mock_first_child.id, { @@ -288,7 +348,11 @@ test.register_coroutine_test("Setting the thermostat mode to away should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_first_child, Thermostat.attributes.SystemMode.OFF)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to heat should generate the appropriate messages with first child device", function() test.socket.capability:__queue_receive({mock_first_child.id, { @@ -300,7 +364,11 @@ test.register_coroutine_test("Setting the thermostat mode to heat should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_first_child, Thermostat.attributes.SystemMode.HEAT)}) -end) +end, +{ + min_api_version = 19 +} +) -------------------------------------------------------------------------------- -- Second child thermostat device @@ -319,7 +387,11 @@ test.register_coroutine_test("Refresh should read all necessary attributes with for _, attribute in pairs(attributes) do test.socket.zigbee:__expect_send({mock_device.id, attribute:read(mock_second_child)}) end -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Temperature reporting should create the appropriate events with second child device", function() test.socket.zigbee:__queue_receive({mock_second_child.id, @@ -329,7 +401,11 @@ test.register_coroutine_test("Temperature reporting should create the appropriat value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Thermostat mode reporting should create the appropriate events with second child device", function() test.socket.zigbee:__queue_receive({mock_second_child.id, @@ -342,7 +418,11 @@ test.register_coroutine_test("Thermostat mode reporting should create the approp Thermostat.attributes.SystemMode.HEAT)}) test.socket.capability:__expect_send(mock_second_child:generate_test_message("main", capabilities.thermostatMode .thermostatMode.heat())) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("ControlSequenceOfOperation reporting should create the appropriate events with second child device", function() test.socket.zigbee:__queue_receive({mock_second_child.id, @@ -354,7 +434,11 @@ test.register_coroutine_test("ControlSequenceOfOperation reporting should create displayed = false } }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create the appropriate events with second child device", function() test.socket.zigbee:__queue_receive({mock_second_child.id, @@ -365,7 +449,11 @@ test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create th value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the heating setpoint should generate the appropriate messages with second child device", function() test.socket.capability:__queue_receive({mock_second_child.id, { @@ -376,7 +464,11 @@ test.register_coroutine_test("Setting the heating setpoint should generate the a }}) test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_second_child, 2100)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to away should generate the appropriate messages with second child device", function() test.socket.capability:__queue_receive({mock_second_child.id, { @@ -388,7 +480,11 @@ test.register_coroutine_test("Setting the thermostat mode to away should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_second_child, Thermostat.attributes.SystemMode.OFF)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to heat should generate the appropriate messages with second child device", function() test.socket.capability:__queue_receive({mock_second_child.id, { @@ -400,7 +496,11 @@ test.register_coroutine_test("Setting the thermostat mode to heat should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_second_child, Thermostat.attributes.SystemMode.HEAT)}) -end) +end, +{ + min_api_version = 19 +} +) -------------------------------------------------------------------------------- -- Third child thermostat device @@ -419,7 +519,11 @@ test.register_coroutine_test("Refresh should read all necessary attributes with for _, attribute in pairs(attributes) do test.socket.zigbee:__expect_send({mock_device.id, attribute:read(mock_third_child)}) end -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Temperature reporting should create the appropriate events with third child device", function() test.socket.zigbee:__queue_receive({mock_third_child.id, @@ -429,7 +533,11 @@ test.register_coroutine_test("Temperature reporting should create the appropriat value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Thermostat mode reporting should create the appropriate events with third child device", function() test.socket.zigbee:__queue_receive({mock_third_child.id, @@ -442,7 +550,11 @@ test.register_coroutine_test("Thermostat mode reporting should create the approp Thermostat.attributes.SystemMode.HEAT)}) test.socket.capability:__expect_send(mock_third_child:generate_test_message("main", capabilities.thermostatMode .thermostatMode.heat())) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("ControlSequenceOfOperation reporting should create the appropriate events with third child device", function() test.socket.zigbee:__queue_receive({mock_third_child.id, @@ -454,7 +566,11 @@ test.register_coroutine_test("ControlSequenceOfOperation reporting should create displayed = false } }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create the appropriate events with third child device", function() test.socket.zigbee:__queue_receive({mock_third_child.id, @@ -465,7 +581,11 @@ test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create th value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the heating setpoint should generate the appropriate messages with third child device", function() test.socket.capability:__queue_receive({mock_third_child.id, { @@ -476,7 +596,11 @@ test.register_coroutine_test("Setting the heating setpoint should generate the a }}) test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_third_child, 2100)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to away should generate the appropriate messages with third child device", function() test.socket.capability:__queue_receive({mock_third_child.id, { @@ -488,7 +612,11 @@ test.register_coroutine_test("Setting the thermostat mode to away should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_third_child, Thermostat.attributes.SystemMode.OFF)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to heat should generate the appropriate messages with third child device", function() test.socket.capability:__queue_receive({mock_third_child.id, { @@ -500,7 +628,11 @@ test.register_coroutine_test("Setting the thermostat mode to heat should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_third_child, Thermostat.attributes.SystemMode.HEAT)}) -end) +end, +{ + min_api_version = 19 +} +) -------------------------------------------------------------------------------- -- Forth child thermostat device @@ -519,7 +651,11 @@ test.register_coroutine_test("Refresh should read all necessary attributes with for _, attribute in pairs(attributes) do test.socket.zigbee:__expect_send({mock_device.id, attribute:read(mock_forth_child)}) end -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Temperature reporting should create the appropriate events with forth child device", function() test.socket.zigbee:__queue_receive({mock_forth_child.id, @@ -529,7 +665,11 @@ test.register_coroutine_test("Temperature reporting should create the appropriat value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Thermostat mode reporting should create the appropriate events with forth child device", function() test.socket.zigbee:__queue_receive({mock_forth_child.id, @@ -542,7 +682,11 @@ test.register_coroutine_test("Thermostat mode reporting should create the approp Thermostat.attributes.SystemMode.HEAT)}) test.socket.capability:__expect_send(mock_forth_child:generate_test_message("main", capabilities.thermostatMode .thermostatMode.heat())) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("ControlSequenceOfOperation reporting should create the appropriate events with forth child device", function() test.socket.zigbee:__queue_receive({mock_forth_child.id, @@ -554,7 +698,11 @@ test.register_coroutine_test("ControlSequenceOfOperation reporting should create displayed = false } }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create the appropriate events with forth child device", function() test.socket.zigbee:__queue_receive({mock_forth_child.id, @@ -565,7 +713,11 @@ test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create th value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the heating setpoint should generate the appropriate messages with forth child device", function() test.socket.capability:__queue_receive({mock_forth_child.id, { @@ -576,7 +728,11 @@ test.register_coroutine_test("Setting the heating setpoint should generate the a }}) test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_forth_child, 2100)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to away should generate the appropriate messages with forth child device", function() test.socket.capability:__queue_receive({mock_forth_child.id, { @@ -588,7 +744,11 @@ test.register_coroutine_test("Setting the thermostat mode to away should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_forth_child, Thermostat.attributes.SystemMode.OFF)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to heat should generate the appropriate messages with forth child device", function() test.socket.capability:__queue_receive({mock_forth_child.id, { @@ -600,7 +760,11 @@ test.register_coroutine_test("Setting the thermostat mode to heat should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_forth_child, Thermostat.attributes.SystemMode.HEAT)}) -end) +end, +{ + min_api_version = 19 +} +) -------------------------------------------------------------------------------- -- Fifth child thermostat device @@ -619,7 +783,11 @@ test.register_coroutine_test("Refresh should read all necessary attributes with for _, attribute in pairs(attributes) do test.socket.zigbee:__expect_send({mock_device.id, attribute:read(mock_fifth_child)}) end -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Temperature reporting should create the appropriate events with fifth child device", function() test.socket.zigbee:__queue_receive({mock_fifth_child.id, @@ -629,7 +797,11 @@ test.register_coroutine_test("Temperature reporting should create the appropriat value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Thermostat mode reporting should create the appropriate events with fifth child device", function() test.socket.zigbee:__queue_receive({mock_fifth_child.id, @@ -642,7 +814,11 @@ test.register_coroutine_test("Thermostat mode reporting should create the approp Thermostat.attributes.SystemMode.HEAT)}) test.socket.capability:__expect_send(mock_fifth_child:generate_test_message("main", capabilities.thermostatMode .thermostatMode.heat())) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("ControlSequenceOfOperation reporting should create the appropriate events with fifth child device", function() test.socket.zigbee:__queue_receive({mock_fifth_child.id, @@ -654,7 +830,11 @@ test.register_coroutine_test("ControlSequenceOfOperation reporting should create displayed = false } }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create the appropriate events with fifth child device", function() test.socket.zigbee:__queue_receive({mock_fifth_child.id, @@ -665,7 +845,11 @@ test.register_coroutine_test("OccupiedHeatingSetpoint reporting shoulb create th value = 21.0, unit = "C" }))) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the heating setpoint should generate the appropriate messages with fifth child device", function() test.socket.capability:__queue_receive({mock_fifth_child.id, { @@ -676,7 +860,11 @@ test.register_coroutine_test("Setting the heating setpoint should generate the a }}) test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_fifth_child, 2100)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to away should generate the appropriate messages with fifth child device", function() test.socket.capability:__queue_receive({mock_fifth_child.id, { @@ -688,7 +876,11 @@ test.register_coroutine_test("Setting the thermostat mode to away should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_fifth_child, Thermostat.attributes.SystemMode.OFF)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("Setting the thermostat mode to heat should generate the appropriate messages with fifth child device", function() test.socket.capability:__queue_receive({mock_fifth_child.id, { @@ -700,7 +892,11 @@ test.register_coroutine_test("Setting the thermostat mode to heat should generat test.socket.zigbee:__expect_send({mock_device.id, Thermostat.attributes.SystemMode:write(mock_fifth_child, Thermostat.attributes.SystemMode.HEAT)}) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test("ThermostatRunningState reporting shoulb create the appropriate events", function() test.socket.zigbee:__queue_receive({mock_device.id, @@ -715,6 +911,10 @@ test.register_coroutine_test("ThermostatRunningState reporting shoulb create the Thermostat.attributes.ThermostatRunningState:build_test_attr_report(mock_device, 0x0004)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState({value="fan only"}))) -end) +end, +{ + min_api_version = 19 +} +) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_th1300_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_th1300_thermostat.lua index 6805e6c604..13fee65646 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_th1300_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_th1300_thermostat.lua @@ -45,6 +45,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -61,6 +64,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState("idle")) } + }, + { + min_api_version = 19 } ) @@ -94,7 +100,10 @@ test.register_coroutine_test( Thermostat.attributes.SystemMode:configure_reporting(mock_device, 10, 305) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -187,7 +196,10 @@ test.register_coroutine_test( data_types.validate_or_build_type(3000, data_types.Int16, "payload") ) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_th1400_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_th1400_thermostat.lua index 5ca78c3675..1f945776cd 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_th1400_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_th1400_thermostat.lua @@ -45,6 +45,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -61,6 +64,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState("idle")) } + }, + { + min_api_version = 19 } ) @@ -94,7 +100,10 @@ test.register_coroutine_test( Thermostat.attributes.SystemMode:configure_reporting(mock_device, 10, 305) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -197,7 +206,10 @@ test.register_coroutine_test( data_types.validate_or_build_type(0x0708, data_types.Uint16, "payload") ) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_thermostat.lua index 0717fbb9fa..e039e0999f 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_sinope_thermostat.lua @@ -45,6 +45,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -61,6 +64,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState("idle")) } + }, + { + min_api_version = 19 } ) @@ -94,7 +100,10 @@ test.register_coroutine_test( Thermostat.attributes.SystemMode:configure_reporting(mock_device, 10, 305) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -171,7 +180,40 @@ test.register_coroutine_test( ) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Refresh should send read requests for all necessary attributes", + function() + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "refresh", component = "main", command = "refresh", args = {} } + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + Thermostat.attributes.LocalTemperature:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + Thermostat.attributes.PIHeatingDemand:read(mock_device) + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + Thermostat.attributes.SystemMode:read(mock_device) + }) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_stelpro_ki_zigbee_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_stelpro_ki_zigbee_thermostat.lua index afb36720a3..358c381eb7 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_stelpro_ki_zigbee_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_stelpro_ki_zigbee_thermostat.lua @@ -57,6 +57,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.freeze()) } + }, + { + min_api_version = 19 } ) @@ -73,6 +76,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) } + }, + { + min_api_version = 19 } ) @@ -94,6 +100,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 55.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -115,6 +124,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = -1.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -136,6 +148,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 15.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -152,6 +167,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({value = 25.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -168,6 +186,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", ThermostatMode.thermostatMode.off()) } + }, + { + min_api_version = 19 } ) @@ -187,6 +208,9 @@ test.register_message_test( zigbee_test_utils.build_attribute_read(mock_device, Thermostat.ID, {MFR_SETPOINT_MODE_ATTTRIBUTE}, MFG_CODE) } } + }, + { + min_api_version = 19 } ) @@ -216,7 +240,10 @@ test.register_coroutine_test( Thermostat.attributes.PIHeatingDemand:build_test_attr_report(mock_device, 0) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", ThermostatOperatingState.thermostatOperatingState("idle"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -236,7 +263,10 @@ test.register_coroutine_test( {{ MFR_SETPOINT_MODE_ATTTRIBUTE, data_types.Uint16.ID, 0x04}}, MFG_CODE) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", ThermostatMode.thermostatMode.heat())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -266,7 +296,10 @@ test.register_coroutine_test( mock_device.id, cluster_base.read_manufacturer_specific_attribute(mock_device, Thermostat.ID, MFR_SETPOINT_MODE_ATTTRIBUTE, MFG_CODE) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -296,7 +329,10 @@ test.register_coroutine_test( mock_device.id, cluster_base.read_manufacturer_specific_attribute(mock_device, Thermostat.ID, MFR_SETPOINT_MODE_ATTTRIBUTE, MFG_CODE) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -385,7 +421,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -467,6 +506,9 @@ test.register_message_test( cluster_base.read_manufacturer_specific_attribute(mock_device, Thermostat.ID, MFR_SETPOINT_MODE_ATTTRIBUTE, MFG_CODE) } }, + }, + { + min_api_version = 19 } ) @@ -487,7 +529,11 @@ test.register_coroutine_test("Setting the heating setpoint should generate the a mock_device.id, Thermostat.attributes.PIHeatingDemand:read(mock_device) }) -end) +end, +{ + min_api_version = 19 +} +) test.register_coroutine_test( "Setting thermostat mode to eco should generate correct zigbee messages", @@ -515,7 +561,62 @@ test.register_coroutine_test( mock_device.id, cluster_base.read_manufacturer_specific_attribute(mock_device, Thermostat.ID, MFR_SETPOINT_MODE_ATTTRIBUTE, MFG_CODE) }) - end + end, + { + min_api_version = 19 + } +) +test.register_coroutine_test( + "LocalTemperature handler should request PIHeatingDemand when setpoint > temperature", + function() + local RAW_SETPOINT_FIELD = "raw_setpoint" + mock_device:set_field(RAW_SETPOINT_FIELD, 3000, { persist = true }) + + test.socket.zigbee:__queue_receive({ + mock_device.id, + Thermostat.attributes.LocalTemperature:build_test_attr_report(mock_device, 2000) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) + ) + test.socket.zigbee:__expect_send({ + mock_device.id, + Thermostat.attributes.PIHeatingDemand:read(mock_device) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 20.0, unit = "C" })) + ) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting an unsupported thermostat mode should re-emit the current mode", + function() + -- Establish a known current mode state + test.socket.zigbee:__queue_receive({ + mock_device.id, + Thermostat.attributes.SystemMode:build_test_attr_report(mock_device, ThermostatSystemMode.OFF) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", ThermostatMode.thermostatMode.off()) + ) + test.wait_for_events() + + -- "cool" is not in SUPPORTED_MODES for stelpro-ki; the driver re-emits the current mode + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "thermostatMode", component = "main", command = "setThermostatMode", args = { "cool" } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", ThermostatMode.thermostatMode.off()) + ) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_stelpro_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_stelpro_thermostat.lua index 3380856f1c..60470857d6 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_stelpro_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_stelpro_thermostat.lua @@ -49,6 +49,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 18.5, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -70,6 +73,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.freeze()) } + }, + { + min_api_version = 19 } ) @@ -91,6 +97,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) } + }, + { + min_api_version = 19 } ) @@ -122,7 +131,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -153,7 +165,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -173,7 +188,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.freeze()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -193,7 +211,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.freeze()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -214,7 +235,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -230,6 +254,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState("idle")) } + }, + { + min_api_version = 19 } ) @@ -246,6 +273,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState("heating")) } + }, + { + min_api_version = 19 } ) @@ -262,6 +292,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 18.5, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -278,6 +311,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 25 })) } + }, + { + min_api_version = 19 } ) @@ -317,7 +353,10 @@ test.register_coroutine_test( test.wait_for_events() test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -359,7 +398,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -396,7 +438,10 @@ test.register_coroutine_test( test.wait_for_events() test.socket.zigbee:__set_channel_ordering("relaxed") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -438,7 +483,10 @@ test.register_coroutine_test( }) mock_device_maestro:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -450,7 +498,10 @@ test.register_coroutine_test( test.wait_for_events() -- Event not to be handled by driver test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed({preferences = { lock = 1 } })) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -460,7 +511,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed({preferences = { lock = 0 } })) test.socket.zigbee:__expect_send({mock_device.id, ThermostatUserInterfaceConfiguration.attributes.KeypadLockout:write(mock_device, 0x00)}) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -495,7 +549,10 @@ test.register_coroutine_test( mock_device.id, RelativeHumidity.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_vimar_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_vimar_thermostat.lua index 7b2a0cc8f6..e300ddd797 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_vimar_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_vimar_thermostat.lua @@ -85,6 +85,9 @@ test.register_message_test( capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" }) ) } + }, + { + min_api_version = 19 } ) @@ -113,6 +116,9 @@ test.register_message_test( capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 30.0, unit = "C" }) ) } + }, + { + min_api_version = 19 } ) @@ -141,6 +147,9 @@ test.register_message_test( capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 18.0, unit = "C" }) ) } + }, + { + min_api_version = 19 } ) @@ -177,7 +186,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device_vimar_cooling) } ) - end + end, + { + min_api_version = 19 + } ) -- Test (SmartThings -> Device) @@ -213,7 +225,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device_vimar_cooling) } ) - end + end, + { + min_api_version = 19 + } ) -- Test (SmartThings -> Device) @@ -252,7 +267,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device_vimar_cooling) } ) - end + end, + { + min_api_version = 19 + } ) -- Test (SmartThings -> Device) @@ -291,7 +309,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device_vimar_cooling) } ) - end + end, + { + min_api_version = 19 + } ) @@ -352,7 +373,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:write(mock_device_vimar_cooling, 2720) } ) - end + end, + { + min_api_version = 19 + } ) @@ -389,7 +413,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device_vimar_heating) } ) - end + end, + { + min_api_version = 19 + } ) -- Test (SmartThings -> Device) @@ -425,7 +452,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device_vimar_heating) } ) - end + end, + { + min_api_version = 19 + } ) -- Test (SmartThings -> Device) @@ -464,7 +494,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device_vimar_heating) } ) - end + end, + { + min_api_version = 19 + } ) -- Test (SmartThings -> Device) @@ -503,7 +536,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device_vimar_heating) } ) - end + end, + { + min_api_version = 19 + } ) @@ -564,7 +600,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedHeatingSetpoint:write(mock_device_vimar_heating, 1920) } ) - end + end, + { + min_api_version = 19 + } ) @@ -596,6 +635,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -627,6 +669,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -683,6 +728,9 @@ test.register_message_test( Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device_vimar_heating) } } + }, + { + min_api_version = 19 } ) @@ -740,6 +788,9 @@ test.register_message_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device_vimar_cooling) } } + }, + { + min_api_version = 19 } ) @@ -767,7 +818,10 @@ test.register_coroutine_test( } } ) - end + end, + { + min_api_version = 19 + } ) -- Test (Device -> SmartThings) @@ -794,7 +848,10 @@ test.register_coroutine_test( } } ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_zenwithin_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_zenwithin_thermostat.lua index 638f3f7ff4..a336f60170 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_zenwithin_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_zenwithin_thermostat.lua @@ -47,7 +47,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -64,6 +67,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState("cooling")) } + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -80,6 +86,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -97,6 +106,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -135,7 +147,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -194,7 +209,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({ "off", "heat", "cool" }, { visibility = { displayed = false } })) ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -271,7 +289,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 25.0, unit = "C" })) ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -403,7 +424,10 @@ test.register_coroutine_test( ) test.mock_time.advance_time(2) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -435,7 +459,10 @@ test.register_coroutine_test( ) test.mock_time.advance_time(2) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -447,6 +474,52 @@ test.register_message_test( message = { mock_device.id, Thermostat.attributes.ThermostatRunningMode:build_test_attr_report(mock_device, 3), } } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting cooling setpoint while in heat mode should re-emit the current cooling setpoint", + function() + -- Put device in heat mode + test.socket.zigbee:__queue_receive({ + mock_device.id, + Thermostat.attributes.SystemMode:build_test_attr_report(mock_device, 0x04) -- HEAT + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode.heat()) + ) + test.wait_for_events() + + -- Set a known cooling setpoint state + test.socket.zigbee:__queue_receive({ + mock_device.id, + Thermostat.attributes.OccupiedCoolingSetpoint:build_test_attr_report(mock_device, 2500) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 25.0, unit = "C" })) + ) + test.wait_for_events() + + -- Try to set cooling setpoint while in heat mode; driver defers and re-emits current + test.timer.__create_and_queue_test_time_advance_timer(10, "oneshot") + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "thermostatCoolingSetpoint", component = "main", command = "setCoolingSetpoint", args = { 27 } } + }) + test.wait_for_events() + + test.mock_time.advance_time(10) + -- After the delay, update_device_setpoint re-emits the unchanged cooling setpoint (25.0 C) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 25.0, unit = "C" })) + ) + test.wait_for_events() + end, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-thermostat/src/test/test_zigbee_thermostat.lua b/drivers/SmartThings/zigbee-thermostat/src/test/test_zigbee_thermostat.lua index 380eacc1ce..db79a62151 100644 --- a/drivers/SmartThings/zigbee-thermostat/src/test/test_zigbee_thermostat.lua +++ b/drivers/SmartThings/zigbee-thermostat/src/test/test_zigbee_thermostat.lua @@ -36,6 +36,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -53,6 +56,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -77,6 +83,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -94,6 +103,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -110,6 +122,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C"})) }, + }, + { + min_api_version = 19 } ) @@ -131,6 +146,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -148,6 +166,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -165,6 +186,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -193,6 +217,9 @@ test.register_message_test( } )) } + }, + { + min_api_version = 19 } ) @@ -221,6 +248,9 @@ test.register_message_test( } )) } + }, + { + min_api_version = 19 } ) @@ -243,7 +273,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -265,7 +298,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -282,6 +318,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState("cooling")) } + }, + { + min_api_version = 19 } ) @@ -320,7 +359,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -337,6 +379,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.battery()) } + }, + { + min_api_version = 19 } ) @@ -365,7 +410,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedHeatingSetpoint:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -393,7 +441,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -421,7 +472,10 @@ test.register_coroutine_test( Thermostat.attributes.OccupiedCoolingSetpoint:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -449,7 +503,10 @@ test.register_coroutine_test( Thermostat.attributes.SystemMode:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -476,7 +533,10 @@ test.register_coroutine_test( Thermostat.attributes.SystemMode:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -504,7 +564,10 @@ test.register_coroutine_test( FanControl.attributes.FanMode:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -532,7 +595,10 @@ test.register_coroutine_test( FanControl.attributes.FanMode:read(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -575,7 +641,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -714,6 +783,9 @@ test.register_message_test( PowerConfiguration.attributes.BatteryAlarmState:read(mock_device) } }, + }, + { + min_api_version = 19 } ) @@ -837,6 +909,9 @@ test.register_message_test( PowerConfiguration.attributes.BatteryAlarmState:read(mock_device) } }, + }, + { + min_api_version = 19 } ) @@ -854,6 +929,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode("cool")) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-valve/src/ezex/can_handle.lua b/drivers/SmartThings/zigbee-valve/src/ezex/can_handle.lua new file mode 100644 index 0000000000..f16f04858c --- /dev/null +++ b/drivers/SmartThings/zigbee-valve/src/ezex/can_handle.lua @@ -0,0 +1,12 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function ezex_can_handle(opts, driver, device, ...) + local clusters = require "st.zigbee.zcl.clusters" + if device:get_model() == "E253-KR0B0ZX-HA" and not device:supports_server_cluster(clusters.PowerConfiguration.ID) then + return true, require("ezex") + end + return false +end + +return ezex_can_handle diff --git a/drivers/SmartThings/zigbee-valve/src/ezex/init.lua b/drivers/SmartThings/zigbee-valve/src/ezex/init.lua index 47ced66806..c32fe60bac 100644 --- a/drivers/SmartThings/zigbee-valve/src/ezex/init.lua +++ b/drivers/SmartThings/zigbee-valve/src/ezex/init.lua @@ -1,16 +1,6 @@ --- Copyright 2024 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2024 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local clusters = require "st.zigbee.zcl.clusters" local capabilities = require "st.capabilities" @@ -71,9 +61,7 @@ local ezex_valve = { lifecycle_handlers = { init = device_init }, - can_handle = function(opts, driver, device, ...) - return device:get_model() == "E253-KR0B0ZX-HA" and not device:supports_server_cluster(clusters.PowerConfiguration.ID) - end + can_handle = require("ezex.can_handle"), } return ezex_valve diff --git a/drivers/SmartThings/zigbee-valve/src/init.lua b/drivers/SmartThings/zigbee-valve/src/init.lua index 6d355de8ec..1840b55be0 100644 --- a/drivers/SmartThings/zigbee-valve/src/init.lua +++ b/drivers/SmartThings/zigbee-valve/src/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local ZigbeeDriver = require "st.zigbee" local defaults = require "st.zigbee.defaults" @@ -51,10 +41,7 @@ local zigbee_valve_driver_template = { lifecycle_handlers = { added = device_added }, - sub_drivers = { - require("sinope"), - require("ezex") - }, + sub_drivers = require("sub_drivers"), health_check = false, } diff --git a/drivers/SmartThings/zigbee-valve/src/lazy_load_subdriver.lua b/drivers/SmartThings/zigbee-valve/src/lazy_load_subdriver.lua new file mode 100644 index 0000000000..0bee6d2a75 --- /dev/null +++ b/drivers/SmartThings/zigbee-valve/src/lazy_load_subdriver.lua @@ -0,0 +1,15 @@ +-- 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 version = require "version" + local ZigbeeDriver = require "st.zigbee" + if version.api >= 16 then + return ZigbeeDriver.lazy_load_sub_driver_v2(sub_driver_name) + elseif version.api >= 9 then + return ZigbeeDriver.lazy_load_sub_driver(require(sub_driver_name)) + else + return require(sub_driver_name) + end +end diff --git a/drivers/SmartThings/zigbee-valve/src/sinope/can_handle.lua b/drivers/SmartThings/zigbee-valve/src/sinope/can_handle.lua new file mode 100644 index 0000000000..f533d120e0 --- /dev/null +++ b/drivers/SmartThings/zigbee-valve/src/sinope/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function sinope_can_handle(opts, driver, device, ...) + if device:get_manufacturer() == "Sinope Technologies" then + return true, require("sinope") + end + return false +end + +return sinope_can_handle diff --git a/drivers/SmartThings/zigbee-valve/src/sinope/init.lua b/drivers/SmartThings/zigbee-valve/src/sinope/init.lua index 6a0075cd33..ab3786511c 100644 --- a/drivers/SmartThings/zigbee-valve/src/sinope/init.lua +++ b/drivers/SmartThings/zigbee-valve/src/sinope/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local clusters = require "st.zigbee.zcl.clusters" local battery_defaults = require "st.zigbee.defaults.battery_defaults" @@ -59,9 +49,7 @@ local sinope_valve = { lifecycle_handlers = { init = device_init }, - can_handle = function(opts, driver, device, ...) - return device:get_manufacturer() == "Sinope Technologies" - end + can_handle = require("sinope.can_handle"), } return sinope_valve diff --git a/drivers/SmartThings/zigbee-valve/src/sub_drivers.lua b/drivers/SmartThings/zigbee-valve/src/sub_drivers.lua new file mode 100644 index 0000000000..258579c7fb --- /dev/null +++ b/drivers/SmartThings/zigbee-valve/src/sub_drivers.lua @@ -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("sinope"), + lazy_load_if_possible("ezex"), +} +return sub_drivers diff --git a/drivers/SmartThings/zigbee-valve/src/test/test_ezex_valve.lua b/drivers/SmartThings/zigbee-valve/src/test/test_ezex_valve.lua index eb96363d99..ba5696eaef 100644 --- a/drivers/SmartThings/zigbee-valve/src/test/test_ezex_valve.lua +++ b/drivers/SmartThings/zigbee-valve/src/test/test_ezex_valve.lua @@ -1,16 +1,6 @@ --- Copyright 2024 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2024 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -55,6 +45,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.open()) } + }, + { + min_api_version = 19 } ) @@ -73,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.closed()) } + }, + { + min_api_version = 19 } ) @@ -89,6 +85,28 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(5)) } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Battery percentage report - not low should return 50%", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.attributes.ZoneStatus:build_test_attr_report(mock_device, 0x0000) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.battery.battery(50)) + } + }, + { + min_api_version = 19 } ) @@ -106,6 +124,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.unknown()) } + }, + { + min_api_version = 19 } ) @@ -123,6 +144,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) } + }, + { + min_api_version = 19 } ) @@ -140,6 +164,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.battery()) } + }, + { + min_api_version = 19 } ) @@ -157,6 +184,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.dc()) } + }, + { + min_api_version = 19 } ) @@ -173,6 +203,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -189,6 +222,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -234,7 +270,10 @@ test.register_coroutine_test( IASZone.attributes.ZoneStatus:configure_reporting(mock_device, 0, 3600, 1) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -274,7 +313,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -312,7 +352,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-valve/src/test/test_sinope_valve.lua b/drivers/SmartThings/zigbee-valve/src/test/test_sinope_valve.lua index 344c6b0814..cbecbcd4f6 100644 --- a/drivers/SmartThings/zigbee-valve/src/test/test_sinope_valve.lua +++ b/drivers/SmartThings/zigbee-valve/src/test/test_sinope_valve.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local t_utils = require "integration_test.utils" @@ -57,7 +47,10 @@ test.register_coroutine_test( mock_device.id, Basic.attributes.PowerSource:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -102,7 +95,10 @@ test.register_coroutine_test( zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, Basic.ID) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -122,7 +118,10 @@ test.register_coroutine_test( mock_device.id, Basic.attributes.PowerSource:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -130,7 +129,10 @@ test.register_coroutine_test( function() test.socket.zigbee:__queue_receive({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:build_test_attr_report(mock_device, 55) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(20)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -138,7 +140,21 @@ test.register_coroutine_test( function() test.socket.zigbee:__queue_receive({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:build_test_attr_report(mock_device, 0) }) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(0)) ) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Battery voltage above max should clamp to 100 percent", + function() + test.socket.zigbee:__queue_receive({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:build_test_attr_report(mock_device, 65) }) + test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(100)) ) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-valve/src/test/test_zigbee_valve.lua b/drivers/SmartThings/zigbee-valve/src/test/test_zigbee_valve.lua index baa4252bd2..2df6ff5c8c 100644 --- a/drivers/SmartThings/zigbee-valve/src/test/test_zigbee_valve.lua +++ b/drivers/SmartThings/zigbee-valve/src/test/test_zigbee_valve.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -55,6 +45,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.open()) } + }, + { + min_api_version = 19 } ) @@ -73,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.closed()) } + }, + { + min_api_version = 19 } ) @@ -89,6 +85,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -106,6 +105,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.unknown()) } + }, + { + min_api_version = 19 } ) @@ -123,6 +125,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) } + }, + { + min_api_version = 19 } ) @@ -140,6 +145,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.battery()) } + }, + { + min_api_version = 19 } ) @@ -157,6 +165,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.dc()) } + }, + { + min_api_version = 19 } ) @@ -173,6 +184,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -189,6 +203,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -235,7 +252,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -275,7 +295,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -313,7 +334,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-vent/src/test/test_zigbee_vent.lua b/drivers/SmartThings/zigbee-vent/src/test/test_zigbee_vent.lua index 524a16d580..9073338a81 100644 --- a/drivers/SmartThings/zigbee-vent/src/test/test_zigbee_vent.lua +++ b/drivers/SmartThings/zigbee-vent/src/test/test_zigbee_vent.lua @@ -59,6 +59,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -76,6 +79,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -93,6 +99,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -108,7 +117,10 @@ test.register_coroutine_test( test.mock_time.advance_time(1) test.socket.zigbee:__expect_send({mock_device.id, Level.attributes.CurrentLevel:read(mock_device)}) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -124,6 +136,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C"})) } + }, + { + min_api_version = 19 } ) @@ -145,6 +160,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -222,7 +240,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -278,7 +297,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) @@ -296,7 +318,10 @@ test.register_coroutine_test( test.wait_for_events() test.socket.capability:__queue_receive({mock_device.id, { capability = "switch", component = "main", command = "on", args = {}}}) test.socket.zigbee:__expect_send({mock_device.id, Level.commands.MoveToLevelWithOnOff(mock_device, math.floor(83 / 100 * 254), 0xFFFF)}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -306,7 +331,10 @@ test.register_coroutine_test( mock_device, 50 )}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.battery.battery(50))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -315,7 +343,10 @@ test.register_coroutine_test( test.socket.zigbee:__queue_receive({mock_device.id, zigbee_test_utils.build_attribute_report(mock_device, clusters.PressureMeasurement.ID, {{ KEEN_PRESSURE_ATTRIBUTE, data_types.Uint16.ID, 10000}}, KEEN_MFG_CODE)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.atmosphericPressureMeasurement.atmosphericPressure({value = 1, unit = "kPa"}))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_aqara_water_leak_sensor.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_aqara_water_leak_sensor.lua index ea80228581..2776ca8f38 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_aqara_water_leak_sensor.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_aqara_water_leak_sensor.lua @@ -51,7 +51,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE , data_types.Uint8, 1) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -75,6 +78,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -99,6 +105,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -115,6 +124,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_centralite_water_leak_sensor.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_centralite_water_leak_sensor.lua index b42f3484ae..5cc8a2b283 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_centralite_water_leak_sensor.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_centralite_water_leak_sensor.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -105,7 +108,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -121,6 +127,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -137,6 +146,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -153,6 +165,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -169,6 +184,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -193,6 +211,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -217,6 +238,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -246,6 +270,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_frient_water_leak_sensor.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_frient_water_leak_sensor.lua index 56c264a505..5392a3d1b3 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_frient_water_leak_sensor.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_frient_water_leak_sensor.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -111,7 +114,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -127,6 +133,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -143,6 +152,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -159,6 +171,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -175,6 +190,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -199,6 +217,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -223,6 +244,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -252,6 +276,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_leaksmart_water.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_leaksmart_water.lua index 86e4aa774a..0e2b9d9161 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_leaksmart_water.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_leaksmart_water.lua @@ -40,7 +40,10 @@ test.register_coroutine_test( local alert_command = ApplianceEventsAlerts.client.commands.AlertsNotification.build_test_rx(mock_device, 0x01, {0x001181}) test.socket.zigbee:__queue_receive({ mock_device.id, alert_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.waterSensor.water.wet())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -49,7 +52,10 @@ test.register_coroutine_test( local alert_command = ApplianceEventsAlerts.client.commands.AlertsNotification.build_test_rx(mock_device, 0x01, {0x000081}) test.socket.zigbee:__queue_receive({ mock_device.id, alert_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.waterSensor.water.dry())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -58,7 +64,10 @@ test.register_coroutine_test( local alert_command = ApplianceEventsAlerts.client.commands.AlertsNotification.build_test_rx(mock_device, 0x01, {0x000581}) test.socket.zigbee:__queue_receive({ mock_device.id, alert_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.waterSensor.water.dry())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -67,7 +76,10 @@ test.register_coroutine_test( local alert_command = ApplianceEventsAlerts.client.commands.AlertsNotification.build_test_rx(mock_device, 0x01, {0x001081}) test.socket.zigbee:__queue_receive({ mock_device.id, alert_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.waterSensor.water.dry())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -76,30 +88,24 @@ test.register_coroutine_test( local alert_command = ApplianceEventsAlerts.client.commands.AlertsNotification.build_test_rx(mock_device, 0x01, {0x001281}) test.socket.zigbee:__queue_receive({ mock_device.id, alert_command }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.waterSensor.water.dry())) - end + end, + { + min_api_version = 19 + } ) --- test.register_coroutine_test( --- "Health check should check all relevant attributes", --- function() --- test.socket.device_lifecycle:__queue_receive({mock_device.id, "added"}) --- test.socket.capability:__expect_send( --- { --- mock_device.id, --- { --- capability_id = "waterSensor", component_id = "main", --- attribute_id = "water", state={value="dry"} --- } --- } --- ) --- end, --- { --- test_init = function() --- test.mock_device.add_test_device(mock_device) --- test.timer.__create_and_queue_test_time_advance_timer(30, "interval", "health_check") --- end --- } --- ) +test.register_coroutine_test( + "Added lifecycle should emit water dry event", + function() + test.socket.device_lifecycle:__queue_receive({mock_device.id, "added"}) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) + ) + end, + { + min_api_version = 19 + } +) test.register_coroutine_test( "Configure should configure all necessary attributes", @@ -161,7 +167,10 @@ test.register_coroutine_test( IASZone.attributes.ZoneStatus:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_samjin_water_leak_sensor.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_samjin_water_leak_sensor.lua index 3eb7cb201a..ff1c5219dc 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_samjin_water_leak_sensor.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_samjin_water_leak_sensor.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -105,7 +108,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -121,6 +127,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -137,6 +146,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(50)) } + }, + { + min_api_version = 19 } ) @@ -161,6 +173,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -185,6 +200,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -214,6 +232,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_sengled_water_leak_sensor.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_sengled_water_leak_sensor.lua index 348ab81f0e..077cc41d1a 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_sengled_water_leak_sensor.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_sengled_water_leak_sensor.lua @@ -43,7 +43,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -91,7 +94,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_sinope_zigbee_water.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_sinope_zigbee_water.lua index 19e1c7053e..1b630ba3e9 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_sinope_zigbee_water.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_sinope_zigbee_water.lua @@ -46,6 +46,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -62,6 +65,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -78,6 +84,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -94,6 +103,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -110,6 +122,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -134,6 +149,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -150,6 +168,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -290,7 +311,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -351,7 +375,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_smartthings_water_leak_sensor.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_smartthings_water_leak_sensor.lua index 2b9ee2d3c1..26f12bea23 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_smartthings_water_leak_sensor.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_smartthings_water_leak_sensor.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryVoltage:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -105,7 +108,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, TemperatureMeasurement.attributes.MeasuredValue:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -135,7 +141,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -159,6 +168,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -183,6 +195,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -212,6 +227,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_thirdreality_water_leak_sensor.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_thirdreality_water_leak_sensor.lua index b52884f6a3..2132397068 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_thirdreality_water_leak_sensor.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_thirdreality_water_leak_sensor.lua @@ -36,6 +36,17 @@ end test.set_test_init_function(test_init) +test.register_coroutine_test( + "Added lifecycle should read ApplicationVersion", + function() + test.socket.device_lifecycle:__queue_receive({mock_device.id, "added"}) + test.socket.zigbee:__expect_send({mock_device.id, Basic.attributes.ApplicationVersion:read(mock_device)}) + end, + { + min_api_version = 19 + } +) + test.register_coroutine_test( "Refresh necessary attributes", function() @@ -43,7 +54,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } }) test.socket.zigbee:__expect_send({ mock_device.id, IASZone.attributes.ZoneStatus:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -65,7 +79,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(55)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -87,7 +104,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(55)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -109,7 +129,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(100)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -131,7 +154,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(100)) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_zigbee_water.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_zigbee_water.lua index 3221e4fc11..906e98a9ce 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_zigbee_water.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_zigbee_water.lua @@ -44,6 +44,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -68,6 +71,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -92,6 +98,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -116,6 +125,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "waterSensor", capability_attr_id = "water" } } }, + }, + { + min_api_version = 19 } ) @@ -140,6 +152,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -167,6 +182,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -183,6 +201,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(28)) } + }, + { + min_api_version = 19 } ) @@ -323,7 +344,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -384,7 +408,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_zigbee_water_freeze.lua b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_zigbee_water_freeze.lua index 9188bbc996..06bdf8f342 100644 --- a/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_zigbee_water_freeze.lua +++ b/drivers/SmartThings/zigbee-water-leak-sensor/src/test/test_zigbee_water_freeze.lua @@ -52,6 +52,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -73,6 +76,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = -25.0, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -94,6 +100,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperatureRange({ value = { minimum = 20.00, maximum = 30.00 }, unit = "C" })) } + }, + { + min_api_version = 19 } ) @@ -215,7 +224,10 @@ test.register_coroutine_test( }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -276,7 +288,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zigbee-watering-kit/src/test/test_thirdreality_watering_kit.lua b/drivers/SmartThings/zigbee-watering-kit/src/test/test_thirdreality_watering_kit.lua index 35ab4d915c..5ec003564e 100644 --- a/drivers/SmartThings/zigbee-watering-kit/src/test/test_thirdreality_watering_kit.lua +++ b/drivers/SmartThings/zigbee-watering-kit/src/test/test_thirdreality_watering_kit.lua @@ -1,3 +1,6 @@ +-- Copyright 2026 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local t_utils = require "integration_test.utils" local zigbee_test_utils = require "integration_test.zigbee_test_utils" @@ -43,7 +46,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.clear())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(10))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.mode.mode("0"))) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -59,6 +65,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(50)) } + }, + { + min_api_version = 19 } ) @@ -75,6 +84,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -91,6 +103,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -107,6 +122,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.On(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -123,6 +141,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, OnOff.server.commands.Off(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -139,6 +160,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.detected()) } + }, + { + min_api_version = 19 } ) @@ -155,6 +179,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.clear()) } + }, + { + min_api_version = 19 } ) @@ -169,7 +196,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, THIRDREALITY_WATERING_CLUSTER, attr_report_data, 0x1407) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(10))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -183,7 +213,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, THIRDREALITY_WATERING_CLUSTER, attr_report_data, 0x1407) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(30))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -197,7 +230,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_report(mock_device, THIRDREALITY_WATERING_CLUSTER, attr_report_data, 0x1407) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.mode.mode("4"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -206,7 +242,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "fanSpeed", component = "main", command = "setFanSpeed", args = { 20 } } }) test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, THIRDREALITY_WATERING_CLUSTER, WATERING_TIME_ATTR, 0x1407, data_types.Uint16, 20) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -215,7 +254,65 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "mode", component = "main", command = "setMode", args = { "2" } } }) test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, THIRDREALITY_WATERING_CLUSTER, WATERING_INTERVAL_ATTR, 0x1407, data_types.Uint8, 2) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatusChangeNotification should be handled: detected", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0001, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.detected()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "ZoneStatusChangeNotification should be handled: clear", + { + { + channel = "zigbee", + direction = "receive", + message = { mock_device.id, IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0000, 0x00) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.hardwareFault.hardwareFault.clear()) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "fanspeed reported should be clamped to 0 when value >= 1000", + function() + local attr_report_data = { + { WATERING_TIME_ATTR, data_types.Uint16.ID, 1000 } + } + test.socket.zigbee:__queue_receive({ + mock_device.id, + zigbee_test_utils.build_attribute_report(mock_device, THIRDREALITY_WATERING_CLUSTER, attr_report_data, 0x1407) + }) + test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.fanSpeed.fanSpeed(0))) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/can_handle.lua new file mode 100644 index 0000000000..85db6c0447 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_zigbee_window_shade = function(opts, driver, device) + local FINGERPRINTS = require("HOPOsmart.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("HOPOsmart") + end + end + return false +end + +return is_zigbee_window_shade diff --git a/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/custom_clusters.lua b/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/custom_clusters.lua index 1f2950b2f1..b0394aa3fe 100755 --- a/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/custom_clusters.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/custom_clusters.lua @@ -1,16 +1,6 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local data_types = require "st.zigbee.data_types" diff --git a/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/fingerprints.lua b/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/fingerprints.lua new file mode 100644 index 0000000000..abf5e54ae5 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/fingerprints.lua @@ -0,0 +1,8 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { + { mfr = "HOPOsmart", model = "A2230011" } +} + +return ZIGBEE_WINDOW_SHADE_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/init.lua index 5e3f002ec0..3267eefc33 100755 --- a/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/HOPOsmart/init.lua @@ -1,34 +1,13 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local custom_clusters = require "HOPOsmart/custom_clusters" local cluster_base = require "st.zigbee.cluster_base" -local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { - { mfr = "HOPOsmart", model = "A2230011" } -} -local is_zigbee_window_shade = function(opts, driver, device) - for _, fingerprint in ipairs(ZIGBEE_WINDOW_SHADE_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local function send_read_attr_request(device, cluster, attr) device:send( @@ -83,7 +62,7 @@ local HOPOsmart_handler = { } } }, - can_handle = is_zigbee_window_shade, + can_handle = require("HOPOsmart.can_handle"), } return HOPOsmart_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/can_handle.lua new file mode 100644 index 0000000000..d6907690c3 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_zigbee_window_shade = function(opts, driver, device) + local FINGERPRINTS = require("VIVIDSTORM.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("VIVIDSTORM") + end + end + return false +end + +return is_zigbee_window_shade diff --git a/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/custom_clusters.lua b/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/custom_clusters.lua index 6f266a474e..8efbc0e654 100755 --- a/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/custom_clusters.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/custom_clusters.lua @@ -1,16 +1,6 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local data_types = require "st.zigbee.data_types" diff --git a/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/fingerprints.lua b/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/fingerprints.lua new file mode 100644 index 0000000000..ff1bbcb00d --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/fingerprints.lua @@ -0,0 +1,8 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { + { mfr = "VIVIDSTORM", model = "VWSDSTUST120H" } +} + +return ZIGBEE_WINDOW_SHADE_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/init.lua index ef36757490..106115edee 100755 --- a/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/VIVIDSTORM/init.lua @@ -1,16 +1,6 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local zcl_clusters = require "st.zigbee.zcl.clusters" local capabilities = require "st.capabilities" @@ -22,18 +12,7 @@ local MOST_RECENT_SETLEVEL = "windowShade_recent_setlevel" local TIMER = "liftPercentage_timer" -local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { - { mfr = "VIVIDSTORM", model = "VWSDSTUST120H" } -} -local is_zigbee_window_shade = function(opts, driver, device) - for _, fingerprint in ipairs(ZIGBEE_WINDOW_SHADE_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local function send_read_attr_request(device, cluster, attr) device:send( @@ -156,7 +135,7 @@ local screen_handler = { } } }, - can_handle = is_zigbee_window_shade, + can_handle = require("VIVIDSTORM.can_handle"), } return screen_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/can_handle.lua new file mode 100644 index 0000000000..e4453597ed --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function is_aqara_products(opts, driver, device) + local FINGERPRINTS = require("aqara.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("aqara") + end + end + return false +end + +return is_aqara_products diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/curtain-driver-e1/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/curtain-driver-e1/can_handle.lua new file mode 100644 index 0000000000..7eb40a7c10 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/curtain-driver-e1/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function curtain_driver_e1_can_handle(opts, driver, device, ...) + if device:get_model() == "lumi.curtain.agl001" then + return true, require("aqara.curtain-driver-e1") + end + return false +end + +return curtain_driver_e1_can_handle diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/curtain-driver-e1/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/curtain-driver-e1/init.lua index 6fe895ca7d..03e651b679 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/aqara/curtain-driver-e1/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/curtain-driver-e1/init.lua @@ -1,16 +1,6 @@ --- Copyright 2024 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2024 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local clusters = require "st.zigbee.zcl.clusters" local cluster_base = require "st.zigbee.cluster_base" @@ -224,9 +214,7 @@ local aqara_curtain_driver_e1_handler = { } } }, - can_handle = function(opts, driver, device, ...) - return device:get_model() == "lumi.curtain.agl001" - end + can_handle = require("aqara.curtain-driver-e1.can_handle"), } return aqara_curtain_driver_e1_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/fingerprints.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/fingerprints.lua new file mode 100644 index 0000000000..8ad05530a5 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/fingerprints.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local FINGERPRINTS = { + { mfr = "LUMI", model = "lumi.curtain" }, + { mfr = "LUMI", model = "lumi.curtain.v1" }, + { mfr = "LUMI", model = "lumi.curtain.aq2" }, + { mfr = "LUMI", model = "lumi.curtain.agl001" } +} + +return FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/init.lua index 87505d2e40..1b66236038 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/aqara/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/init.lua @@ -1,3 +1,7 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + + local capabilities = require "st.capabilities" local clusters = require "st.zigbee.zcl.clusters" local cluster_base = require "st.zigbee.cluster_base" @@ -27,21 +31,7 @@ local PREF_SOFT_TOUCH_ON = "\x00\x08\x00\x00\x00\x00\x00" local APPLICATION_VERSION = "application_version" -local FINGERPRINTS = { - { mfr = "LUMI", model = "lumi.curtain" }, - { mfr = "LUMI", model = "lumi.curtain.v1" }, - { mfr = "LUMI", model = "lumi.curtain.aq2" }, - { mfr = "LUMI", model = "lumi.curtain.agl001" } -} -local function is_aqara_products(opts, driver, device) - for _, fingerprint in ipairs(FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local function window_shade_level_cmd(driver, device, command) aqara_utils.shade_level_cmd(driver, device, command) @@ -217,12 +207,8 @@ local aqara_window_treatment_handler = { } } }, - sub_drivers = { - require("aqara.roller-shade"), - require("aqara.curtain-driver-e1"), - require("aqara.version") - }, - can_handle = is_aqara_products + sub_drivers = require("aqara.sub_drivers"), + can_handle = require("aqara.can_handle"), } return aqara_window_treatment_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/roller-shade/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/roller-shade/can_handle.lua new file mode 100644 index 0000000000..2e91fa090d --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/roller-shade/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function roller_shade_can_handle(opts, driver, device, ...) + if device:get_model() == "lumi.curtain.aq2" then + return true, require("aqara.roller-shade") + end + return false +end + +return roller_shade_can_handle 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 12b84eb0c8..909b65dd3e 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 @@ -1,141 +1,142 @@ -local capabilities = require "st.capabilities" -local clusters = require "st.zigbee.zcl.clusters" -local cluster_base = require "st.zigbee.cluster_base" -local FrameCtrl = require "st.zigbee.zcl.frame_ctrl" -local data_types = require "st.zigbee.data_types" -local aqara_utils = require "aqara/aqara_utils" -local window_treatment_utils = require "window_treatment_utils" - -local Basic = clusters.Basic -local WindowCovering = clusters.WindowCovering - -local initializedStateWithGuide = capabilities["stse.initializedStateWithGuide"] -local reverseRollerShadeDir = "stse.reverseRollerShadeDir" -local shadeRotateState = capabilities["stse.shadeRotateState"] -local setRotateStateCommandName = "setRotateState" - -local MULTISTATE_CLUSTER_ID = 0x0013 -local MULTISTATE_ATTRIBUTE_ID = 0x0055 -local ROTATE_UP_VALUE = 0x0004 -local ROTATE_DOWN_VALUE = 0x0005 - - -local function window_shade_level_cmd(driver, device, command) - -- Cannot be controlled if not initialized - local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, - initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 - if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then - aqara_utils.shade_level_cmd(driver, device, command) - end -end - -local function window_shade_open_cmd(driver, device, command) - -- Cannot be controlled if not initialized - local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, - initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 - if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then - device:send_to_component(command.component, WindowCovering.server.commands.GoToLiftPercentage(device, 100)) - end -end - -local function window_shade_close_cmd(driver, device, command) - -- Cannot be controlled if not initialized - local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, - initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 - if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then - device:send_to_component(command.component, WindowCovering.server.commands.GoToLiftPercentage(device, 0)) - end -end - -local function set_rotate_command_handler(driver, device, command) - device:emit_event(shadeRotateState.rotateState.idle({state_change = true, visibility = { displayed = false }})) -- update UI - - -- Cannot be controlled if not initialized - local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, - initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 - if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then - local state = command.args.state - if state == "rotateUp" then - local message = cluster_base.write_manufacturer_specific_attribute(device, MULTISTATE_CLUSTER_ID, - MULTISTATE_ATTRIBUTE_ID, aqara_utils.MFG_CODE, data_types.Uint16, ROTATE_UP_VALUE) - message.body.zcl_header.frame_ctrl = FrameCtrl(0x10) - device:send(message) - elseif state == "rotateDown" then - local message = cluster_base.write_manufacturer_specific_attribute(device, MULTISTATE_CLUSTER_ID, - MULTISTATE_ATTRIBUTE_ID, aqara_utils.MFG_CODE, data_types.Uint16, ROTATE_DOWN_VALUE) - message.body.zcl_header.frame_ctrl = FrameCtrl(0x10) - device:send(message) - end - end -end - -local function shade_state_report_handler(driver, device, value, zb_rx) - aqara_utils.emit_shade_event_by_state(device, value) -end - -local function pref_report_handler(driver, device, value, zb_rx) - -- initializedState - local initialized = string.byte(value.value, 3) & 0xFF - device:emit_event(initialized == 1 and initializedStateWithGuide.initializedStateWithGuide.initialized() or - initializedStateWithGuide.initializedStateWithGuide.notInitialized()) -end - -local function device_info_changed(driver, device, event, args) - if device.preferences ~= nil then - local reverseRollerShadeDirPrefValue = device.preferences[reverseRollerShadeDir] - if reverseRollerShadeDirPrefValue ~= nil and - reverseRollerShadeDirPrefValue ~= args.old_st_store.preferences[reverseRollerShadeDir] then - local raw_value = reverseRollerShadeDirPrefValue and aqara_utils.PREF_REVERSE_ON or aqara_utils.PREF_REVERSE_OFF - device:send(cluster_base.write_manufacturer_specific_attribute(device, Basic.ID, aqara_utils.PREF_ATTRIBUTE_ID, - aqara_utils.MFG_CODE, data_types.CharString, raw_value)) - end - end -end - -local function device_added(driver, device) - device:emit_event(capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" }, {visibility = {displayed = false}})) - window_treatment_utils.emit_event_if_latest_state_missing(device, "main", capabilities.windowShadeLevel, capabilities.windowShadeLevel.shadeLevel.NAME, capabilities.windowShadeLevel.shadeLevel(0)) - window_treatment_utils.emit_event_if_latest_state_missing(device, "main", capabilities.windowShade, capabilities.windowShade.windowShade.NAME, capabilities.windowShade.windowShade.closed()) - device:emit_event(initializedStateWithGuide.initializedStateWithGuide.notInitialized()) - device:emit_event(shadeRotateState.rotateState.idle({ visibility = { displayed = false }})) - - device:send(cluster_base.write_manufacturer_specific_attribute(device, aqara_utils.PRIVATE_CLUSTER_ID, - aqara_utils.PRIVATE_ATTRIBUTE_ID, aqara_utils.MFG_CODE, data_types.Uint8, 1)) - - -- Initial default settings - device:send(cluster_base.write_manufacturer_specific_attribute(device, Basic.ID, aqara_utils.PREF_ATTRIBUTE_ID, - aqara_utils.MFG_CODE, data_types.CharString, aqara_utils.PREF_REVERSE_OFF)) -end - -local aqara_roller_shade_handler = { - NAME = "Aqara Roller Shade Handler", - lifecycle_handlers = { - added = device_added, - infoChanged = device_info_changed - }, - capability_handlers = { - [capabilities.windowShadeLevel.ID] = { - [capabilities.windowShadeLevel.commands.setShadeLevel.NAME] = window_shade_level_cmd - }, - [capabilities.windowShade.ID] = { - [capabilities.windowShade.commands.open.NAME] = window_shade_open_cmd, - [capabilities.windowShade.commands.close.NAME] = window_shade_close_cmd, - }, - [shadeRotateState.ID] = { - [setRotateStateCommandName] = set_rotate_command_handler - } - }, - zigbee_handlers = { - attr = { - [Basic.ID] = { - [aqara_utils.SHADE_STATE_ATTRIBUTE_ID] = shade_state_report_handler, - [aqara_utils.PREF_ATTRIBUTE_ID] = pref_report_handler - } - } - }, - can_handle = function(opts, driver, device, ...) - return device:get_model() == "lumi.curtain.aq2" - end -} - -return aqara_roller_shade_handler +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local capabilities = require "st.capabilities" +local clusters = require "st.zigbee.zcl.clusters" +local cluster_base = require "st.zigbee.cluster_base" +local FrameCtrl = require "st.zigbee.zcl.frame_ctrl" +local data_types = require "st.zigbee.data_types" +local aqara_utils = require "aqara/aqara_utils" +local window_treatment_utils = require "window_treatment_utils" + +local Basic = clusters.Basic +local WindowCovering = clusters.WindowCovering + +local initializedStateWithGuide = capabilities["stse.initializedStateWithGuide"] +local reverseRollerShadeDir = capabilities["stse.reverseRollerShadeDir"] +local shadeRotateState = capabilities["stse.shadeRotateState"] +local setRotateStateCommandName = "setRotateState" + +local MULTISTATE_CLUSTER_ID = 0x0013 +local MULTISTATE_ATTRIBUTE_ID = 0x0055 +local ROTATE_UP_VALUE = 0x0004 +local ROTATE_DOWN_VALUE = 0x0005 + + +local function window_shade_level_cmd(driver, device, command) + -- Cannot be controlled if not initialized + local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, + initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 + if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then + aqara_utils.shade_level_cmd(driver, device, command) + end +end + +local function window_shade_open_cmd(driver, device, command) + -- Cannot be controlled if not initialized + local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, + initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 + if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then + device:send_to_component(command.component, WindowCovering.server.commands.GoToLiftPercentage(device, 100)) + end +end + +local function window_shade_close_cmd(driver, device, command) + -- Cannot be controlled if not initialized + local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, + initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 + if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then + device:send_to_component(command.component, WindowCovering.server.commands.GoToLiftPercentage(device, 0)) + end +end + +local function set_rotate_command_handler(driver, device, command) + device:emit_event(shadeRotateState.rotateState.idle({state_change = true, visibility = { displayed = false }})) -- update UI + + -- Cannot be controlled if not initialized + local initialized = device:get_latest_state("main", initializedStateWithGuide.ID, + initializedStateWithGuide.initializedStateWithGuide.NAME) or 0 + if initialized == initializedStateWithGuide.initializedStateWithGuide.initialized.NAME then + local state = command.args.state + if state == "rotateUp" then + local message = cluster_base.write_manufacturer_specific_attribute(device, MULTISTATE_CLUSTER_ID, + MULTISTATE_ATTRIBUTE_ID, aqara_utils.MFG_CODE, data_types.Uint16, ROTATE_UP_VALUE) + message.body.zcl_header.frame_ctrl = FrameCtrl(0x10) + device:send(message) + elseif state == "rotateDown" then + local message = cluster_base.write_manufacturer_specific_attribute(device, MULTISTATE_CLUSTER_ID, + MULTISTATE_ATTRIBUTE_ID, aqara_utils.MFG_CODE, data_types.Uint16, ROTATE_DOWN_VALUE) + message.body.zcl_header.frame_ctrl = FrameCtrl(0x10) + device:send(message) + end + end +end + +local function shade_state_report_handler(driver, device, value, zb_rx) + aqara_utils.emit_shade_event_by_state(device, value) +end + +local function pref_report_handler(driver, device, value, zb_rx) + -- initializedState + local initialized = string.byte(value.value, 3) & 0xFF + device:emit_event(initialized == 1 and initializedStateWithGuide.initializedStateWithGuide.initialized() or + initializedStateWithGuide.initializedStateWithGuide.notInitialized()) +end + +local function device_info_changed(driver, device, event, args) + if device.preferences ~= nil then + local reverseRollerShadeDirPrefValue = device.preferences[reverseRollerShadeDir.ID] + if reverseRollerShadeDirPrefValue ~= nil and + reverseRollerShadeDirPrefValue ~= args.old_st_store.preferences[reverseRollerShadeDir.ID] then + local raw_value = reverseRollerShadeDirPrefValue and aqara_utils.PREF_REVERSE_ON or aqara_utils.PREF_REVERSE_OFF + device:send(cluster_base.write_manufacturer_specific_attribute(device, Basic.ID, aqara_utils.PREF_ATTRIBUTE_ID, + aqara_utils.MFG_CODE, data_types.CharString, raw_value)) + end + end +end + +local function device_added(driver, device) + device:emit_event(capabilities.windowShade.supportedWindowShadeCommands({ "open", "close", "pause" }, {visibility = {displayed = false}})) + window_treatment_utils.emit_event_if_latest_state_missing(device, "main", capabilities.windowShadeLevel, capabilities.windowShadeLevel.shadeLevel.NAME, capabilities.windowShadeLevel.shadeLevel(0)) + window_treatment_utils.emit_event_if_latest_state_missing(device, "main", capabilities.windowShade, capabilities.windowShade.windowShade.NAME, capabilities.windowShade.windowShade.closed()) + device:emit_event(initializedStateWithGuide.initializedStateWithGuide.notInitialized()) + device:emit_event(shadeRotateState.rotateState.idle({ visibility = { displayed = false }})) + + device:send(cluster_base.write_manufacturer_specific_attribute(device, aqara_utils.PRIVATE_CLUSTER_ID, + aqara_utils.PRIVATE_ATTRIBUTE_ID, aqara_utils.MFG_CODE, data_types.Uint8, 1)) + + -- Initial default settings + device:send(cluster_base.write_manufacturer_specific_attribute(device, Basic.ID, aqara_utils.PREF_ATTRIBUTE_ID, + aqara_utils.MFG_CODE, data_types.CharString, aqara_utils.PREF_REVERSE_OFF)) +end + +local aqara_roller_shade_handler = { + NAME = "Aqara Roller Shade Handler", + lifecycle_handlers = { + added = device_added, + infoChanged = device_info_changed + }, + capability_handlers = { + [capabilities.windowShadeLevel.ID] = { + [capabilities.windowShadeLevel.commands.setShadeLevel.NAME] = window_shade_level_cmd + }, + [capabilities.windowShade.ID] = { + [capabilities.windowShade.commands.open.NAME] = window_shade_open_cmd, + [capabilities.windowShade.commands.close.NAME] = window_shade_close_cmd, + }, + [shadeRotateState.ID] = { + [setRotateStateCommandName] = set_rotate_command_handler + } + }, + zigbee_handlers = { + attr = { + [Basic.ID] = { + [aqara_utils.SHADE_STATE_ATTRIBUTE_ID] = shade_state_report_handler, + [aqara_utils.PREF_ATTRIBUTE_ID] = pref_report_handler + } + } + }, + can_handle = require("aqara.roller-shade.can_handle"), +} + +return aqara_roller_shade_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/sub_drivers.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/sub_drivers.lua new file mode 100644 index 0000000000..297f29d970 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/sub_drivers.lua @@ -0,0 +1,10 @@ +-- 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("aqara.roller-shade"), + lazy_load_if_possible("aqara.curtain-driver-e1"), + lazy_load_if_possible("aqara.version"), +} +return sub_drivers diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/version/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/version/can_handle.lua new file mode 100644 index 0000000000..5d9f7f0135 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/version/can_handle.lua @@ -0,0 +1,13 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function version_can_handle(opts, driver, device) + local APPLICATION_VERSION = "application_version" + local softwareVersion = device:get_field(APPLICATION_VERSION) + if softwareVersion and softwareVersion ~= 34 then + return true, require("aqara.version") + end + return false +end + +return version_can_handle diff --git a/drivers/SmartThings/zigbee-window-treatment/src/aqara/version/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/aqara/version/init.lua index 10182ee928..ae1887d79a 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/aqara/version/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/aqara/version/init.lua @@ -1,9 +1,10 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local clusters = require "st.zigbee.zcl.clusters" local WindowCovering = clusters.WindowCovering -local APPLICATION_VERSION = "application_version" - local function shade_level_report_legacy_handler(driver, device, value, zb_rx) -- not implemented end @@ -17,10 +18,7 @@ local aqara_window_treatment_version_handler = { } } }, - can_handle = function(opts, driver, device) - local softwareVersion = device:get_field(APPLICATION_VERSION) - return softwareVersion and softwareVersion ~= 34 - end + can_handle = require("aqara.version.can_handle"), } return aqara_window_treatment_version_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/axis/axis_version/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/axis/axis_version/can_handle.lua new file mode 100644 index 0000000000..828eb170fa --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/axis/axis_version/can_handle.lua @@ -0,0 +1,15 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_axis_gear_version = function(opts, driver, device) + local SOFTWARE_VERSION = "software_version" + local MIN_WINDOW_COVERING_VERSION = 1093 + local version = device:get_field(SOFTWARE_VERSION) or 0 + + if version >= MIN_WINDOW_COVERING_VERSION then + return true, require("axis.axis_version") + end + return false +end + +return is_axis_gear_version diff --git a/drivers/SmartThings/zigbee-window-treatment/src/axis/axis_version/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/axis/axis_version/init.lua index c0682d73c0..cbb2930bc3 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/axis/axis_version/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/axis/axis_version/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local window_shade_utils = require "window_shade_utils" @@ -22,18 +12,8 @@ local Level = zcl_clusters.Level local PowerConfiguration = zcl_clusters.PowerConfiguration local WindowCovering = zcl_clusters.WindowCovering -local SOFTWARE_VERSION = "software_version" -local MIN_WINDOW_COVERING_VERSION = 1093 local DEFAULT_LEVEL = 0 -local is_axis_gear_version = function(opts, driver, device) - local version = device:get_field(SOFTWARE_VERSION) or 0 - - if version >= MIN_WINDOW_COVERING_VERSION then - return true - end - return false -end -- Commands local function window_shade_set_level(device, command, level) @@ -141,7 +121,7 @@ local axis_handler_version = { } } }, - can_handle = is_axis_gear_version, + can_handle = require("axis.axis_version.can_handle"), } return axis_handler_version diff --git a/drivers/SmartThings/zigbee-window-treatment/src/axis/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/axis/can_handle.lua new file mode 100644 index 0000000000..049e47acb5 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/axis/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_zigbee_window_shade = function(opts, driver, device) + if device:get_manufacturer() == "AXIS" then + return true, require("axis") + end + return false +end + +return is_zigbee_window_shade diff --git a/drivers/SmartThings/zigbee-window-treatment/src/axis/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/axis/init.lua index 612dd450a5..ec7c96b975 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/axis/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/axis/init.lua @@ -1,16 +1,7 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + + local capabilities = require "st.capabilities" local device_management = require "st.zigbee.device_management" @@ -26,12 +17,6 @@ local WindowCovering = zcl_clusters.WindowCovering local SOFTWARE_VERSION = "software_version" local DEFAULT_LEVEL = 0 -local is_zigbee_window_shade = function(opts, driver, device) - if device:get_manufacturer() == "AXIS" then - return true - end - return false -end -- Commands local function window_shade_set_level(device, command, level) @@ -151,8 +136,8 @@ local axis_handler = { added = device_added, doConfigure = do_configure, }, - sub_drivers = { require("axis.axis_version") }, - can_handle = is_zigbee_window_shade, + sub_drivers = require("axis.sub_drivers"), + can_handle = require("axis.can_handle"), } return axis_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/axis/sub_drivers.lua b/drivers/SmartThings/zigbee-window-treatment/src/axis/sub_drivers.lua new file mode 100644 index 0000000000..e3ea740478 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/axis/sub_drivers.lua @@ -0,0 +1,8 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local lazy_load_if_possible = require("lazy_load_subdriver") + +return { + lazy_load_if_possible("axis.axis_version") +} diff --git a/drivers/SmartThings/zigbee-window-treatment/src/feibit/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/feibit/can_handle.lua new file mode 100644 index 0000000000..32457dde8a --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/feibit/can_handle.lua @@ -0,0 +1,15 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_zigbee_window_shade = function(opts, driver, device) + local FINGERPRINTS = require("feibit.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("feibit") + end + end + + return false +end + +return is_zigbee_window_shade diff --git a/drivers/SmartThings/zigbee-window-treatment/src/feibit/fingerprints.lua b/drivers/SmartThings/zigbee-window-treatment/src/feibit/fingerprints.lua new file mode 100644 index 0000000000..95781ff992 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/feibit/fingerprints.lua @@ -0,0 +1,9 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { + { mfr = "Feibit Co.Ltd", model = "FTB56-ZT218AK1.6" }, + { mfr = "Feibit Co.Ltd", model = "FTB56-ZT218AK1.8" }, +} + +return ZIGBEE_WINDOW_SHADE_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-window-treatment/src/feibit/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/feibit/init.lua index e0fd17219e..1e97fbc4ce 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/feibit/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/feibit/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local zcl_clusters = require "st.zigbee.zcl.clusters" @@ -19,20 +9,7 @@ local window_shade_defaults = require "st.zigbee.defaults.windowShade_defaults" local device_management = require "st.zigbee.device_management" local Level = zcl_clusters.Level -local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { - { mfr = "Feibit Co.Ltd", model = "FTB56-ZT218AK1.6" }, - { mfr = "Feibit Co.Ltd", model = "FTB56-ZT218AK1.8" }, -} - -local is_zigbee_window_shade = function(opts, driver, device) - for _, fingerprint in ipairs(ZIGBEE_WINDOW_SHADE_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local function set_shade_level(device, value, component) local level = math.floor(value / 100.0 * 254) @@ -87,7 +64,7 @@ local feibit_handler = { lifecycle_handlers = { doConfigure = do_configure, }, - can_handle = is_zigbee_window_shade, + can_handle = require("feibit.can_handle"), } return feibit_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/hanssem/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/hanssem/can_handle.lua new file mode 100644 index 0000000000..65f1a6dc75 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/hanssem/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function hanssem_can_handle(opts, driver, device, ...) + if device:get_model() == "TS0601" then + return true, require("hanssem") + end + return false +end + +return hanssem_can_handle diff --git a/drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua index be956d79b2..41b4eb1cac 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua @@ -1,3 +1,6 @@ +-- Copyright 2021-2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- -- Based on https://github.com/iquix/ST-Edge-Driver/blob/master/tuya-window-shade/src/init.lua -- Copyright 2021-2022 Jaewon Park (iquix) @@ -241,9 +244,7 @@ local hanssem_window_treatment = { added = device_added, infoChanged = device_info_changed }, - can_handle = function(opts, driver, device, ...) - return device:get_model() == "TS0601" - end + can_handle = require("hanssem.can_handle"), } -return hanssem_window_treatment \ No newline at end of file +return hanssem_window_treatment diff --git a/drivers/SmartThings/zigbee-window-treatment/src/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/init.lua index 3403b3d528..16783a8726 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local ZigbeeDriver = require "st.zigbee" @@ -46,29 +36,17 @@ local zigbee_window_treatment_driver_template = { capabilities.powerSource, capabilities.battery }, - sub_drivers = { - require("vimar"), - require("aqara"), - require("feibit"), - require("somfy"), - require("invert-lift-percentage"), - require("rooms-beautiful"), - require("axis"), - require("yoolax"), - require("hanssem"), - require("screen-innovations"), - require("VIVIDSTORM"), - require("HOPOsmart")}, - lifecycle_handlers = { - init = init_handler, - added = added_handler - }, capability_handlers = { [capabilities.windowShadePreset.ID] = { [capabilities.windowShadePreset.commands.setPresetPosition.NAME] = window_shade_utils.set_preset_position_cmd, [capabilities.windowShadePreset.commands.presetPosition.NAME] = window_shade_utils.window_shade_preset_cmd, } }, + lifecycle_handlers = { + init = init_handler, + added = added_handler + }, + sub_drivers = require("sub_drivers"), health_check = false, } diff --git a/drivers/SmartThings/zigbee-window-treatment/src/invert-lift-percentage/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/invert-lift-percentage/can_handle.lua new file mode 100644 index 0000000000..69cfd4393a --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/invert-lift-percentage/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function invert_lift_percentage_can_handle(opts, driver, device, ...) + if device:get_manufacturer() == "IKEA of Sweden" or + device:get_manufacturer() == "Smartwings" or + device:get_manufacturer() == "Insta GmbH" + then + return true, require("invert-lift-percentage") + end + return false +end + +return invert_lift_percentage_can_handle diff --git a/drivers/SmartThings/zigbee-window-treatment/src/invert-lift-percentage/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/invert-lift-percentage/init.lua index 19532bc847..b586459b9a 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/invert-lift-percentage/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/invert-lift-percentage/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local zcl_clusters = require "st.zigbee.zcl.clusters" @@ -97,11 +87,7 @@ local ikea_window_treatment = { [capabilities.windowShadePreset.commands.presetPosition.NAME] = window_shade_preset_cmd } }, - can_handle = function(opts, driver, device, ...) - return device:get_manufacturer() == "IKEA of Sweden" or - device:get_manufacturer() == "Smartwings" or - device:get_manufacturer() == "Insta GmbH" - end + can_handle = require("invert-lift-percentage.can_handle"), } return ikea_window_treatment diff --git a/drivers/SmartThings/zigbee-window-treatment/src/lazy_load_subdriver.lua b/drivers/SmartThings/zigbee-window-treatment/src/lazy_load_subdriver.lua new file mode 100644 index 0000000000..0bee6d2a75 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/lazy_load_subdriver.lua @@ -0,0 +1,15 @@ +-- 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 version = require "version" + local ZigbeeDriver = require "st.zigbee" + if version.api >= 16 then + return ZigbeeDriver.lazy_load_sub_driver_v2(sub_driver_name) + elseif version.api >= 9 then + return ZigbeeDriver.lazy_load_sub_driver(require(sub_driver_name)) + else + return require(sub_driver_name) + end +end diff --git a/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/can_handle.lua new file mode 100644 index 0000000000..6bc25d2f91 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_zigbee_window_shade = function(opts, driver, device) + local FINGERPRINTS = require("rooms-beautiful.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("rooms-beautiful") + end + end + return false +end + +return is_zigbee_window_shade diff --git a/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/fingerprints.lua b/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/fingerprints.lua new file mode 100644 index 0000000000..71ece32b8e --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/fingerprints.lua @@ -0,0 +1,8 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { + { mfr = "Rooms Beautiful", model = "C001" } +} + +return ZIGBEE_WINDOW_SHADE_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/init.lua index fc4883aa7f..bb868a8716 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/rooms-beautiful/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local zcl_clusters = require "st.zigbee.zcl.clusters" @@ -21,22 +11,11 @@ local PowerConfiguration = zcl_clusters.PowerConfiguration local OnOff = zcl_clusters.OnOff local WindowCovering = zcl_clusters.WindowCovering -local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { - { mfr = "Rooms Beautiful", model = "C001" } -} local INVERT_CLUSTER = 0xFC00 local INVERT_CLUSTER_ATTRIBUTE = 0x0000 local PREV_TIME = "shadeLevelCmdTime" -local is_zigbee_window_shade = function(opts, driver, device) - for _, fingerprint in ipairs(ZIGBEE_WINDOW_SHADE_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local function invert_preference_handler(device) local window_level = device:get_latest_state("main", capabilities.windowShadeLevel.ID, capabilities.windowShadeLevel.shadeLevel.NAME) or 0 @@ -129,7 +108,7 @@ local rooms_beautiful_handler = { init = battery_defaults.build_linear_voltage_init(2.5, 3.0), infoChanged = info_changed }, - can_handle = is_zigbee_window_shade, + can_handle = require("rooms-beautiful.can_handle"), } return rooms_beautiful_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/screen-innovations/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/screen-innovations/can_handle.lua new file mode 100644 index 0000000000..df291c2612 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/screen-innovations/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function screen_innovations_can_handle(opts, driver, device, ...) + if device:get_model() == "WM25/L-Z" then + return true, require("screen-innovations") + end + return false +end + +return screen_innovations_can_handle diff --git a/drivers/SmartThings/zigbee-window-treatment/src/screen-innovations/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/screen-innovations/init.lua index 868e92af56..49397a5369 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/screen-innovations/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/screen-innovations/init.lua @@ -1,16 +1,6 @@ --- Copyright 2024 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2024 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- require st provided libraries local capabilities = require "st.capabilities" @@ -173,9 +163,7 @@ local screeninnovations_roller_shade_handler = { } } }, - can_handle = function(opts, driver, device, ...) - return device:get_model() == "WM25/L-Z" - end + can_handle = require("screen-innovations.can_handle"), } -- return the handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/somfy/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/somfy/can_handle.lua new file mode 100644 index 0000000000..27a6c83ca3 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/somfy/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_zigbee_window_shade = function(opts, driver, device) + local FINGERPRINTS = require("somfy.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("somfy") + end + end + return false +end + +return is_zigbee_window_shade diff --git a/drivers/SmartThings/zigbee-window-treatment/src/somfy/fingerprints.lua b/drivers/SmartThings/zigbee-window-treatment/src/somfy/fingerprints.lua new file mode 100644 index 0000000000..ce6094564c --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/somfy/fingerprints.lua @@ -0,0 +1,10 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { + { mfr = "SOMFY", model = "Glydea Ultra Curtain" }, + { mfr = "SOMFY", model = "Sonesse 30 WF Roller" }, + { mfr = "SOMFY", model = "Sonesse 40 Roller" } +} + +return ZIGBEE_WINDOW_SHADE_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-window-treatment/src/somfy/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/somfy/init.lua index ffc9541b64..da416ba9ea 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/somfy/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/somfy/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local utils = require "st.utils" @@ -20,23 +10,10 @@ local WindowCovering = zcl_clusters.WindowCovering local GLYDEA_MOVE_THRESHOLD = 3 -local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { - { mfr = "SOMFY", model = "Glydea Ultra Curtain" }, - { mfr = "SOMFY", model = "Sonesse 30 WF Roller" }, - { mfr = "SOMFY", model = "Sonesse 40 Roller" } -} local MOVE_LESS_THAN_THRESHOLD = "_sameLevelEvent" local FINAL_STATE_POLL_TIMER = "_finalStatePollTimer" -local is_zigbee_window_shade = function(opts, driver, device) - for _, fingerprint in ipairs(ZIGBEE_WINDOW_SHADE_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local function overwrite_existing_timer_if_needed(device, new_timer) local old_timer = device:get_field(FINAL_STATE_POLL_TIMER) @@ -132,7 +109,7 @@ local somfy_handler = { } } }, - can_handle = is_zigbee_window_shade, + can_handle = require("somfy.can_handle"), } return somfy_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/sub_drivers.lua b/drivers/SmartThings/zigbee-window-treatment/src/sub_drivers.lua new file mode 100644 index 0000000000..959c8d8c22 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/sub_drivers.lua @@ -0,0 +1,19 @@ +-- 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("vimar"), + lazy_load_if_possible("aqara"), + lazy_load_if_possible("feibit"), + lazy_load_if_possible("somfy"), + lazy_load_if_possible("invert-lift-percentage"), + lazy_load_if_possible("rooms-beautiful"), + lazy_load_if_possible("axis"), + lazy_load_if_possible("yoolax"), + lazy_load_if_possible("hanssem"), + lazy_load_if_possible("screen-innovations"), + lazy_load_if_possible("VIVIDSTORM"), + lazy_load_if_possible("HOPOsmart"), +} +return sub_drivers diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_battery_ikea.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_battery_ikea.lua index c0e83e5ab8..9c3bab7c56 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_battery_ikea.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_battery_ikea.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -64,7 +54,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -83,7 +76,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -102,7 +98,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -132,7 +131,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -182,7 +184,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -206,7 +211,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 100 - 30) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -222,7 +230,129 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 50) }) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Cancel existing set-status timer when a new partial level report arrives", + function() + -- First attr: level 90 sets T1 + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 10) + }) + test.socket.capability:__expect_send({ + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 90 } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) + ) + -- Second attr arrives before T1 fires: should cancel T1 and create T2 + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 15) + }) + test.socket.capability:__expect_send({ + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 85 } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closing()) + ) + -- T2 fires; T1 was cancelled so only partially_open from T2 + test.mock_time.advance_time(1) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Timer callback emits closed when shade reaches level 0", + function() + -- First attr starts partial movement and arms a 1-second status timer + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 10) + }) + test.socket.capability:__expect_send({ + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 90 } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) + ) + -- Second attr reports fully closed (level=0); goes through elseif branch, T1 still pending + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 100) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closed()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) + ) + -- T1 fires; get_latest_state returns 0 so the callback emits closed() + test.mock_time.advance_time(1) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closed()) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Timer callback emits open when shade reaches level 100", + function() + -- First attr starts partial movement and arms a 1-second status timer + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 10) + }) + test.socket.capability:__expect_send({ + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 90 } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) + ) + -- Second attr reports fully open (level=100); goes through elseif branch, T1 still pending + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 0) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) + ) + -- T1 fires; get_latest_state returns 100 so the callback emits open() + test.mock_time.advance_time(1) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open()) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_battery_yoolax.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_battery_yoolax.lua index d51f303378..b7f0cf9164 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_battery_yoolax.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_battery_yoolax.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -94,7 +84,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(99)) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -129,7 +122,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -148,7 +144,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 50) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -166,7 +165,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 0) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -202,7 +204,10 @@ test.register_coroutine_test( mock_device.id, clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -235,7 +240,10 @@ test.register_coroutine_test( test.mock_time.advance_time(30) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -283,7 +291,10 @@ test.register_coroutine_test( clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -329,7 +340,124 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) ) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Default response emits opening when current level is higher than target", + function() + -- Establish a partially-closed shade state (zigbee value 90 → shadeLevel 10) + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 90) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(10)) + ) + test.wait_for_events() + -- Send open command: MOST_RECENT_SETLEVEL = 0 (level = 100 - 100 = 0) + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "windowShade", component = "main", command = "open", args = {} } + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + WindowCovering.server.commands.GoToLiftPercentage(mock_device, 0) + }) + test.wait_for_events() + -- Default response: current_level_zigbee=90, most_recent=0 → 90 > 0 → opening() + test.socket.zigbee:__queue_receive({ + mock_device.id, + build_default_response_msg(WindowCovering.ID, WindowCovering.server.commands.GoToLiftPercentage.ID, Status.SUCCESS) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Attr handler emits partially_open when report matches most-recent set level", + function() + -- Send presetPosition; preset level = 50 so MOST_RECENT_SETLEVEL = 50 (100-50=50) + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "windowShadePreset", component = "main", command = "presetPosition", args = {} } + }) + test.socket.zigbee:__expect_send({ + mock_device.id, + WindowCovering.server.commands.GoToLiftPercentage(mock_device, 50) + }) + test.wait_for_events() + -- Attr report value=50 matches MOST_RECENT_SETLEVEL; shade stops at partial level + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 50) + }) + -- current_level was nil → partially_open from the nil-check branch + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) + ) + -- most_recent matches and value is partial → partially_open again (from the match branch) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50)) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Spontaneous level report towards open emits opening event", + function() + -- First attr establishes a partial shade level (value=10 → shadeLevel=90) + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 10) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(90)) + ) + -- Second attr moves toward open (value=5 < current zigbee 10 → opening) + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 5) + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(95)) + ) + test.wait_for_events() + test.mock_time.advance_time(2) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_only_HOPOsmart.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_only_HOPOsmart.lua index 1e4a8b3a2a..a7876e7223 100755 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_only_HOPOsmart.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_shade_only_HOPOsmart.lua @@ -1,16 +1,6 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -53,7 +43,10 @@ test.register_coroutine_test( local read_0x0000_messge = cluster_base.read_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE) test.socket.zigbee:__expect_send({mock_device.id, read_0x0000_messge}) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -74,6 +67,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, clusters.WindowCovering.server.commands.UpOrOpen(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -98,6 +94,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.DownOrClose(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -117,6 +116,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.Stop(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -132,7 +134,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -147,7 +152,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -162,7 +170,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closed())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -177,7 +188,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closing())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -192,7 +206,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open())) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment.lua index 6380e5ce51..8bbe64ddc5 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -63,7 +53,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -113,7 +106,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -134,6 +130,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, clusters.WindowCovering.server.commands.UpOrOpen(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -158,6 +157,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.DownOrClose(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -177,6 +179,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.Stop(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -202,6 +207,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.GoToLiftPercentage(mock_device, 33) } } + }, + { + min_api_version = 19 } ) @@ -262,6 +270,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.GoToLiftPercentage(mock_device, 20) } }, + }, + { + min_api_version = 19 } ) @@ -285,7 +296,10 @@ test.register_coroutine_test( mock_device.id, clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -317,7 +331,10 @@ test.register_coroutine_test( clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_VWSDSTUST120H.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_VWSDSTUST120H.lua index 394498b3c8..a971a05967 100755 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_VWSDSTUST120H.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_VWSDSTUST120H.lua @@ -1,16 +1,6 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -59,7 +49,10 @@ test.register_coroutine_test( }) test.socket.zigbee:__expect_send({mock_device.id, read_0x0000_messge}) test.socket.zigbee:__expect_send({mock_device.id, read_0x0001_messge}) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -75,7 +68,10 @@ test.register_coroutine_test( }) test.socket.zigbee:__expect_send({mock_device.id, read_0x0000_messge}) test.socket.zigbee:__expect_send({mock_device.id, read_0x0001_messge}) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -96,6 +92,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, clusters.WindowCovering.server.commands.UpOrOpen(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -120,6 +119,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.DownOrClose(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -139,6 +141,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.Stop(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -153,7 +158,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE, data_types.Uint8, 0) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -167,7 +175,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE, data_types.Uint8, 1) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -181,7 +192,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE, data_types.Uint8, 2) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -195,7 +209,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0000, MFG_CODE, data_types.Uint8, 3) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -210,7 +227,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.mode.mode("Delete upper limit"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -225,7 +245,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.mode.mode("Set the upper limit"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -240,7 +263,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.mode.mode("Delete lower limit"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -255,7 +281,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.mode.mode("Set the lower limit"))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -270,7 +299,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("hardwareFault", capabilities.hardwareFault.hardwareFault.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -285,7 +317,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("hardwareFault", capabilities.hardwareFault.hardwareFault.detected())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -303,7 +338,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -321,7 +359,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() 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 d669681c0b..27f00003dc 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 @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local base64 = require "st.base64" local capabilities = require "st.capabilities" @@ -151,7 +141,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, Basic.ID, PREF_ATTRIBUTE_ID, MFG_CODE, data_types.CharString, PREF_SOFT_TOUCH_ON) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -183,7 +176,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_read(mock_device, Basic.ID, { PREF_ATTRIBUTE_ID }, MFG_CODE) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -202,7 +198,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closed()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -221,7 +220,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -240,7 +242,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -256,7 +261,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.UpOrOpen(mock_device, 'open') }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -272,7 +280,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.DownOrClose(mock_device, 'close') }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -288,7 +299,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.Stop(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -332,7 +346,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", deviceInitialization.initializedState.initialized())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -361,7 +378,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, Basic.ID, PREF_ATTRIBUTE_ID, MFG_CODE, data_types.CharString, PREF_SOFT_TOUCH_OFF) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -382,7 +402,10 @@ test.register_coroutine_test( mock_device.id, AnalogOutput.attributes.PresentValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -409,7 +432,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_version_device:generate_test_message("main", capabilities.windowShade.windowShade.closed()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -436,7 +462,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_version_device:generate_test_message("main", capabilities.windowShade.windowShade.open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -463,7 +492,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_version_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -480,7 +512,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 50) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -507,7 +542,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 0) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -536,7 +574,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 100) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -566,7 +607,10 @@ test.register_coroutine_test( cluster_base.read_manufacturer_specific_attribute(mock_device, Basic.ID, PREF_ATTRIBUTE_ID, MFG_CODE) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -585,7 +629,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -604,7 +651,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closing()) ) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara_curtain_driver_e1.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara_curtain_driver_e1.lua index 2b095c6c16..07d17c72a7 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara_curtain_driver_e1.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_aqara_curtain_driver_e1.lua @@ -1,16 +1,6 @@ --- Copyright 2024 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2024 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local zigbee_test_utils = require "integration_test.zigbee_test_utils" local cluster_base = require "st.zigbee.cluster_base" local clusters = require "st.zigbee.zcl.clusters" @@ -119,7 +109,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(100)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +156,10 @@ test.register_coroutine_test( PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -177,7 +173,10 @@ test.register_coroutine_test( custom_write_attribute(mock_device , WindowCovering.ID, WindowCovering.attributes.Mode.ID, data_types.Bitmap8, 0x01, nil) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -189,7 +188,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_CURTAIN_MANUAL_ATTRIBUTE_ID, MFG_CODE, data_types.Boolean, false) }) - end + end, + { + min_api_version = 19 + } ) @@ -217,7 +219,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.UpOrOpen(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -243,7 +248,10 @@ test.register_coroutine_test( -- mock_device.id, -- WindowCovering.server.commands.DownOrClose(mock_device) -- }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -270,7 +278,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.Stop(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -285,7 +296,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_CURTAIN_LOCKING_SETTING_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 0x01) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -300,7 +314,10 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_CURTAIN_LOCKING_SETTING_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 0x00) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -329,7 +346,10 @@ test.register_coroutine_test( mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) @@ -346,7 +366,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", chargingState.chargingState.charging()) ) - end + end, + { + min_api_version = 19 + } ) @@ -363,6 +386,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -379,7 +405,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", initializedStateWithGuide.initializedStateWithGuide.initialized()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -395,7 +424,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -411,7 +443,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", hookLockState.hookLockState.locking()) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() 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 a27f85f528..bc99731313 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 @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local base64 = require "st.base64" local capabilities = require "st.capabilities" @@ -124,7 +114,10 @@ test.register_coroutine_test( cluster_base.write_manufacturer_specific_attribute(mock_device, Basic.ID, PREF_ATTRIBUTE_ID, MFG_CODE, data_types.CharString, PREF_REVERSE_OFF) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -156,7 +149,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_read(mock_device, Basic.ID, { PREF_ATTRIBUTE_ID }, MFG_CODE) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -175,7 +171,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closed()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -194,7 +193,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -213,7 +215,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -239,7 +244,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 100) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -265,7 +273,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 0) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -281,7 +292,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.Stop(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -297,7 +311,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", shadeRotateState.rotateState.idle({state_change = true, visibility = { displayed = false }})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -314,7 +331,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", shadeRotateState.rotateState.idle({state_change = true, visibility = { displayed = false }})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -349,7 +369,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", initializedStateWithGuide.initializedStateWithGuide.initialized())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -370,7 +393,10 @@ test.register_coroutine_test( mock_device.id, AnalogOutput.attributes.PresentValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -399,7 +425,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 50) }) - end + end, + { + min_api_version = 19 + } ) @@ -415,7 +444,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", initializedStateWithGuide.initializedStateWithGuide.notInitialized())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -432,7 +464,10 @@ test.register_coroutine_test( mock_device.id, AnalogOutput.attributes.PresentValue:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -470,7 +505,10 @@ test.register_coroutine_test( message.body.zcl_header.frame_ctrl = FrameCtrl(0x10) test.socket.zigbee:__expect_send({ mock_device.id, message }) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_axis.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_axis.lua index f3564ff79f..02efc68fe6 100755 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_axis.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_axis.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local base64 = require "st.base64" @@ -90,7 +80,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -128,7 +121,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closing()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -178,7 +174,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -203,7 +202,10 @@ test.register_coroutine_test( Level.server.commands.MoveToLevelWithOnOff(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -232,7 +234,10 @@ test.register_coroutine_test( WindowCovering.server.commands.DownOrClose(mock_device) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -257,7 +262,10 @@ test.register_coroutine_test( Level.server.commands.MoveToLevelWithOnOff(mock_device, 0xFE) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -286,7 +294,10 @@ test.register_coroutine_test( WindowCovering.server.commands.UpOrOpen(mock_device, 0x64) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -323,7 +334,10 @@ test.register_coroutine_test( mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -362,7 +376,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.Stop(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -387,7 +404,10 @@ test.register_coroutine_test( Level.server.commands.MoveToLevelWithOnOff(mock_device, 84) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -419,7 +439,10 @@ test.register_coroutine_test( WindowCovering.server.commands.GoToLiftPercentage(mock_device, 100 - 33) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -444,7 +467,10 @@ test.register_coroutine_test( Level.server.commands.MoveToLevelWithOnOff(mock_device, 127) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -478,7 +504,10 @@ test.register_coroutine_test( WindowCovering.server.commands.GoToLiftPercentage(mock_device, 100 - 50) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -510,7 +539,10 @@ test.register_coroutine_test( WindowCovering.server.commands.GoToLiftPercentage(mock_device, 100 - 50) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -552,7 +584,10 @@ test.register_coroutine_test( mock_device.id, Basic.attributes.SWBuildID:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -587,7 +622,10 @@ test.register_coroutine_test( mock_device.id, Basic.attributes.SWBuildID:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -639,7 +677,10 @@ test.register_coroutine_test( }) test.socket.zigbee:__expect_send({ mock_device.id, PowerConfiguration.attributes.BatteryPercentageRemaining:read(mock_device) }) test.socket.zigbee:__expect_send({ mock_device.id, WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_feibit.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_feibit.lua index aa0480eb2a..42b98aa088 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_feibit.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_feibit.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -76,7 +66,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -126,7 +119,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -147,6 +143,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, clusters.WindowCovering.server.commands.UpOrOpen(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -171,6 +170,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.DownOrClose(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -190,6 +192,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.Stop(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -215,6 +220,9 @@ test.register_message_test( Level.server.commands.MoveToLevelWithOnOff(mock_device,math.floor(33/100 * 254)) } } + }, + { + min_api_version = 19 } ) @@ -234,7 +242,10 @@ test.register_coroutine_test( mock_device.id, Level.server.commands.MoveToLevelWithOnOff(mock_device,math.floor(50/100 * 254)) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -252,7 +263,10 @@ test.register_coroutine_test( mock_device.id, Level.server.commands.MoveToLevelWithOnOff(mock_device,math.floor(50/100 * 254)) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -271,7 +285,10 @@ test.register_coroutine_test( mock_device.id, Level.server.commands.MoveToLevelWithOnOff(mock_device,math.floor(50/100 * 254)) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -298,7 +315,10 @@ test.register_coroutine_test( mock_device.id, Level.server.commands.MoveToLevelWithOnOff(mock_device,math.floor(1/100 * 254)) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -325,7 +345,10 @@ test.register_coroutine_test( mock_device.id, Level.server.commands.MoveToLevelWithOnOff(mock_device,math.floor(0/100 * 254)) }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -350,6 +373,9 @@ test.register_message_test( Level.server.commands.MoveToLevelWithOnOff(mock_device, math.floor(50 / 100 * 254)) } } + }, + { + min_api_version = 19 } ) @@ -373,7 +399,10 @@ test.register_coroutine_test( mock_device.id, Level.attributes.CurrentLevel:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -399,7 +428,10 @@ test.register_coroutine_test( }) test.socket.zigbee:__expect_send({ mock_device.id, WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() 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 2e511c99bb..5cc0a8cbce 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 @@ -1,16 +1,6 @@ --- Copyright 2023 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2023 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local zigbee_test_utils = require "integration_test.zigbee_test_utils" @@ -101,7 +91,10 @@ test.register_coroutine_test( mock_device.id, build_tx_message(mock_device,"\x02\x02\x00\x04\x00\x00\x00\x32") }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -143,7 +136,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -186,7 +182,10 @@ test.register_coroutine_test( }) 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())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -241,7 +240,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -284,7 +286,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -336,7 +341,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(30))) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -368,7 +376,10 @@ test.register_coroutine_test( mock_device.id, build_tx_message(mock_device,"\x05\x04\x00\x01\x01") }) - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_rooms.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_rooms.lua index b3bc0b6c29..04e5a0b43a 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_rooms.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_rooms.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local base64 = require "st.base64" @@ -66,7 +56,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -85,7 +78,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -104,7 +100,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(25)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -123,7 +122,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -142,7 +144,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -162,7 +167,10 @@ test.register_coroutine_test( WindowCovering.server.commands.GoToLiftPercentage(mock_device,100 - 33) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -179,7 +187,10 @@ test.register_coroutine_test( OnOff.server.commands.On(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -196,7 +207,10 @@ test.register_coroutine_test( OnOff.server.commands.Off(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -213,7 +227,10 @@ test.register_coroutine_test( WindowCovering.server.commands.Stop(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -232,7 +249,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -274,7 +294,11 @@ test.register_coroutine_test( test.socket.zigbee:__expect_send({mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, INVERT_CLUSTER, INVERT_CLUSTER_ATTRIBUTE, MFG_CODE, data_types.Boolean, updates.preferences.invert)}) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100))) - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -309,7 +333,10 @@ test.register_coroutine_test( mock_device.id, zigbee_test_utils.build_attribute_read(mock_device, INVERT_CLUSTER, {INVERT_CLUSTER_ATTRIBUTE}, 0x0000) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -355,7 +382,10 @@ test.register_coroutine_test( zigbee_test_utils.build_attribute_read(mock_device, INVERT_CLUSTER, {INVERT_CLUSTER_ATTRIBUTE}, 0x0000) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_screen_innovations.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_screen_innovations.lua index b7f630cf71..4abafaea50 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_screen_innovations.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_screen_innovations.lua @@ -1,16 +1,6 @@ --- Copyright 2024 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2024 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -72,7 +62,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -91,7 +84,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -117,7 +113,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(25)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -134,7 +133,10 @@ test.register_coroutine_test( WindowCovering.server.commands.UpOrOpen(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -151,7 +153,10 @@ test.register_coroutine_test( WindowCovering.server.commands.DownOrClose(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -168,7 +173,10 @@ test.register_coroutine_test( WindowCovering.server.commands.Stop(mock_device) }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -186,7 +194,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.battery.battery(batt_perc_out)) ) test.wait_for_events() end - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -206,7 +217,10 @@ test.register_coroutine_test( mock_device.id, Basic.attributes.PowerSource:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -255,7 +269,10 @@ test.register_coroutine_test( mock_device.id, Basic.attributes.PowerSource:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -284,7 +301,10 @@ test.register_coroutine_test( mock_device.id, Basic.attributes.PowerSource:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -324,7 +344,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(45)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -364,7 +387,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(85)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -404,7 +430,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -426,7 +455,10 @@ test.register_coroutine_test( Basic.attributes.PowerSource:build_test_attr_report(mock_device, 0)}) test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.powerSource.powerSource.unknown())) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_somfy.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_somfy.lua index 4c66d29257..47230e9b6b 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_somfy.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_somfy.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -76,7 +66,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -126,7 +119,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +159,10 @@ test.register_coroutine_test( }) test.mock_time.advance_time(3) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -242,7 +241,10 @@ test.register_coroutine_test( } ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -263,6 +265,9 @@ test.register_message_test( direction = "send", message = { mock_device.id, WindowCovering.server.commands.UpOrOpen(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -287,6 +292,9 @@ test.register_message_test( WindowCovering.server.commands.DownOrClose(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -306,6 +314,9 @@ test.register_message_test( WindowCovering.server.commands.Stop(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -331,6 +342,9 @@ test.register_message_test( WindowCovering.server.commands.GoToLiftPercentage(mock_device, 100 - 33) } } + }, + { + min_api_version = 19 } ) @@ -356,6 +370,9 @@ test.register_message_test( WindowCovering.server.commands.GoToLiftPercentage(mock_device, 50) } } + }, + { + min_api_version = 19 } ) @@ -381,7 +398,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 99) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -405,7 +425,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 0) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -423,7 +446,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 50) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -447,7 +473,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.server.commands.GoToLiftPercentage(mock_device, 100) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -469,7 +498,10 @@ test.register_coroutine_test( mock_device.id, WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -502,7 +534,10 @@ test.register_coroutine_test( WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -524,7 +559,111 @@ test.register_coroutine_test( } } ) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Attribute handler reports closed when level is 0", + { + { + channel = "zigbee", + direction = "receive", + message = { + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 100) + } + }, + { + channel = "capability", + direction = "send", + message = { + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 0 } } + } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closed()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Attribute handler reports open when level is 100", + { + { + channel = "zigbee", + direction = "receive", + message = { + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 0) + } + }, + { + channel = "capability", + direction = "send", + message = { + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 100 } } + } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open()) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Cancel existing poll timer when a new partial level report arrives", + function() + -- First attr: level 90 creates T1 via overwrite_existing_timer_if_needed + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 10) + }) + test.socket.capability:__expect_send({ + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 90 } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) + ) + -- Second attr before T1 fires: overwrite_existing_timer_if_needed cancels T1 and stores T2 + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 15) + }) + test.socket.capability:__expect_send({ + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 85 } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closing()) + ) + -- T2 fires; T1 was cancelled so only one partially_open + test.mock_time.advance_time(2) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_vimar.lua b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_vimar.lua index 80a6552d8b..f002cf5d84 100755 --- a/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_vimar.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/test/test_zigbee_window_treatment_vimar.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -71,7 +61,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -115,7 +108,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.windowShade.windowShade.partially_open()) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -149,6 +145,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.GoToLiftPercentage(mock_device, 0) } }, + }, + { + min_api_version = 19 } ) @@ -178,6 +177,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) }, + }, + { + min_api_version = 19 } ) @@ -197,6 +199,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.Stop(mock_device) } } + }, + { + min_api_version = 19 } ) @@ -232,6 +237,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.GoToLiftPercentage(mock_device, 67) } }, + }, + { + min_api_version = 19 } ) @@ -267,6 +275,9 @@ test.register_message_test( clusters.WindowCovering.server.commands.GoToLiftPercentage(mock_device, 50) } } + }, + { + min_api_version = 19 } ) @@ -290,7 +301,10 @@ test.register_coroutine_test( mock_device.id, clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -322,7 +336,140 @@ test.register_coroutine_test( clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:read(mock_device) }) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Attribute handler reports closed when shade reaches level 0", + { + { + channel = "zigbee", + direction = "receive", + message = { + mock_device.id, + clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 100) + } + }, + { + channel = "capability", + direction = "send", + message = { + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 0 } } + } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closed()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Attribute handler reports open when shade reaches level 100", + { + { + channel = "zigbee", + direction = "receive", + message = { + mock_device.id, + clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 0) + } + }, + { + channel = "capability", + direction = "send", + message = { + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 100 } } + } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.windowShade.windowShade.open()) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "SetLevel command emits closing when requested level is below current level", + function() + -- Attr report sets current shade level to 90 (inverted value=10) + test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") + test.socket.zigbee:__queue_receive({ + mock_device.id, + clusters.WindowCovering.attributes.CurrentPositionLiftPercentage:build_test_attr_report(mock_device, 10) + }) + test.socket.capability:__expect_send({ + mock_device.id, + { capability_id = "windowShadeLevel", component_id = "main", attribute_id = "shadeLevel", state = { value = 90 } } + }) + test.wait_for_events() + -- Now both vimar flags are false; requesting level 30 (< 90) triggers closing branch + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "windowShadeLevel", component = "main", command = "setShadeLevel", args = { 30 } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.closing()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(30)) + ) + test.socket.zigbee:__expect_send({ + mock_device.id, + clusters.WindowCovering.server.commands.GoToLiftPercentage(mock_device, 70) + }) + test.wait_for_events() + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "SetLevel command is ignored (early return) when shades are already moving", + function() + -- Open command: current=0 < 100 → opening, sets VIMAR_SHADES_OPENING=true + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "windowShade", component = "main", command = "open", args = {} } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShade.windowShade.opening()) + ) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) + ) + test.socket.zigbee:__expect_send({ + mock_device.id, + clusters.WindowCovering.server.commands.GoToLiftPercentage(mock_device, 0) + }) + test.wait_for_events() + -- While opening, a different setShadeLevel is requested: ignored with current level re-emitted + test.socket.capability:__queue_receive({ + mock_device.id, + { capability = "windowShadeLevel", component = "main", command = "setShadeLevel", args = { 50 } } + }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) + ) + test.wait_for_events() + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zigbee-window-treatment/src/vimar/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/vimar/can_handle.lua new file mode 100644 index 0000000000..1d72817eae --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/vimar/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local is_zigbee_window_shade = function(opts, driver, device) + local FINGERPRINTS = require("vimar.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("vimar") + end + end + return false +end + +return is_zigbee_window_shade diff --git a/drivers/SmartThings/zigbee-window-treatment/src/vimar/fingerprints.lua b/drivers/SmartThings/zigbee-window-treatment/src/vimar/fingerprints.lua new file mode 100644 index 0000000000..ea7f4cd3bf --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/vimar/fingerprints.lua @@ -0,0 +1,9 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { + { mfr = "Vimar", model = "Window_Cov_v1.0" }, + { mfr = "Vimar", model = "Window_Cov_Module_v1.0" } +} + +return ZIGBEE_WINDOW_SHADE_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-window-treatment/src/vimar/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/vimar/init.lua index 9fa928645a..dd5ea15aed 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/vimar/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/vimar/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local utils = require "st.utils" @@ -27,20 +17,8 @@ local windowShade = capabilities.windowShade.windowShade local VIMAR_SHADES_OPENING = "_vimarShadesOpening" local VIMAR_SHADES_CLOSING = "_vimarShadesClosing" -local ZIGBEE_WINDOW_SHADE_FINGERPRINTS = { - { mfr = "Vimar", model = "Window_Cov_v1.0" }, - { mfr = "Vimar", model = "Window_Cov_Module_v1.0" } -} -- UTILS to check manufacturer details -local is_zigbee_window_shade = function(opts, driver, device) - for _, fingerprint in ipairs(ZIGBEE_WINDOW_SHADE_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end -- ATTRIBUTE HANDLER FOR CurrentPositionLiftPercentage local function current_position_attr_handler(driver, device, value, zb_rx) @@ -176,7 +154,7 @@ local vimar_handler = { lifecycle_handlers = { init = device_init }, - can_handle = is_zigbee_window_shade, + can_handle = require("vimar.can_handle"), } return vimar_handler diff --git a/drivers/SmartThings/zigbee-window-treatment/src/window_shade_utils.lua b/drivers/SmartThings/zigbee-window-treatment/src/window_shade_utils.lua index 262e549c2d..f3e09c20a6 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/window_shade_utils.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/window_shade_utils.lua @@ -1,16 +1,6 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local zcl_clusters = require "st.zigbee.zcl.clusters" @@ -41,4 +31,4 @@ utils.set_preset_position_cmd = function(driver, device, command) device:set_field(utils.PRESET_LEVEL_KEY, command.args.position, {persist = true}) end -return utils \ No newline at end of file +return utils diff --git a/drivers/SmartThings/zigbee-window-treatment/src/window_treatment_utils.lua b/drivers/SmartThings/zigbee-window-treatment/src/window_treatment_utils.lua index 2f20ff2b4f..5b2ec304e6 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/window_treatment_utils.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/window_treatment_utils.lua @@ -1,16 +1,6 @@ --- Copyright 2025 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local window_treatment_utils = {} diff --git a/drivers/SmartThings/zigbee-window-treatment/src/yoolax/can_handle.lua b/drivers/SmartThings/zigbee-window-treatment/src/yoolax/can_handle.lua new file mode 100644 index 0000000000..006fa3e1bb --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/yoolax/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function is_yoolax_window_shade(opts, driver, device) + local FINGERPRINTS = require("yoolax.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then + return true, require("yoolax") + end + end + return false +end + +return is_yoolax_window_shade diff --git a/drivers/SmartThings/zigbee-window-treatment/src/yoolax/fingerprints.lua b/drivers/SmartThings/zigbee-window-treatment/src/yoolax/fingerprints.lua new file mode 100644 index 0000000000..30e0dd4c62 --- /dev/null +++ b/drivers/SmartThings/zigbee-window-treatment/src/yoolax/fingerprints.lua @@ -0,0 +1,9 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local YOOLAX_WINDOW_SHADE_FINGERPRINTS = { + { mfr = "Yookee", model = "D10110" }, -- Yookee Window Treatment + { mfr = "yooksmart", model = "D10110" } -- yooksmart Window Treatment +} + +return YOOLAX_WINDOW_SHADE_FINGERPRINTS diff --git a/drivers/SmartThings/zigbee-window-treatment/src/yoolax/init.lua b/drivers/SmartThings/zigbee-window-treatment/src/yoolax/init.lua index 46cb33fed2..5a593cdf2c 100644 --- a/drivers/SmartThings/zigbee-window-treatment/src/yoolax/init.lua +++ b/drivers/SmartThings/zigbee-window-treatment/src/yoolax/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local zcl_clusters = require "st.zigbee.zcl.clusters" @@ -24,19 +14,7 @@ local device_management = require "st.zigbee.device_management" local LEVEL_UPDATE_TIMEOUT = "__level_update_timeout" local MOST_RECENT_SETLEVEL = "__most_recent_setlevel" -local YOOLAX_WINDOW_SHADE_FINGERPRINTS = { - { mfr = "Yookee", model = "D10110" }, -- Yookee Window Treatment - { mfr = "yooksmart", model = "D10110" } -- yooksmart Window Treatment -} -local function is_yoolax_window_shade(opts, driver, device) - for _, fingerprint in ipairs(YOOLAX_WINDOW_SHADE_FINGERPRINTS) do - if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then - return true - end - end - return false -end local function default_response_handler(driver, device, zb_message) local is_success = zb_message.body.zcl_body.status.value @@ -160,7 +138,7 @@ local yoolax_window_shade = { } }, }, - can_handle = is_yoolax_window_shade + can_handle = require("yoolax.can_handle"), } return yoolax_window_shade diff --git a/drivers/SmartThings/zwave-bulb/src/test/test_aeon_multiwhite_bulb.lua b/drivers/SmartThings/zwave-bulb/src/test/test_aeon_multiwhite_bulb.lua index 7ae91bc853..e569cb8d6e 100644 --- a/drivers/SmartThings/zwave-bulb/src/test/test_aeon_multiwhite_bulb.lua +++ b/drivers/SmartThings/zwave-bulb/src/test/test_aeon_multiwhite_bulb.lua @@ -60,7 +60,11 @@ do direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = level})) } + }, + { + min_api_version = 19 } + ) end @@ -77,6 +81,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperature(2700)) } + }, + { + min_api_version = 19 } ) @@ -98,6 +105,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = 100})) } + }, + { + min_api_version = 19 } ) @@ -119,6 +129,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = 0})) } + }, + { + min_api_version = 19 } ) @@ -142,7 +155,11 @@ do direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = level})) } + }, + { + min_api_version = 19 } + ) end @@ -164,6 +181,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = 100})) } + }, + { + min_api_version = 19 } ) @@ -185,6 +205,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = 0})) } + }, + { + min_api_version = 19 } ) @@ -207,6 +230,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = 0})) } + }, + { + min_api_version = 19 } ) @@ -229,6 +255,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = 100})) } + }, + { + min_api_version = 19 } ) @@ -250,6 +279,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = 0})) } + }, + { + min_api_version = 19 } ) @@ -279,7 +311,11 @@ do direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level({value = level})) } + }, + { + min_api_version = 19 } + ) end @@ -309,6 +345,9 @@ test.register_message_test( Configuration:Get({parameter_number = 0x52}) ) } + }, + { + min_api_version = 19 } ) @@ -338,6 +377,9 @@ test.register_message_test( Configuration:Get({parameter_number = 0x51}) ) } + }, + { + min_api_version = 19 } ) @@ -364,7 +406,11 @@ do direction = "send", message = mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperature({value = temp})) } + }, + { + min_api_version = 19 } + ) end @@ -390,7 +436,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -414,7 +463,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -439,7 +491,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -513,7 +568,10 @@ test.register_coroutine_test( SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.COLD_WHITE }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-bulb/src/test/test_aeotec_led_bulb_6.lua b/drivers/SmartThings/zwave-bulb/src/test/test_aeotec_led_bulb_6.lua index 8757c4e11a..8b1633440d 100644 --- a/drivers/SmartThings/zwave-bulb/src/test/test_aeotec_led_bulb_6.lua +++ b/drivers/SmartThings/zwave-bulb/src/test/test_aeotec_led_bulb_6.lua @@ -104,7 +104,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -156,7 +157,10 @@ test.register_coroutine_test( Configuration:Get({ parameter_number=parameter_number }) ) ) - end + end, + { + min_api_version = 19 + } ) do @@ -182,7 +186,11 @@ do direction = "send", message = mock_aeotec_bulb:generate_test_message("main", capabilities.colorTemperature.colorTemperature(temp)) } + }, + { + min_api_version = 19 } + ) end diff --git a/drivers/SmartThings/zwave-bulb/src/test/test_fibaro_rgbw_controller.lua b/drivers/SmartThings/zwave-bulb/src/test/test_fibaro_rgbw_controller.lua index 1610440aea..6d3f4336ec 100644 --- a/drivers/SmartThings/zwave-bulb/src/test/test_fibaro_rgbw_controller.lua +++ b/drivers/SmartThings/zwave-bulb/src/test/test_fibaro_rgbw_controller.lua @@ -98,7 +98,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -168,7 +169,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -198,7 +200,10 @@ test.register_coroutine_test( SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.WARM_WHITE }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -227,7 +232,10 @@ test.register_coroutine_test( SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.WARM_WHITE }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -257,6 +265,7 @@ test.register_message_test( } }, { + min_api_version = 19 } ) @@ -288,6 +297,7 @@ test.register_coroutine_test( ) end, { + min_api_version = 19 } ) @@ -309,6 +319,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_rgbw_controller:generate_test_message("main", capabilities.powerMeter.power({ value = 27, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -334,7 +347,11 @@ do direction = "send", message = mock_fibaro_rgbw_controller:generate_test_message("main", capabilities.switchLevel.level(level)) } + }, + { + min_api_version = 19 } + ) end @@ -379,7 +396,11 @@ do SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.RED }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -455,7 +476,11 @@ do direction = "send", message = mock_fibaro_rgbw_controller:generate_test_message("rgb", capabilities.colorControl.saturation(sat)) } + }, + { + min_api_version = 19 } + ) end @@ -482,7 +507,11 @@ do direction = "send", message = mock_fibaro_rgbw_controller:generate_test_message("white", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } + ) end @@ -509,7 +538,11 @@ do direction = "send", message = mock_fibaro_rgbw_controller:generate_test_message("white", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } + ) end diff --git a/drivers/SmartThings/zwave-bulb/src/test/test_zwave_bulb.lua b/drivers/SmartThings/zwave-bulb/src/test/test_zwave_bulb.lua index 9d5e199927..a5061dcfe6 100644 --- a/drivers/SmartThings/zwave-bulb/src/test/test_zwave_bulb.lua +++ b/drivers/SmartThings/zwave-bulb/src/test/test_zwave_bulb.lua @@ -99,7 +99,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -130,7 +131,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -157,6 +161,7 @@ test.register_message_test( } }, { + min_api_version = 19 } ) @@ -190,6 +195,7 @@ test.register_coroutine_test( ) end, { + min_api_version = 19 } ) @@ -222,6 +228,7 @@ test.register_coroutine_test( ) end, { + min_api_version = 19 } ) @@ -254,7 +261,11 @@ do direction = "send", message = mock_zwave_bulb:generate_test_message("main", capabilities.switchLevel.level(level)) } + }, + { + min_api_version = 19 } + ) end @@ -302,7 +313,11 @@ do SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.RED }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -369,7 +384,11 @@ do direction = "send", message = mock_zwave_bulb:generate_test_message("main", capabilities.colorControl.saturation(sat)) } + }, + { + min_api_version = 19 } + ) end @@ -410,7 +429,10 @@ test.register_coroutine_test( SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.WARM_WHITE }) ) ) - end + end, + { + min_api_version = 19 + } ) do @@ -455,6 +477,9 @@ do direction = "send", message = mock_zwave_bulb:generate_test_message("main", capabilities.colorTemperature.colorTemperature(temp)) } + }, + { + min_api_version = 19 } ) end diff --git a/drivers/SmartThings/zwave-button/src/test/test_zwave_aeotec_minimote.lua b/drivers/SmartThings/zwave-button/src/test/test_zwave_aeotec_minimote.lua index 3788947ef4..8f95ae83b2 100644 --- a/drivers/SmartThings/zwave-button/src/test/test_zwave_aeotec_minimote.lua +++ b/drivers/SmartThings/zwave-button/src/test/test_zwave_aeotec_minimote.lua @@ -67,6 +67,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_minimote:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -93,6 +96,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_minimote:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -120,6 +126,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_minimote:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -146,6 +155,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_minimote:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -172,6 +184,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_minimote:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -198,6 +213,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_minimote:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -224,6 +242,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_minimote:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -250,6 +271,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_minimote:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -307,7 +331,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 140, size = 4, configuration_value = 26017792}) --payload="��" )) mock_aeotec_minimote:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -345,7 +372,10 @@ test.register_coroutine_test( ) end end - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-button/src/test/test_zwave_aeotec_nanomote_one.lua b/drivers/SmartThings/zwave-button/src/test/test_zwave_aeotec_nanomote_one.lua index 5aad3b2547..d2866aaecd 100644 --- a/drivers/SmartThings/zwave-button/src/test/test_zwave_aeotec_nanomote_one.lua +++ b/drivers/SmartThings/zwave-button/src/test/test_zwave_aeotec_nanomote_one.lua @@ -66,7 +66,10 @@ test.register_coroutine_test( Battery:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-button/src/test/test_zwave_button.lua b/drivers/SmartThings/zwave-button/src/test/test_zwave_button.lua index 9cd4532bb1..bea1aae3e3 100644 --- a/drivers/SmartThings/zwave-button/src/test/test_zwave_button.lua +++ b/drivers/SmartThings/zwave-button/src/test/test_zwave_button.lua @@ -57,6 +57,9 @@ test.register_message_test( direction = "send", message = mock:generate_test_message("main", capabilities.button.button.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -73,6 +76,9 @@ test.register_message_test( direction = "send", message = mock:generate_test_message("main", capabilities.button.button.held({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -91,6 +97,9 @@ test.register_message_test( direction = "send", message = mock:generate_test_message("main", capabilities.button.button.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -109,7 +118,11 @@ test.register_message_test( direction = "send", message = mock:generate_test_message("main", capabilities.button.button.down_hold({ state_change = true })) } + }, + { + min_api_version = 19 } + ) test.register_coroutine_test( @@ -136,7 +149,11 @@ test.register_coroutine_test( Battery:Get({}) ) ) - end + end, + { + min_api_version = 19 + } + ) @@ -164,6 +181,9 @@ test.register_coroutine_test( Battery:Get({}) ) }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-button/src/test/test_zwave_fibaro_button.lua b/drivers/SmartThings/zwave-button/src/test/test_zwave_fibaro_button.lua index a71e136998..0ba65fc434 100644 --- a/drivers/SmartThings/zwave-button/src/test/test_zwave_fibaro_button.lua +++ b/drivers/SmartThings/zwave-button/src/test/test_zwave_fibaro_button.lua @@ -65,7 +65,10 @@ test.register_coroutine_test( Battery:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-button/src/test/test_zwave_multi_button.lua b/drivers/SmartThings/zwave-button/src/test/test_zwave_multi_button.lua index 27c9b851f9..8a7613f8ef 100644 --- a/drivers/SmartThings/zwave-button/src/test/test_zwave_multi_button.lua +++ b/drivers/SmartThings/zwave-button/src/test/test_zwave_multi_button.lua @@ -116,6 +116,9 @@ test.register_message_test( direction = "send", message = mock_everspring:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -142,6 +145,9 @@ test.register_message_test( direction = "send", message = mock_everspring:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -165,7 +171,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_everspring:generate_test_message( "main", capabilities.button.button.double({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -191,6 +200,9 @@ test.register_message_test( direction = "send", message = mock_everspring:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -217,6 +229,9 @@ test.register_message_test( direction = "send", message = mock_everspring:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -240,7 +255,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_everspring:generate_test_message( "main", capabilities.button.button.double({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -266,6 +284,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_wallmote_quad:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -292,6 +313,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_wallmote_quad:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -318,6 +342,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_wallmote_quad:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -340,7 +367,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_aeotec_wallmote_quad:generate_test_message( "main", capabilities.button.button.held({state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -356,6 +386,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -383,6 +416,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_keyfob_button:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -409,6 +445,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_keyfob_button:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -435,6 +474,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_keyfob_button:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -461,6 +503,9 @@ test.register_message_test( direction = "send", message = mock_aeotec_keyfob_button:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -483,7 +528,10 @@ test.register_coroutine_test( Association:Set({grouping_identifier = 1, node_ids = {}}) )) mock_aeotec_keyfob_button:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -568,7 +616,10 @@ test.register_coroutine_test( Battery:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) --configuration for fibaro keyfob @@ -606,7 +657,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 26, size = 1, configuration_value = 15}) )) mock_fibaro_keyfob_button:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -719,7 +773,10 @@ test.register_coroutine_test( Battery:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -804,7 +861,10 @@ test.register_coroutine_test( Battery:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -861,7 +921,39 @@ test.register_coroutine_test( Battery:Get({}) ) ) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Central scene notification with scene_number beyond profile buttons falls back to main component", + { + { + channel = "zwave", + direction = "receive", + message = { + mock_aeotec_wallmote_quad.id, + zw_test_utils.zwave_test_build_receive_command( + CentralScene:Notification({ key_attributes = CentralScene.key_attributes.KEY_PRESSED_1_TIME, scene_number = 5 }) + ) + } + }, + { + channel = "capability", + direction = "send", + message = mock_aeotec_wallmote_quad:generate_test_message("main", capabilities.button.button.pushed({ state_change = true })) + }, + { + channel = "capability", + direction = "send", + message = mock_aeotec_wallmote_quad:generate_test_message("main", capabilities.button.button.pushed({ state_change = true })) + } + }, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-electric-meter/src/test/test_aeon_meter.lua b/drivers/SmartThings/zwave-electric-meter/src/test/test_aeon_meter.lua index cb92a861fe..4c4241f6e6 100644 --- a/drivers/SmartThings/zwave-electric-meter/src/test/test_aeon_meter.lua +++ b/drivers/SmartThings/zwave-electric-meter/src/test/test_aeon_meter.lua @@ -52,6 +52,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.powerMeter.power({ value = 27, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -71,6 +74,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -100,7 +106,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -130,7 +137,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 103, size = 4, configuration_value = 0}) )) mock_meter:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zwave-electric-meter/src/test/test_aeotec_gen5_meter.lua b/drivers/SmartThings/zwave-electric-meter/src/test/test_aeotec_gen5_meter.lua index 29255434d1..c39d5b3e0e 100644 --- a/drivers/SmartThings/zwave-electric-meter/src/test/test_aeotec_gen5_meter.lua +++ b/drivers/SmartThings/zwave-electric-meter/src/test/test_aeotec_gen5_meter.lua @@ -52,6 +52,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.powerMeter.power({ value = 27, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -71,6 +74,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -100,7 +106,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -134,7 +141,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 13, size = 1, configuration_value = 0}) )) mock_meter:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-electric-meter/src/test/test_qubino_3_phase_meter.lua b/drivers/SmartThings/zwave-electric-meter/src/test/test_qubino_3_phase_meter.lua index 55f1b9e436..892bd9a10f 100644 --- a/drivers/SmartThings/zwave-electric-meter/src/test/test_qubino_3_phase_meter.lua +++ b/drivers/SmartThings/zwave-electric-meter/src/test/test_qubino_3_phase_meter.lua @@ -94,6 +94,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("endpointMeter3", capabilities.powerMeter.power({ value = 5, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -113,6 +116,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) }, + }, + { + min_api_version = 19 } ) @@ -172,7 +178,10 @@ test.register_coroutine_test( { capability = "refresh", component = "main", command = "refresh", args = { } } }) - end + end, + { + min_api_version = 19 + } ) @@ -211,7 +220,10 @@ test.register_coroutine_test( ) )) mock_meter:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-electric-meter/src/test/test_qubino_smart_meter.lua b/drivers/SmartThings/zwave-electric-meter/src/test/test_qubino_smart_meter.lua index 47391c078f..648ef598c8 100644 --- a/drivers/SmartThings/zwave-electric-meter/src/test/test_qubino_smart_meter.lua +++ b/drivers/SmartThings/zwave-electric-meter/src/test/test_qubino_smart_meter.lua @@ -52,6 +52,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.powerMeter.power({ value = 27, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -71,6 +74,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -100,7 +106,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -118,7 +125,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 42, size = 2, configuration_value = 1800}) )) mock_meter:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-electric-meter/src/test/test_zwave_electric_meter.lua b/drivers/SmartThings/zwave-electric-meter/src/test/test_zwave_electric_meter.lua index 01c3227147..cc5ce67806 100644 --- a/drivers/SmartThings/zwave-electric-meter/src/test/test_zwave_electric_meter.lua +++ b/drivers/SmartThings/zwave-electric-meter/src/test/test_zwave_electric_meter.lua @@ -45,6 +45,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.powerMeter.power({ value = 27, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -64,6 +67,9 @@ test.register_message_test( direction = "send", message = mock_meter:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -93,7 +99,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-fan/src/test/test_zwave_fan_3_speed.lua b/drivers/SmartThings/zwave-fan/src/test/test_zwave_fan_3_speed.lua index 249c0ebc14..ca46560f36 100644 --- a/drivers/SmartThings/zwave-fan/src/test/test_zwave_fan_3_speed.lua +++ b/drivers/SmartThings/zwave-fan/src/test/test_zwave_fan_3_speed.lua @@ -72,6 +72,9 @@ test.register_message_test( direction = "send", message = mock_fan:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -101,6 +104,9 @@ test.register_message_test( direction = "send", message = mock_fan:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -131,6 +137,9 @@ test.register_message_test( direction = "send", message = mock_fan:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -159,6 +168,9 @@ test.register_message_test( direction = "send", message = mock_fan:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -190,7 +202,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-fan/src/test/test_zwave_fan_4_speed.lua b/drivers/SmartThings/zwave-fan/src/test/test_zwave_fan_4_speed.lua index 18aab08c73..d41c45d6c5 100644 --- a/drivers/SmartThings/zwave-fan/src/test/test_zwave_fan_4_speed.lua +++ b/drivers/SmartThings/zwave-fan/src/test/test_zwave_fan_4_speed.lua @@ -71,6 +71,9 @@ test.register_message_test( direction = "send", message = mock_fan:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -99,6 +102,9 @@ test.register_message_test( direction = "send", message = mock_fan:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -129,6 +135,9 @@ test.register_message_test( direction = "send", message = mock_fan:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -157,6 +166,9 @@ test.register_message_test( direction = "send", message = mock_fan:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -188,7 +200,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-garage-door-opener/src/test/test_ecolink_garage_door_operator.lua b/drivers/SmartThings/zwave-garage-door-opener/src/test/test_ecolink_garage_door_operator.lua index c37e99da13..d840118f70 100644 --- a/drivers/SmartThings/zwave-garage-door-opener/src/test/test_ecolink_garage_door_operator.lua +++ b/drivers/SmartThings/zwave-garage-door-opener/src/test/test_ecolink_garage_door_operator.lua @@ -67,6 +67,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.doorControl.door.closed()) } + }, + { + min_api_version = 19 } ) @@ -83,6 +86,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.doorControl.door.open()) } + }, + { + min_api_version = 19 } ) @@ -123,7 +129,8 @@ test.register_message_test( }, { test_init = test_init, - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -162,7 +169,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -183,6 +191,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 12.2999999, unit = 'C'})) } + }, + { + min_api_version = 19 } ) @@ -203,6 +214,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 45.6, unit = 'F'})) } + }, + { + min_api_version = 19 } ) @@ -228,7 +242,10 @@ test.register_coroutine_test( parameters = updated_params}) )) mock_garage_door:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -255,7 +272,10 @@ test.register_coroutine_test( BarrierOperator:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -282,7 +302,11 @@ test.register_coroutine_test( BarrierOperator:Get({}) ) ) - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -295,7 +319,11 @@ test.register_coroutine_test( ) test.wait_for_events() test.mock_time.advance_time(1) - end + end, + { + min_api_version = 19 + } + ) test.register_coroutine_test( @@ -308,7 +336,11 @@ test.register_coroutine_test( ) test.wait_for_events() test.mock_time.advance_time(1) - end + end, + { + min_api_version = 19 + } + ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-garage-door-opener/src/test/test_mimolite_garage_door.lua b/drivers/SmartThings/zwave-garage-door-opener/src/test/test_mimolite_garage_door.lua index c10d3f8fa5..6e15e55895 100644 --- a/drivers/SmartThings/zwave-garage-door-opener/src/test/test_mimolite_garage_door.lua +++ b/drivers/SmartThings/zwave-garage-door-opener/src/test/test_mimolite_garage_door.lua @@ -67,6 +67,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -88,6 +91,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -109,6 +115,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -130,6 +139,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -151,6 +163,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -172,6 +187,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -203,6 +221,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.doorControl.door.closing()) } + }, + { + min_api_version = 19 } ) @@ -234,6 +255,9 @@ test.register_message_test( direction = "send", message = mock_garage_door:generate_test_message("main", capabilities.doorControl.door.opening()) } + }, + { + min_api_version = 19 } ) @@ -261,7 +285,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -288,7 +315,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -305,7 +335,10 @@ test.register_coroutine_test( Association:Set({grouping_identifier = 3, node_ids = {}}) )) mock_garage_door:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -326,7 +359,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-garage-door-opener/src/test/test_zwave_garage_door_opener.lua b/drivers/SmartThings/zwave-garage-door-opener/src/test/test_zwave_garage_door_opener.lua index 65c0256149..9e0cd7077a 100644 --- a/drivers/SmartThings/zwave-garage-door-opener/src/test/test_zwave_garage_door_opener.lua +++ b/drivers/SmartThings/zwave-garage-door-opener/src/test/test_zwave_garage_door_opener.lua @@ -58,6 +58,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -74,6 +77,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.doorControl.door.closing()) } + }, + { + min_api_version = 19 } ) @@ -95,6 +101,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -116,6 +125,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -132,6 +144,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.doorControl.door.unknown()) } + }, + { + min_api_version = 19 } ) @@ -150,7 +165,8 @@ test.register_message_test( } }, { - test_init = test_init + test_init = test_init, + min_api_version = 19 } ) @@ -170,7 +186,8 @@ test.register_message_test( }, { test_init = test_init, - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-lock/src/apiv6_bugfix/can_handle.lua b/drivers/SmartThings/zwave-lock/src/apiv6_bugfix/can_handle.lua new file mode 100644 index 0000000000..8a9b8cc6cc --- /dev/null +++ b/drivers/SmartThings/zwave-lock/src/apiv6_bugfix/can_handle.lua @@ -0,0 +1,16 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle(opts, driver, device, cmd, ...) + local cc = require "st.zwave.CommandClass" + local WakeUp = (require "st.zwave.CommandClass.WakeUp")({ version = 1 }) + local version = require "version" + if version.api == 6 and + cmd.cmd_class == cc.WAKE_UP and + cmd.cmd_id == WakeUp.NOTIFICATION then + return true, require("apiv6_bugfix") + end + return false +end + +return can_handle diff --git a/drivers/SmartThings/zwave-lock/src/apiv6_bugfix/init.lua b/drivers/SmartThings/zwave-lock/src/apiv6_bugfix/init.lua index 0204b7b2d5..94dc5975ab 100644 --- a/drivers/SmartThings/zwave-lock/src/apiv6_bugfix/init.lua +++ b/drivers/SmartThings/zwave-lock/src/apiv6_bugfix/init.lua @@ -1,14 +1,9 @@ +-- 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 }) - -local function can_handle(opts, driver, device, cmd, ...) - local version = require "version" - return version.api == 6 and - cmd.cmd_class == cc.WAKE_UP and - cmd.cmd_id == WakeUp.NOTIFICATION -end - local function wakeup_notification(driver, device, cmd) device:refresh() end @@ -20,7 +15,7 @@ local apiv6_bugfix = { } }, NAME = "apiv6_bugfix", - can_handle = can_handle + can_handle = require("apiv6_bugfix.can_handle"), } return apiv6_bugfix diff --git a/drivers/SmartThings/zwave-lock/src/init.lua b/drivers/SmartThings/zwave-lock/src/init.lua index b83b196256..925452c431 100644 --- a/drivers/SmartThings/zwave-lock/src/init.lua +++ b/drivers/SmartThings/zwave-lock/src/init.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 local capabilities = require "st.capabilities" --- @type st.zwave.CommandClass @@ -182,13 +171,7 @@ local driver_template = { [Time.GET] = time_get_handler -- used by DanaLock } }, - sub_drivers = { - require("zwave-alarm-v1-lock"), - require("schlage-lock"), - require("samsung-lock"), - require("keywe-lock"), - require("apiv6_bugfix"), - } + sub_drivers = require("sub_drivers"), } defaults.register_for_default_handlers(driver_template, driver_template.supported_capabilities) diff --git a/drivers/SmartThings/zwave-lock/src/keywe-lock/can_handle.lua b/drivers/SmartThings/zwave-lock/src/keywe-lock/can_handle.lua new file mode 100644 index 0000000000..d8bcd5756e --- /dev/null +++ b/drivers/SmartThings/zwave-lock/src/keywe-lock/can_handle.lua @@ -0,0 +1,12 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_keywe_lock(opts, self, device, cmd, ...) + local KEYWE_MFR = 0x037B + if device.zwave_manufacturer_id == KEYWE_MFR then + return true, require("keywe-lock") + end + return false +end + +return can_handle_keywe_lock diff --git a/drivers/SmartThings/zwave-lock/src/keywe-lock/init.lua b/drivers/SmartThings/zwave-lock/src/keywe-lock/init.lua index d39aa45d1c..a51af26e00 100644 --- a/drivers/SmartThings/zwave-lock/src/keywe-lock/init.lua +++ b/drivers/SmartThings/zwave-lock/src/keywe-lock/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local cc = require "st.zwave.CommandClass" @@ -23,13 +13,8 @@ local LockDefaults = require "st.zwave.defaults.lock" local LockCodesDefaults = require "st.zwave.defaults.lockCodes" local TamperDefaults = require "st.zwave.defaults.tamperAlert" -local KEYWE_MFR = 0x037B local TAMPER_CLEAR_DELAY = 10 -local function can_handle_keywe_lock(opts, self, device, cmd, ...) - return device.zwave_manufacturer_id == KEYWE_MFR -end - local function clear_tamper_if_needed(device) local current_tamper_state = device:get_latest_state("main", capabilities.tamperAlert.ID, capabilities.tamperAlert.tamper.NAME) if current_tamper_state == "detected" then @@ -80,7 +65,7 @@ local keywe_lock = { doConfigure = do_configure }, NAME = "Keywe Lock", - can_handle = can_handle_keywe_lock, + can_handle = require("keywe-lock.can_handle"), } return keywe_lock diff --git a/drivers/SmartThings/zwave-lock/src/lazy_load_subdriver.lua b/drivers/SmartThings/zwave-lock/src/lazy_load_subdriver.lua new file mode 100644 index 0000000000..45115081e4 --- /dev/null +++ b/drivers/SmartThings/zwave-lock/src/lazy_load_subdriver.lua @@ -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 diff --git a/drivers/SmartThings/zwave-lock/src/samsung-lock/can_handle.lua b/drivers/SmartThings/zwave-lock/src/samsung-lock/can_handle.lua new file mode 100644 index 0000000000..e9222cb8fb --- /dev/null +++ b/drivers/SmartThings/zwave-lock/src/samsung-lock/can_handle.lua @@ -0,0 +1,12 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_samsung_lock(opts, self, device, cmd, ...) + local SAMSUNG_MFR = 0x022E + if device.zwave_manufacturer_id == SAMSUNG_MFR then + return true, require("samsung-lock") + end + return false +end + +return can_handle_samsung_lock diff --git a/drivers/SmartThings/zwave-lock/src/samsung-lock/init.lua b/drivers/SmartThings/zwave-lock/src/samsung-lock/init.lua index 813c6217b4..b2f4f60975 100644 --- a/drivers/SmartThings/zwave-lock/src/samsung-lock/init.lua +++ b/drivers/SmartThings/zwave-lock/src/samsung-lock/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local cc = require "st.zwave.CommandClass" @@ -28,11 +18,6 @@ local get_lock_codes = LockCodesDefaults.get_lock_codes local clear_code_state = LockCodesDefaults.clear_code_state local code_deleted = LockCodesDefaults.code_deleted -local SAMSUNG_MFR = 0x022E - -local function can_handle_samsung_lock(opts, self, device, cmd, ...) - return device.zwave_manufacturer_id == SAMSUNG_MFR -end local function get_ongoing_code_set(device) local code_id @@ -105,7 +90,7 @@ local samsung_lock = { doConfigure = do_configure }, NAME = "Samsung Lock", - can_handle = can_handle_samsung_lock, + can_handle = require("samsung-lock.can_handle"), } return samsung_lock diff --git a/drivers/SmartThings/zwave-lock/src/schlage-lock/can_handle.lua b/drivers/SmartThings/zwave-lock/src/schlage-lock/can_handle.lua new file mode 100644 index 0000000000..e9f3cfb84c --- /dev/null +++ b/drivers/SmartThings/zwave-lock/src/schlage-lock/can_handle.lua @@ -0,0 +1,12 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_schlage_lock(opts, self, device, cmd, ...) + local SCHLAGE_MFR = 0x003B + if device.zwave_manufacturer_id == SCHLAGE_MFR then + return true, require("schlage-lock") + end + return false +end + +return can_handle_schlage_lock diff --git a/drivers/SmartThings/zwave-lock/src/schlage-lock/init.lua b/drivers/SmartThings/zwave-lock/src/schlage-lock/init.lua index 67e649d869..6b22049beb 100644 --- a/drivers/SmartThings/zwave-lock/src/schlage-lock/init.lua +++ b/drivers/SmartThings/zwave-lock/src/schlage-lock/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" local cc = require "st.zwave.CommandClass" @@ -27,15 +17,10 @@ local Association = (require "st.zwave.CommandClass.Association")({version=1}) local LockCodesDefaults = require "st.zwave.defaults.lockCodes" -local SCHLAGE_MFR = 0x003B local SCHLAGE_LOCK_CODE_LENGTH_PARAM = {number = 16, size = 1} local DEFAULT_COMMANDS_DELAY = 4.2 -- seconds -local function can_handle_schlage_lock(opts, self, device, cmd, ...) - return device.zwave_manufacturer_id == SCHLAGE_MFR -end - local function set_code_length(self, device, cmd) local length = cmd.args.length if length >= 4 and length <= 8 then @@ -187,7 +172,7 @@ local schlage_lock = { doConfigure = do_configure, }, NAME = "Schlage Lock", - can_handle = can_handle_schlage_lock, + can_handle = require("schlage-lock.can_handle"), } return schlage_lock diff --git a/drivers/SmartThings/zwave-lock/src/sub_drivers.lua b/drivers/SmartThings/zwave-lock/src/sub_drivers.lua new file mode 100644 index 0000000000..46700ce154 --- /dev/null +++ b/drivers/SmartThings/zwave-lock/src/sub_drivers.lua @@ -0,0 +1,12 @@ +-- 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("zwave-alarm-v1-lock"), + lazy_load_if_possible("schlage-lock"), + lazy_load_if_possible("samsung-lock"), + lazy_load_if_possible("keywe-lock"), + lazy_load_if_possible("apiv6_bugfix"), +} +return sub_drivers diff --git a/drivers/SmartThings/zwave-lock/src/test/test_keywe_lock.lua b/drivers/SmartThings/zwave-lock/src/test/test_keywe_lock.lua index d8e8ecc1bc..b993365eef 100644 --- a/drivers/SmartThings/zwave-lock/src/test/test_keywe_lock.lua +++ b/drivers/SmartThings/zwave-lock/src/test/test_keywe_lock.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -54,7 +44,10 @@ test.register_coroutine_test( DoorLock:OperationReport({door_lock_mode = 0x00}) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lock.lock.unlocked())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -64,7 +57,10 @@ test.register_coroutine_test( DoorLock:OperationReport({door_lock_mode = 0xFF}) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lock.lock.locked())) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -96,6 +92,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({data={method="manual"}})) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-lock/src/test/test_lock_battery.lua b/drivers/SmartThings/zwave-lock/src/test/test_lock_battery.lua index 9aac02c6b2..a079009f7f 100644 --- a/drivers/SmartThings/zwave-lock/src/test/test_lock_battery.lua +++ b/drivers/SmartThings/zwave-lock/src/test/test_lock_battery.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -68,7 +58,10 @@ test.register_coroutine_test( DoorLock:OperationReport({ door_lock_mode = DoorLock.door_lock_mode.DOOR_UNSECURED }) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lock.lock.unlocked())) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -84,6 +77,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(50)) } + }, + { + min_api_version = 19 } ) @@ -100,6 +96,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -114,7 +113,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(4.2) test.socket.zwave:__expect_send(DoorLock:OperationGet({}):build_test_tx(mock_device.id)) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -132,7 +134,10 @@ test.register_coroutine_test( minute_local_time = time.min, second_local_time = time.sec }):build_test_tx(mock_device.id)) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-lock/src/test/test_samsung_lock.lua b/drivers/SmartThings/zwave-lock/src/test/test_samsung_lock.lua index 7707b8a850..4e2fb75413 100644 --- a/drivers/SmartThings/zwave-lock/src/test/test_samsung_lock.lua +++ b/drivers/SmartThings/zwave-lock/src/test/test_samsung_lock.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -59,7 +49,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["0"] = "Master Code"}), { visibility = { displayed = false } })) ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -102,7 +95,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 set", { data = { codeName = "test"}, state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -116,7 +112,10 @@ test.register_coroutine_test( }) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("2 failed", { state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -130,7 +129,10 @@ test.register_coroutine_test( }) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged(2 .. " failed", { state_change = true }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -172,7 +174,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({["0"] = "Master Code"} ), { visibility = { displayed = false } }) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-lock/src/test/test_schlage_lock.lua b/drivers/SmartThings/zwave-lock/src/test/test_schlage_lock.lua index b1a5964502..1875e043d2 100644 --- a/drivers/SmartThings/zwave-lock/src/test/test_schlage_lock.lua +++ b/drivers/SmartThings/zwave-lock/src/test/test_schlage_lock.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -85,7 +75,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 set", { data = { codeName = "test"}, state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -102,7 +95,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -118,7 +114,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockCodes.codeLength(6)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -147,7 +146,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockCodes.codeLength(4)) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +165,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({}), {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) local expect_reload_all_codes_messages = function() @@ -197,7 +202,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -222,7 +230,10 @@ test.register_coroutine_test( ) ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -246,7 +257,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-lock/src/test/test_zwave_lock.lua b/drivers/SmartThings/zwave-lock/src/test/test_zwave_lock.lua index 52144295b3..a7f920f9bb 100644 --- a/drivers/SmartThings/zwave-lock/src/test/test_zwave_lock.lua +++ b/drivers/SmartThings/zwave-lock/src/test/test_zwave_lock.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -82,7 +72,10 @@ test.register_coroutine_test( ) ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -92,7 +85,10 @@ test.register_coroutine_test( DoorLock:OperationReport({door_lock_mode = DoorLock.door_lock_mode.DOOR_SECURED}) }) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lock.lock.locked())) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -108,6 +104,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -129,6 +128,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lock.lock.locked({ data = { method = "manual" } })) } + }, + { + min_api_version = 19 } ) @@ -159,7 +161,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -182,6 +185,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -196,7 +202,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(4.2) test.socket.zwave:__expect_send(DoorLock:OperationGet({}):build_test_tx(mock_device.id)) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -212,6 +221,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.lockCodes.maxCodes(16, { visibility = { displayed = false } })) } + }, + { + min_api_version = 19 } ) @@ -220,7 +232,10 @@ test.register_coroutine_test( function() test.socket.capability:__queue_receive({ mock_device.id, { capability = capabilities.lockCodes.ID, command = "reloadAllCodes", args = {} } }) expect_reload_all_codes_messages() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -236,6 +251,9 @@ test.register_message_test( direction = "send", message = UserCode:Get({user_identifier = 1}):build_test_tx(mock_device.id) } + }, + { + min_api_version = 19 } ) @@ -249,7 +267,10 @@ test.register_coroutine_test( test.mock_time.advance_time(4.2) test.socket.zwave:__expect_send(UserCode:Get( {user_identifier = 1}):build_test_tx(mock_device.id)) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -266,7 +287,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 set", { data = { codeName = "test"}, state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) local function init_code_slot(slot_number, name, device) @@ -288,7 +312,10 @@ test.register_coroutine_test( )) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 renamed", {state_change = true}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -312,7 +339,10 @@ test.register_coroutine_test( test.mock_time.advance_time(2) test.socket.zwave:__expect_send(UserCode:Get({user_identifier = 4}):build_test_tx(mock_device.id)) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -334,6 +364,9 @@ test.register_message_test( capabilities.lockCodes.codeChanged("0 set", { data = { codeName = "Master Code"}, state_change = true }) ) } + }, + { + min_api_version = 19 } ) @@ -362,7 +395,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -384,7 +418,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({} ), { visibility = { displayed = false } }) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -424,7 +461,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.lockCodes(json.encode({} ), { visibility = { displayed = false } }) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -446,7 +486,10 @@ test.register_coroutine_test( capabilities.lock.lock.unlocked({ data = { method = "keypad", codeId = "1", codeName = "Superb Owl" } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -468,7 +511,10 @@ test.register_coroutine_test( capabilities.lock.lock.unlocked({ data = { method = "keypad", codeId = "1", codeName = "Code 1" } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -496,7 +542,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.scanCodes("Complete", { visibility = { displayed = false } }) )) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -728,6 +777,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -750,7 +802,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.lockCodes.codeChanged("1 set", { data = { codeName = "test"}, state_change = true })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -770,7 +825,10 @@ test.register_coroutine_test( ) ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-lock/src/test/test_zwave_lock_code_migration.lua b/drivers/SmartThings/zwave-lock/src/test/test_zwave_lock_code_migration.lua index e4a9b50758..7b78d3f8ef 100644 --- a/drivers/SmartThings/zwave-lock/src/test/test_zwave_lock_code_migration.lua +++ b/drivers/SmartThings/zwave-lock/src/test/test_zwave_lock_code_migration.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + -- Mock out globals local test = require "integration_test" @@ -97,7 +87,10 @@ test.register_coroutine_test( assert(mock_device.state_cache.main.lockCodes.lockCodes.value == json.encode(utils.deep_copy(lockCodes))) -- Validate migration complete flag mock_datastore.__assert_device_store_contains(mock_device.id, "migrationComplete", true) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -126,7 +119,10 @@ test.register_coroutine_test( assert(mock_device_no_data.state_cache.main.lockCodes.lockCodes.value == json.encode({})) -- Validate migration complete flag mock_datastore.__assert_device_store_contains(mock_device_no_data.id, "migrationComplete", nil) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -162,7 +158,10 @@ test.register_coroutine_test( assert(mock_device.state_cache.main.lockCodes.lockCodes.value == json.encode(utils.deep_copy(lockCodes))) -- Validate migration complete flag mock_datastore.__assert_device_store_contains(mock_device.id, "migrationComplete", true) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -207,7 +206,10 @@ test.register_coroutine_test( assert(mock_device_no_data.state_cache.main.lockCodes.lockCodes.value == json.encode(utils.deep_copy(lockCodes))) -- Validate migration complete flag mock_datastore.__assert_device_store_contains(mock_device_no_data.id, "migrationComplete", true) - end + end, + { + min_api_version = 19 + } ) @@ -240,7 +242,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(35) -- Nothing should happen - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/can_handle.lua b/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/can_handle.lua new file mode 100644 index 0000000000..7bb54f23f2 --- /dev/null +++ b/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/can_handle.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_v1_alarm(opts, driver, device, cmd, ...) + if opts.dispatcher_class == "ZwaveDispatcher" and cmd ~= nil and cmd.version ~= nil and cmd.version == 1 then + return true, require("zwave-alarm-v1-lock") + end + return false +end + +return can_handle_v1_alarm diff --git a/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/init.lua b/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/init.lua index 44d978999b..d7c862f22a 100644 --- a/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/init.lua +++ b/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" --- @type st.zwave.CommandClass @@ -35,9 +25,6 @@ local METHOD = { --- @param driver st.zwave.Driver --- @param device st.zwave.Device --- @return boolean true if the device is smoke co alarm -local function can_handle_v1_alarm(opts, driver, device, cmd, ...) - return opts.dispatcher_class == "ZwaveDispatcher" and cmd ~= nil and cmd.version ~= nil and cmd.version == 1 -end --- Default handler for alarm command class reports, these were largely OEM-defined --- @@ -159,7 +146,7 @@ local zwave_lock = { } }, NAME = "Z-Wave lock alarm V1", - can_handle = can_handle_v1_alarm, + can_handle = require("zwave-alarm-v1-lock.can_handle"), } return zwave_lock diff --git a/drivers/SmartThings/zwave-mouse-trap/src/test/test_zwave_mouse_trap.lua b/drivers/SmartThings/zwave-mouse-trap/src/test/test_zwave_mouse_trap.lua index 3e973a14f8..2665af2562 100644 --- a/drivers/SmartThings/zwave-mouse-trap/src/test/test_zwave_mouse_trap.lua +++ b/drivers/SmartThings/zwave-mouse-trap/src/test/test_zwave_mouse_trap.lua @@ -65,6 +65,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.pestExterminated()) } + }, + { + min_api_version = 19 } ) @@ -84,6 +87,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.idle()) } + }, + { + min_api_version = 19 } ) @@ -103,6 +109,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.trapArmed()) } + }, + { + min_api_version = 19 } ) @@ -122,6 +131,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.trapArmed()) } + }, + { + min_api_version = 19 } ) @@ -141,6 +153,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.trapRearmRequired()) } + }, + { + min_api_version = 19 } ) @@ -160,6 +175,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.pestDetected()) } + }, + { + min_api_version = 19 } ) @@ -179,6 +197,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.pestDetected()) } + }, + { + min_api_version = 19 } ) @@ -198,6 +219,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.pestExterminated()) } + }, + { + min_api_version = 19 } ) @@ -217,6 +241,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.pestControl.pestControl.idle()) } + }, + { + min_api_version = 19 } ) @@ -233,6 +260,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.battery.battery(85)) } + }, + { + min_api_version = 19 } ) @@ -249,6 +279,9 @@ test.register_message_test( direction = "send", message = mock_mouse_trap:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -300,7 +333,10 @@ test.register_coroutine_test( ) ) mock_mouse_trap:expect_metadata_update({provisioning_state = "PROVISIONED"}) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_aeon_multisensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_aeon_multisensor.lua index 2d83fd6e25..8920de60d4 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_aeon_multisensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_aeon_multisensor.lua @@ -15,7 +15,9 @@ local test = require "integration_test" local zw = require "st.zwave" local zw_test_utils = require "integration_test.zwave_test_utils" +local capabilities = require "st.capabilities" local Configuration = (require "st.zwave.CommandClass.Configuration")({ version = 1 }) +local Notification = (require "st.zwave.CommandClass.Notification")({ version = 3 }) local SensorBinary = (require "st.zwave.CommandClass.SensorBinary")({ version = 2 }) local SensorMultilevel = (require "st.zwave.CommandClass.SensorMultilevel")({ version = 5 }) local Battery = (require "st.zwave.CommandClass.Battery")({ version = 1 }) @@ -89,7 +91,35 @@ test.register_coroutine_test( SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.RELATIVE_HUMIDITY}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Notification HOME_SECURITY MOTION_DETECTION should be handled as motion active", + { + { + channel = "zwave", + direction = "receive", + message = { + mock_sensor.id, + zw_test_utils.zwave_test_build_receive_command(Notification:Report({ + notification_type = Notification.notification_type.HOME_SECURITY, + event = Notification.event.home_security.MOTION_DETECTION + })) + } + }, + { + channel = "capability", + direction = "send", + message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) + } + }, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_6.lua b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_6.lua index 02c2adf751..b47c111ccb 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_6.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_6.lua @@ -116,7 +116,10 @@ test.register_coroutine_test( SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.ULTRAVIOLET}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -164,7 +167,10 @@ test.register_coroutine_test( )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Configuration value should be updated and device refreshed, when wakeup notification received", @@ -233,7 +239,10 @@ test.register_coroutine_test( Configuration:Get({parameter_number = 9}) )) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -252,6 +261,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.ultravioletIndex.ultravioletIndex({value = 10})) } + }, + { + min_api_version = 19 } ) @@ -284,6 +296,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.powerSource.powerSource.dc()) } + }, + { + min_api_version = 19 } ) @@ -316,6 +331,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.powerSource.powerSource.battery()) } + }, + { + min_api_version = 19 } ) @@ -335,6 +353,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -356,7 +377,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -389,7 +413,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -410,7 +437,35 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) ) - end + end, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Notification HOME_SECURITY MOTION_DETECTION should be handled as motion active", + { + { + channel = "zwave", + direction = "receive", + message = { + mock_sensor.id, + zw_test_utils.zwave_test_build_receive_command(Notification:Report({ + notification_type = Notification.notification_type.HOME_SECURITY, + event = Notification.event.home_security.MOTION_DETECTION + })) + } + }, + { + channel = "capability", + direction = "send", + message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) + } + }, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_7.lua b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_7.lua index 7fd57e42b2..8e3a7bacbc 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_7.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_7.lua @@ -118,7 +118,10 @@ test.register_coroutine_test( )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -164,7 +167,10 @@ test.register_coroutine_test( SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.ULTRAVIOLET}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Configuration value should be updated and device refreshed, when wakeup notification received", @@ -231,7 +237,10 @@ test.register_coroutine_test( mock_sensor, SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.ULTRAVIOLET}) )) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -250,6 +259,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.ultravioletIndex.ultravioletIndex({value = 10})) } + }, + { + min_api_version = 19 } ) @@ -282,6 +294,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.powerSource.powerSource.dc()) } + }, + { + min_api_version = 19 } ) @@ -314,6 +329,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.powerSource.powerSource.battery()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_gen5.lua b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_gen5.lua index 3b73ff17c3..0bf4463038 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_gen5.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_multisensor_gen5.lua @@ -106,7 +106,10 @@ test.register_coroutine_test( SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.RELATIVE_HUMIDITY}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_water_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_water_sensor.lua index 8af011f51f..9f58a62200 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_water_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_water_sensor.lua @@ -86,7 +86,10 @@ test.register_coroutine_test( Association:Set({grouping_identifier = 4, node_ids = {}}) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -102,6 +105,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -118,6 +124,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -137,6 +146,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -156,6 +168,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -175,6 +190,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -194,6 +212,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -210,6 +231,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -229,6 +253,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -248,6 +275,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -267,6 +297,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -286,6 +319,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_water_sensor_7.lua b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_water_sensor_7.lua index a5f44ff12e..3e892f19b7 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_water_sensor_7.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_aeotec_water_sensor_7.lua @@ -60,6 +60,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -79,6 +82,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -98,6 +104,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -117,6 +126,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -136,6 +148,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -161,7 +176,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(10) test.socket.capability:__expect_send(mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_enerwave_motion_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_enerwave_motion_sensor.lua index a90655669d..0e3e914200 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_enerwave_motion_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_enerwave_motion_sensor.lua @@ -61,7 +61,10 @@ test.register_coroutine_test( Association:Set({grouping_identifier = 1, node_ids = {}}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -81,7 +84,10 @@ test.register_coroutine_test( mock_sensor, Battery:Get({}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -100,7 +106,10 @@ test.register_coroutine_test( WakeUp:IntervalGet({}) )) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_everpsring_sp817.lua b/drivers/SmartThings/zwave-sensor/src/test/test_everpsring_sp817.lua index 45e0672c11..0ff3acfa69 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_everpsring_sp817.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_everpsring_sp817.lua @@ -59,7 +59,10 @@ test.register_coroutine_test( Battery:Get({}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -93,7 +96,10 @@ test.register_coroutine_test( mock_sensor, Battery:Get({}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_everspring_PIR_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_everspring_PIR_sensor.lua index 1cb2735a31..d1cbf5acc0 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_everspring_PIR_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_everspring_PIR_sensor.lua @@ -66,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -86,6 +89,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -110,7 +116,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(10) test.socket.capability:__expect_send(mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -129,6 +138,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -149,6 +161,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -196,7 +211,10 @@ test.register_coroutine_test( mock_sensor, Battery:Get({}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_everspring_ST814.lua b/drivers/SmartThings/zwave-sensor/src/test/test_everspring_ST814.lua index 097016fc81..2aa22d6ba7 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_everspring_ST814.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_everspring_ST814.lua @@ -58,7 +58,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 8, size = 1, configuration_value = 5}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_everspring_illuminance_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_everspring_illuminance_sensor.lua index 04103db0db..16ec8edf5b 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_everspring_illuminance_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_everspring_illuminance_sensor.lua @@ -62,7 +62,10 @@ test.register_coroutine_test( Battery:Get({}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_everspring_motion_light_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_everspring_motion_light_sensor.lua index 17a627a736..9de9b2c345 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_everspring_motion_light_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_everspring_motion_light_sensor.lua @@ -75,7 +75,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_ezmultipli_multipurpose_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_ezmultipli_multipurpose_sensor.lua index 74b6d6196c..62cb1a8f38 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_ezmultipli_multipurpose_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_ezmultipli_multipurpose_sensor.lua @@ -60,6 +60,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -86,6 +89,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -121,7 +127,11 @@ do mock_device, SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.RED }) )) - end + end, + { + min_api_version = 19 + } + ) end @@ -157,7 +167,11 @@ do mock_device, SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.RED }) )) - end + end, + { + min_api_version = 19 + } + ) end @@ -287,7 +301,10 @@ test.register_coroutine_test( ) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor.lua index 248c22ab60..bbd566526a 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor.lua @@ -82,7 +82,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -104,7 +105,10 @@ test.register_coroutine_test( SensorBinary:Get({}) )) mock_fibaro_door_window_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -120,6 +124,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -139,6 +146,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -158,6 +168,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -178,6 +191,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -197,6 +213,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_1.lua b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_1.lua index 6904f318a9..0c96a97492 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_1.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_1.lua @@ -130,7 +130,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -217,7 +218,10 @@ test.register_coroutine_test( Association:Remove({grouping_identifier = 1, node_ids = {}}) )) mock_fibaro_door_window_sensor1:expect_metadata_update({provisioning_state = "PROVISIONED"}) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -233,6 +237,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor1:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -252,6 +259,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor1:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -271,6 +281,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor1:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -295,6 +308,9 @@ test.register_message_test( { device_uuid = mock_fibaro_door_window_sensor1.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -319,6 +335,9 @@ test.register_message_test( { device_uuid = mock_fibaro_door_window_sensor1.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -338,6 +357,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor1:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -356,6 +378,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor1:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -384,6 +409,9 @@ test.register_message_test( { device_uuid = mock_fibaro_door_window_sensor1.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -411,6 +439,9 @@ test.register_message_test( { device_uuid = mock_fibaro_door_window_sensor1.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_2.lua b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_2.lua index bc78bd02ca..1da107f5e9 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_2.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_2.lua @@ -67,6 +67,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -86,6 +89,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -105,6 +111,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -124,6 +133,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -143,6 +155,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) } + }, + { + min_api_version = 19 } ) @@ -162,6 +177,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) } + }, + { + min_api_version = 19 } ) @@ -181,6 +199,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.freeze()) } + }, + { + min_api_version = 19 } ) @@ -295,7 +316,10 @@ test.register_coroutine_test( mock_fibaro_door_window_sensor, SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.TEMPERATURE}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -333,7 +357,10 @@ test.register_coroutine_test( mock_fibaro_door_window_sensor, SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.TEMPERATURE}) )) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -366,6 +393,9 @@ test.register_message_test( direction = "receive", message = {mock_fibaro_door_window_sensor.id, "added"} } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_with_temperature.lua b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_with_temperature.lua index 2b27d66868..9b9a83406e 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_with_temperature.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_door_window_sensor_with_temperature.lua @@ -94,7 +94,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -120,7 +121,10 @@ test.register_coroutine_test( SensorBinary:Get({}) )) mock_fibaro_door_window_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -136,6 +140,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -155,6 +162,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -174,6 +184,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -194,6 +207,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -213,6 +229,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_door_window_sensor:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -241,6 +260,9 @@ test.register_message_test( { device_uuid = mock_fibaro_door_window_sensor.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -268,6 +290,9 @@ test.register_message_test( { device_uuid = mock_fibaro_door_window_sensor.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -542,7 +567,10 @@ test.register_coroutine_test( mock_fibaro_door_window_sensor.id, Configuration:Report({ parameter_number = 56, configuration_value = 40 }) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_flood_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_flood_sensor.lua index 7a9743a69e..65a8621b75 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_flood_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_flood_sensor.lua @@ -20,6 +20,8 @@ local Basic = (require "st.zwave.CommandClass.Basic")({ version = 1 }) local SensorAlarm = (require "st.zwave.CommandClass.SensorAlarm")({ version = 1 }) local SensorBinary = (require "st.zwave.CommandClass.SensorBinary")({ version = 2 }) local SensorMultilevel = (require "st.zwave.CommandClass.SensorMultilevel")({ version = 5 }) +local Configuration = (require "st.zwave.CommandClass.Configuration")({ version = 4 }) +local Association = (require "st.zwave.CommandClass.Association")({ version = 1 }) local t_utils = require "integration_test.utils" local sensor_endpoints = { @@ -60,6 +62,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -76,6 +81,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -94,6 +102,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -112,6 +123,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -139,6 +153,9 @@ test.register_message_test( { device_uuid = mock_sensor.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -158,6 +175,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -177,6 +197,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -201,7 +224,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(30) test.socket.capability:__expect_send(mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -225,7 +251,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(30) test.socket.capability:__expect_send(mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -249,7 +278,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(30) test.socket.capability:__expect_send(mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -273,8 +305,41 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(30) test.socket.capability:__expect_send(mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) +test.register_coroutine_test( + "doConfigure should call initial_configuration and preferences for non-wakeup device", + function () + test.socket.zwave:__set_channel_ordering("relaxed") + test.socket.device_lifecycle:__queue_receive({ mock_sensor.id, "doConfigure" }) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_sensor, + Configuration:Set({ parameter_number = 74, configuration_value = 3, size = 1 }) + ) + ) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_sensor, + Association:Set({ grouping_identifier = 2, node_ids = {} }) + ) + ) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_sensor, + Association:Set({ grouping_identifier = 3, node_ids = {} }) + ) + ) + mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) + end, + { + min_api_version = 19 + } +) + test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_flood_sensor_zw5.lua b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_flood_sensor_zw5.lua index 45cde29b8f..2a6a6e8074 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_flood_sensor_zw5.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_flood_sensor_zw5.lua @@ -90,7 +90,10 @@ test.register_coroutine_test( mock_sensor, Configuration:Set({parameter_number = 77, size = 1, configuration_value = 2}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_motion_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_motion_sensor.lua index 24a7f31eaf..6383359cd3 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_motion_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_motion_sensor.lua @@ -95,7 +95,10 @@ test.register_coroutine_test( SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.LUMINANCE, scale = SensorMultilevel.scale.luminance.LUX}) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -111,6 +114,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -135,6 +141,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -154,6 +163,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -173,6 +185,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active()) } + }, + { + min_api_version = 19 } ) @@ -192,6 +207,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.inactive()) } + }, + { + min_api_version = 19 } ) @@ -211,6 +229,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.accelerationSensor.acceleration.active()) } + }, + { + min_api_version = 19 } ) @@ -231,6 +252,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 400, unit = "lux" })) } + }, + { + min_api_version = 19 } ) @@ -250,6 +274,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -269,6 +296,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -293,6 +323,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -321,6 +354,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -348,6 +384,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_motion_sensor_zw5.lua b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_motion_sensor_zw5.lua index e514a2f2e5..0c8413e23a 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_motion_sensor_zw5.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_fibaro_motion_sensor_zw5.lua @@ -77,7 +77,10 @@ test.register_coroutine_test( capabilities.threeAxis.threeAxis({value = {200, 200, 400}, unit = 'mG'}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -213,7 +216,10 @@ test.register_coroutine_test( mock_sensor, SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.ACCELERATION_Z_AXIS, scale = SensorMultilevel.scale.acceleration_z_axis.METERS_PER_SQUARE_SECOND}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_firmware_version.lua b/drivers/SmartThings/zwave-sensor/src/test/test_firmware_version.lua index 9790b5cfb5..7744b12ccf 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_firmware_version.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_firmware_version.lua @@ -17,6 +17,7 @@ local test = require "integration_test" local cc = require "st.zwave.CommandClass" local zw_test_utils = require "integration_test.zwave_test_utils" local t_utils = require "integration_test.utils" +local capabilities = require "st.capabilities" --- @type st.zwave.CommandClass.Version local Version = (require "st.zwave.CommandClass.Version")({ version = 1 }) --- @type st.zwave.CommandClass.WakeUp @@ -84,8 +85,48 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) -test.run_registered_tests() \ No newline at end of file +test.register_message_test( + "Version:Report should emit firmwareUpdate.currentVersion", + { + { + channel = "zwave", + direction = "receive", + message = { mock_device.id, zw_test_utils.zwave_test_build_receive_command(Version:Report({ + application_version = 1, + application_sub_version = 5, + })) } + }, + { + channel = "capability", + direction = "send", + message = mock_device:generate_test_message("main", capabilities.firmwareUpdate.currentVersion({ value = "1.05" })) + } + }, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "added lifecycle event should emit initial state and request firmware version", + function () + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + test.socket.capability:__expect_send( + mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) + ) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command(mock_device, Version:Get({})) + ) + end, + { + min_api_version = 19 + } +) + +test.run_registered_tests() + diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_generic_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_generic_sensor.lua index e6fff57b0d..878d36dd04 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_generic_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_generic_sensor.lua @@ -71,6 +71,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.atmosphericPressureMeasurement.atmosphericPressure({ value = 101.3, unit = "kPa" })) } + }, + { + min_api_version = 19 } ) @@ -91,6 +94,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.atmosphericPressureMeasurement.atmosphericPressure({ value = 30.13 * KILO_PASCAL_PER_INCH_OF_MERCURY, unit = "kPa" })) } + }, + { + min_api_version = 19 } ) @@ -110,6 +116,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.bodyWeightMeasurement.bodyWeightMeasurement({ value = 60, unit = "kg" })) } + }, + { + min_api_version = 19 } ) @@ -130,6 +139,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.bodyWeightMeasurement.bodyWeightMeasurement({ value = 120, unit = "lbs" })) } + }, + { + min_api_version = 19 } ) @@ -150,6 +162,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 700, unit = "lux" })) } + }, + { + min_api_version = 19 } ) @@ -169,6 +184,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 70 })) } + }, + { + min_api_version = 19 } ) @@ -197,6 +215,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -225,6 +246,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -244,6 +268,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.voltageMeasurement.voltage({ value = 5, unit = "V" })) } + }, + { + min_api_version = 19 } ) @@ -264,6 +291,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.voltageMeasurement.voltage({ value = 0.005, unit = "V" })) } + }, + { + min_api_version = 19 } ) @@ -291,6 +321,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -319,6 +352,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -338,6 +374,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 50, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -357,6 +396,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 50, unit = "kVAh" })) } + }, + { + min_api_version = 19 } ) @@ -378,6 +420,9 @@ test.register_message_test( direction = "send", message = zw_test_utils.zwave_test_build_send_command(mock_device, Meter:Get({ scale = Meter.scale.electric_meter.KILOWATT_HOURS })) } + }, + { + min_api_version = 19 } ) @@ -419,6 +464,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -460,6 +508,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -479,6 +530,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -498,6 +552,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -522,6 +579,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -546,6 +606,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -637,6 +700,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -728,6 +794,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) }, + }, + { + min_api_version = 19 } ) @@ -747,6 +816,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -766,6 +838,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -785,6 +860,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.tested()) } + }, + { + min_api_version = 19 } ) @@ -804,6 +882,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -823,6 +904,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -842,6 +926,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -861,6 +948,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -880,6 +970,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -899,6 +992,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -918,6 +1014,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -937,6 +1036,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -956,6 +1058,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -975,6 +1080,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -1006,7 +1114,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1026,6 +1135,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -1045,6 +1157,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -1064,6 +1179,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -1090,7 +1208,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1110,6 +1229,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -1129,6 +1251,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -1148,6 +1273,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -1167,6 +1295,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -1186,6 +1317,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -1205,6 +1339,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -1224,6 +1361,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -1243,6 +1383,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -1262,6 +1405,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -1281,6 +1427,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -1300,6 +1449,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -1319,6 +1471,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -1338,6 +1493,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -1356,6 +1514,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(55)) } + }, + { + min_api_version = 19 } ) @@ -1374,6 +1535,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -1393,7 +1557,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(10) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command(mock_device, Battery:Get({}))) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -1412,6 +1579,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -1431,6 +1601,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(0)) } + }, + { + min_api_version = 19 } ) @@ -1559,7 +1732,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_glentronics_water_leak_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_glentronics_water_leak_sensor.lua index 747c4cbce1..b4a78440be 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_glentronics_water_leak_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_glentronics_water_leak_sensor.lua @@ -78,6 +78,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) } + }, + { + min_api_version = 19 } ) @@ -100,6 +103,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.battery()) } + }, + { + min_api_version = 19 } ) @@ -122,6 +128,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerSource.powerSource.mains()) } + }, + { + min_api_version = 19 } ) @@ -144,6 +153,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -166,6 +178,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(100)) } + }, + { + min_api_version = 19 } ) @@ -189,6 +204,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -212,6 +230,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_homeseer_multi_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_homeseer_multi_sensor.lua index f57bfe7950..c368d47649 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_homeseer_multi_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_homeseer_multi_sensor.lua @@ -59,6 +59,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -75,6 +78,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -94,6 +100,9 @@ test.register_message_test( WakeUp:IntervalSet({node_id = 0x00, seconds = 1200}) ) } + }, + { + min_api_version = 19 } ) @@ -136,7 +145,10 @@ test.register_coroutine_test( mock_sensor, SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.LUMINANCE}, {dst_channels={2}}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Receiving wakeup notification should generate proper messages", @@ -164,6 +176,9 @@ test.register_coroutine_test( mock_sensor, Battery:Get({}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_no_wakeup_poll.lua b/drivers/SmartThings/zwave-sensor/src/test/test_no_wakeup_poll.lua index 9818f1422c..f6de3d99fc 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_no_wakeup_poll.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_no_wakeup_poll.lua @@ -109,8 +109,10 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_sensative_strip.lua b/drivers/SmartThings/zwave-sensor/src/test/test_sensative_strip.lua index 873909df23..583f33825f 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_sensative_strip.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_sensative_strip.lua @@ -69,7 +69,10 @@ test.register_coroutine_test( Configuration:Get({ parameter_number = 12 }) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -77,7 +80,10 @@ test.register_coroutine_test( function() test.socket.zwave:__queue_receive({mock_sensor.id, Configuration:Report( { configuration_value = 0x00, parameter_number = 12 } )}) mock_sensor:expect_metadata_update({ profile = "illuminance-temperature" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -96,7 +102,10 @@ test.register_coroutine_test( test.socket.zwave:__queue_receive({mock_sensor.id, Configuration:Report( { configuration_value = 0x00, parameter_number = 12 } )}) mock_sensor:expect_metadata_update({ profile = "illuminance-temperature" }) test.socket.zwave:__queue_receive({mock_sensor.id, WakeUp:Notification({})}) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_smartthings_water_leak_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_smartthings_water_leak_sensor.lua index 2321b5bd09..b7bda766f8 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_smartthings_water_leak_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_smartthings_water_leak_sensor.lua @@ -67,7 +67,10 @@ test.register_coroutine_test( SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.TEMPERATURE, scale = SensorMultilevel.scale.temperature.CELSIUS }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -86,6 +89,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -105,6 +111,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -124,6 +133,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -143,6 +155,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -162,6 +177,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -181,6 +199,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -209,6 +230,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -237,6 +261,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -253,6 +280,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -269,6 +299,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -285,6 +318,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_v1_contact_event.lua b/drivers/SmartThings/zwave-sensor/src/test/test_v1_contact_event.lua index 866508e3d6..12bb282ea6 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_v1_contact_event.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_v1_contact_event.lua @@ -65,6 +65,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -89,6 +92,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -106,7 +112,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected())) test.mock_time.advance_time(10) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_vision_motion_detector.lua b/drivers/SmartThings/zwave-sensor/src/test/test_vision_motion_detector.lua index e1b82a6b38..f415cae9e8 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_vision_motion_detector.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_vision_motion_detector.lua @@ -66,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -85,6 +88,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -104,6 +110,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -123,6 +132,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -160,7 +172,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -182,7 +195,10 @@ test.register_coroutine_test( SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.TEMPERATURE}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_zooz_4_in_1_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_zooz_4_in_1_sensor.lua index 1bef24c5d6..c2970daac4 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_zooz_4_in_1_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_zooz_4_in_1_sensor.lua @@ -61,6 +61,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -81,6 +84,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -105,7 +111,10 @@ test.register_coroutine_test( test.wait_for_events() test.mock_time.advance_time(10) test.socket.capability:__expect_send(mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear())) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -124,6 +133,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -144,6 +156,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -162,6 +177,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({value = 131, unit = "lux"})) } + }, + { + min_api_version = 19 } ) @@ -182,6 +200,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 80.25, unit = "F"})) } + }, + { + min_api_version = 19 } ) @@ -201,6 +222,9 @@ test.register_message_test( direction = "send", message = mock_sensor:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 53 })) } + }, + { + min_api_version = 19 } ) @@ -224,7 +248,29 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 + } +) + +test.register_message_test( + "Sensor multilevel luminance report with value=0 uses default lux conversion", + { + { + channel = "zwave", + direction = "receive", + message = { mock_sensor.id, zw_test_utils.zwave_test_build_receive_command(SensorMultilevel:Report({ + sensor_type = SensorMultilevel.sensor_type.LUMINANCE, + sensor_value = 0 })) } + }, + { + channel = "capability", + direction = "send", + message = mock_sensor:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({value = 0, unit = "lux"})) + } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_zwave_motion_light_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_zwave_motion_light_sensor.lua index 4ff11090c9..282ddd9f38 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_zwave_motion_light_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_zwave_motion_light_sensor.lua @@ -67,6 +67,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -91,6 +94,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -110,6 +116,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -128,6 +137,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -147,6 +159,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -166,6 +181,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 400, unit = "lux" })) } + }, + { + min_api_version = 19 } ) @@ -186,6 +204,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -205,6 +226,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -229,6 +253,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -274,7 +301,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -287,7 +315,10 @@ test.register_coroutine_test( test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command(mock_device, SensorBinary:Get({sensor_type = SensorBinary.sensor_type.MOTION}))) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command(mock_device, SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.LUMINANCE, scale = SensorMultilevel.scale.luminance.LUX}))) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_zwave_motion_temp_light_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_zwave_motion_temp_light_sensor.lua index d918f47179..d9351267dc 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_zwave_motion_temp_light_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_zwave_motion_temp_light_sensor.lua @@ -63,6 +63,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -87,6 +90,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -106,6 +112,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -125,6 +134,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -144,6 +156,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 400, unit = "lux" })) } + }, + { + min_api_version = 19 } ) @@ -163,6 +178,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -182,6 +200,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -206,6 +227,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -231,7 +255,10 @@ test.register_coroutine_test( SensorMultilevel:Get({sensor_type = SensorMultilevel.sensor_type.LUMINANCE, scale = SensorMultilevel.scale.luminance.LUX}) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_zwave_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_zwave_sensor.lua index a390c35db9..97fc162405 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_zwave_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_zwave_sensor.lua @@ -139,6 +139,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -241,7 +244,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -276,6 +280,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -295,6 +302,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -314,6 +324,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -333,6 +346,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -351,6 +367,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -369,6 +388,9 @@ test.register_message_test( direction = "send", message = mock_motion_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -397,6 +419,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -421,6 +446,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -440,6 +468,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -459,6 +490,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 22 })) } + }, + { + min_api_version = 19 } ) @@ -478,6 +512,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 400, unit = "lux" })) } + }, + { + min_api_version = 19 } ) @@ -497,6 +534,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -516,6 +556,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -535,6 +578,9 @@ test.register_message_test( direction = "send", message = mock_contact_device:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -564,6 +610,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -583,6 +632,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -602,6 +654,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -626,6 +681,9 @@ test.register_message_test( { device_uuid = mock_motion_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -650,6 +708,9 @@ test.register_message_test( { device_uuid = mock_water_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -674,6 +735,9 @@ test.register_message_test( { device_uuid = mock_contact_device.id, capability_id = "switch", capability_attr_id = "switch" } } } + }, + { + min_api_version = 19 } ) @@ -693,6 +757,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.moldHealthConcern.moldHealthConcern.unhealthy()) } + }, + { + min_api_version = 19 } ) @@ -712,6 +779,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.moldHealthConcern.moldHealthConcern.good()) } + }, + { + min_api_version = 19 } ) @@ -732,6 +802,51 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.dewPoint.dewpoint({value = 8, unit = "C"})) } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Basic Set value=0 for contact sensor should emit contact.closed", + { + { + channel = "zwave", + direction = "receive", + message = { mock_contact_device.id, zw_test_utils.zwave_test_build_receive_command(Basic:Set({ + value = 0 + })) } + }, + { + channel = "capability", + direction = "send", + message = mock_contact_device:generate_test_message("main", capabilities.contactSensor.contact.closed()) + } + }, + { + min_api_version = 19 + } +) + +test.register_message_test( + "Basic Set value=0 for motion sensor should emit motion.inactive", + { + { + channel = "zwave", + direction = "receive", + message = { mock_motion_device.id, zw_test_utils.zwave_test_build_receive_command(Basic:Set({ + value = 0 + })) } + }, + { + channel = "capability", + direction = "send", + message = mock_motion_device:generate_test_message("main", capabilities.motionSensor.motion.inactive()) + } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-sensor/src/test/test_zwave_water_sensor.lua b/drivers/SmartThings/zwave-sensor/src/test/test_zwave_water_sensor.lua index e6caf1f07c..e3bff3fc83 100644 --- a/drivers/SmartThings/zwave-sensor/src/test/test_zwave_water_sensor.lua +++ b/drivers/SmartThings/zwave-sensor/src/test/test_zwave_water_sensor.lua @@ -65,7 +65,10 @@ test.register_coroutine_test( WakeUp:IntervalSet({ seconds = 14400, node_id = 0}) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -81,6 +84,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -97,6 +103,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -116,6 +125,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -135,6 +147,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -154,6 +169,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -173,6 +191,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -189,6 +210,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -208,6 +232,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -227,6 +254,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -246,6 +276,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -265,6 +298,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-siren/src/aeotec-doorbell-siren/init.lua b/drivers/SmartThings/zwave-siren/src/aeotec-doorbell-siren/init.lua index 35f006e94f..716c46186e 100644 --- a/drivers/SmartThings/zwave-siren/src/aeotec-doorbell-siren/init.lua +++ b/drivers/SmartThings/zwave-siren/src/aeotec-doorbell-siren/init.lua @@ -33,7 +33,6 @@ local BUTTON_BATTERY_NORMAL = 99 local DEVICE_PROFILE_CHANGE_IN_PROGRESS = "device_profile_change_in_progress" local NEXT_BUTTON_BATTERY_EVENT_DETAILS = "next_button_battery_event_details" - local function querySoundStatus(device) for endpoint = 2, NUMBER_OF_SOUND_COMPONENTS do device:send_to_component(Basic:Get({}), "sound"..endpoint) @@ -208,6 +207,7 @@ local function changeDeviceProfileIfNeeded(device, endpoint) end end +-- Note that endpoint should be a number not a dst_channels table. local function setActiveEndpoint(device, endpoint) if (endpoint) then device:set_field(LAST_TRIGGERED_ENDPOINT, endpoint, {persist = true}) @@ -271,20 +271,22 @@ end local function alarmChimeOnOff(device, command, newValue) if (device and command and newValue) then + -- Note that zwave/device.lua send_to_component expects the component_to_endpoint function to + -- return a dst_channels table, not a single endpoint number local endpoint = component_to_endpoint(device, command.component) - device:send(Basic:Set({value = newValue})):to_endpoint(endpoint) + device:send_to_component(Basic:Set({value = newValue}), command.component) if (newValue == ON) then - setActiveEndpoint(endpoint) + setActiveEndpoint(device, endpoint[1]) end end end -local function alarm_chime_on(device, command) +local function alarm_chime_on(self, device, command) resetActiveEndpoint(device) alarmChimeOnOff(device, command, ON) end -local function alarm_chime_off(device, command) +local function alarm_chime_off(self, device, command) alarmChimeOnOff(device, command, OFF) end @@ -306,6 +308,9 @@ local aeotec_doorbell_siren = { [Notification.REPORT] = notification_report_handler } }, + -- This typo is a bug. There are many unit tests that fail, when + -- it is enabled, and it is not clear what the correct functionality is + -- without real device testing. capabilities_handlers = { [capabilities.refresh.ID] = { [capabilities.refresh.commands.refresh.NAME] = do_refresh diff --git a/drivers/SmartThings/zwave-siren/src/test/test_aeon_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_aeon_siren.lua index 34cdc4ceea..c00f572e25 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_aeon_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_aeon_siren.lua @@ -54,6 +54,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -77,6 +80,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -105,7 +111,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -133,7 +142,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) @@ -162,7 +174,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -190,7 +205,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -218,7 +236,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -242,7 +263,10 @@ test.register_coroutine_test( mock_siren, Basic:Set({value=0x00}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -267,7 +291,10 @@ test.register_coroutine_test( mock_siren, Basic:Set({value=0x00}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -293,7 +320,10 @@ test.register_coroutine_test( mock_siren, Basic:Set({value=0x00}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-siren/src/test/test_aeotec_doorbell_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_aeotec_doorbell_siren.lua index 924ef4e4f2..b307e921f7 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_aeotec_doorbell_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_aeotec_doorbell_siren.lua @@ -111,7 +111,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("main", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -146,7 +149,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("sound2", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -181,7 +187,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("sound3", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -216,7 +225,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("sound4", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -251,7 +263,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("sound5", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -286,7 +301,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("sound6", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -321,7 +339,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("sound7", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -356,7 +377,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("sound8", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -399,7 +423,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -443,7 +468,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -487,7 +513,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -531,7 +558,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -575,7 +603,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -619,7 +648,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -663,7 +693,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -707,7 +738,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -745,7 +777,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -782,7 +817,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -819,7 +857,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -856,7 +897,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -893,7 +937,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -930,7 +977,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -967,7 +1017,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1004,7 +1057,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1041,7 +1097,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1078,7 +1137,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1115,7 +1177,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1152,7 +1217,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1189,7 +1257,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1226,7 +1297,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1263,7 +1337,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1300,7 +1377,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1337,7 +1417,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1374,7 +1457,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1411,7 +1497,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1448,7 +1537,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1485,7 +1577,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1522,7 +1617,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1559,7 +1657,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1596,7 +1697,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1633,7 +1737,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1670,7 +1777,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1707,7 +1817,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1744,7 +1857,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1781,7 +1897,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1818,7 +1937,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1855,7 +1977,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1892,7 +2017,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1929,7 +2057,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1966,7 +2097,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2003,7 +2137,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2040,7 +2177,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2077,7 +2217,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2114,7 +2257,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2151,7 +2297,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2188,7 +2337,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2225,7 +2377,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2262,7 +2417,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2299,7 +2457,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2336,7 +2497,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2373,7 +2537,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2410,7 +2577,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2447,7 +2617,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2484,7 +2657,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -2505,7 +2681,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -2527,7 +2704,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -2558,7 +2736,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2571,7 +2752,10 @@ test.register_coroutine_test( _preferences.configureSoundAndVolume = false test.socket.device_lifecycle:__queue_receive(mock_siren:generate_info_changed({ preferences = _preferences})) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2593,7 +2777,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2604,7 +2791,10 @@ test.register_coroutine_test( _preferences.triggerButtonUnpairing = false test.socket.device_lifecycle:__queue_receive(mock_siren:generate_info_changed({ preferences = _preferences})) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2626,7 +2816,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2637,7 +2830,10 @@ test.register_coroutine_test( _preferences.triggerButtonPairing = false test.socket.device_lifecycle:__queue_receive(mock_siren:generate_info_changed({ preferences = _preferences})) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -2662,6 +2858,9 @@ test.register_message_test( direction = "send", message = mock_siren_with_buttons:generate_test_message("sound3", capabilities.battery.battery(BUTTON_BATTERY_LOW)) } + }, + { + min_api_version = 19 } ) @@ -2687,6 +2886,9 @@ test.register_message_test( direction = "send", message = mock_siren_with_buttons:generate_test_message("sound3", capabilities.battery.battery(BUTTON_BATTERY_NORMAL)) } + }, + { + min_api_version = 19 } ) @@ -2712,6 +2914,9 @@ test.register_message_test( direction = "send", message = mock_siren_with_buttons:generate_test_message("sound4", capabilities.battery.battery(BUTTON_BATTERY_LOW)) } + }, + { + min_api_version = 19 } ) @@ -2737,6 +2942,9 @@ test.register_message_test( direction = "send", message = mock_siren_with_buttons:generate_test_message("sound4", capabilities.battery.battery(BUTTON_BATTERY_NORMAL)) } + }, + { + min_api_version = 19 } ) @@ -2762,6 +2970,9 @@ test.register_message_test( direction = "send", message = mock_siren_with_buttons:generate_test_message("sound5", capabilities.battery.battery(BUTTON_BATTERY_LOW)) } + }, + { + min_api_version = 19 } ) @@ -2787,6 +2998,9 @@ test.register_message_test( direction = "send", message = mock_siren_with_buttons:generate_test_message("sound5", capabilities.battery.battery(BUTTON_BATTERY_NORMAL)) } + }, + { + min_api_version = 19 } ) @@ -2820,7 +3034,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -2837,7 +3054,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("sound5", capabilities.battery.battery(BUTTON_BATTERY_LOW)) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-siren/src/test/test_ecolink_wireless_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_ecolink_wireless_siren.lua index 54b4243331..74f25a0aaf 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_ecolink_wireless_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_ecolink_wireless_siren.lua @@ -66,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.alarm.alarm.off()) } + }, + { + min_api_version = 19 } ) @@ -101,6 +104,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("siren1", capabilities.alarm.alarm.off()) } + }, + { + min_api_version = 19 } ) @@ -136,6 +142,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("siren2", capabilities.alarm.alarm.both()) } + }, + { + min_api_version = 19 } ) @@ -161,6 +170,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.alarm.alarm.both()) } + }, + { + min_api_version = 19 } ) @@ -196,6 +208,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("siren1", capabilities.alarm.alarm.both()) } + }, + { + min_api_version = 19 } ) @@ -231,6 +246,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("siren2", capabilities.alarm.alarm.both()) } + }, + { + min_api_version = 19 } ) @@ -266,7 +284,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = { 4 } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -290,7 +311,10 @@ test.register_coroutine_test( ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Receiving the both command from siren1 component should generate the correct commands including delayed commands", @@ -321,7 +345,10 @@ test.register_coroutine_test( ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -345,7 +372,10 @@ test.register_coroutine_test( ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -368,7 +398,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {4}}) ) ) - end + end, + { + min_api_version = 19 + } ) @@ -392,7 +425,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, {dst_channels = {1}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Receiving the off command from siren1 should generate the correct commands", @@ -414,7 +450,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Receiving the off command from siren2 should generate the correct commands", @@ -436,7 +475,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {3}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( "Receiving the off command from siren3 should generate the correct commands", @@ -458,7 +500,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {4}}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-siren/src/test/test_fortrezz_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_fortrezz_siren.lua index e99cfce77c..cfc42e2a63 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_fortrezz_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_fortrezz_siren.lua @@ -59,7 +59,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_siren:generate_test_message("main", capabilities.alarm.alarm.both({}))) test.socket.capability:__expect_send(mock_siren:generate_test_message("main", capabilities.switch.switch.on({}))) - end + end, + { + min_api_version = 19 + } ) @@ -90,7 +93,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_siren:generate_test_message("main", capabilities.alarm.alarm.siren({}))) test.socket.capability:__expect_send(mock_siren:generate_test_message("main", capabilities.switch.switch.on({}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -120,7 +126,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_siren:generate_test_message("main", capabilities.alarm.alarm.strobe({}))) test.socket.capability:__expect_send(mock_siren:generate_test_message("main", capabilities.switch.switch.on({}))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -150,7 +159,10 @@ test.register_coroutine_test( }) test.socket.capability:__expect_send(mock_siren:generate_test_message("main", capabilities.alarm.alarm.off({}))) test.socket.capability:__expect_send(mock_siren:generate_test_message("main", capabilities.switch.switch.off({}))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-siren/src/test/test_philio_sound_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_philio_sound_siren.lua index d825be6cec..3f3146ee5a 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_philio_sound_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_philio_sound_siren.lua @@ -63,7 +63,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -93,7 +94,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -133,7 +135,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -164,7 +167,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -196,7 +200,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -218,7 +223,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -240,7 +246,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -272,7 +279,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_siren:generate_test_message("main", capabilities.chime.chime.off()) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -296,7 +306,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -318,7 +331,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -342,7 +358,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -366,7 +385,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -390,7 +412,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -414,7 +439,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -432,7 +460,10 @@ test.register_coroutine_test( Basic:Set({value=0x00}) ) ) - end + end, + { + min_api_version = 19 + } ) do @@ -451,7 +482,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -496,7 +531,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -518,7 +557,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-siren/src/test/test_utilitech_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_utilitech_siren.lua index e62141ebcf..71451e3740 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_utilitech_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_utilitech_siren.lua @@ -41,6 +41,9 @@ test.register_message_test( direction = "receive", message = { mock_siren.id, zw_test_utils.zwave_test_build_receive_command(Battery:Report({ battery_level = 0x00 })) } } + }, + { + min_api_version = 19 } ) @@ -58,7 +61,10 @@ test.register_coroutine_test( mock_siren, Battery:Get({}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-siren/src/test/test_yale_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_yale_siren.lua index a7b7123f38..c3643a7b82 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_yale_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_yale_siren.lua @@ -52,6 +52,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.alarm.alarm.off()) } + }, + { + min_api_version = 19 } ) @@ -70,6 +73,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.alarm.alarm.both()) } + }, + { + min_api_version = 19 } ) @@ -105,7 +111,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) @@ -141,7 +150,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -176,7 +188,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -210,7 +225,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -243,7 +261,10 @@ test.register_coroutine_test( mock_siren, Basic:Set({value=0x00}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -288,7 +309,10 @@ test.register_coroutine_test( mock_siren, Configuration:Get({parameter_number = 4}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -305,7 +329,10 @@ test.register_coroutine_test( mock_siren, Battery:Get({}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-siren/src/test/test_zipato_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_zipato_siren.lua index 6b912be8bb..551eb0b90a 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_zipato_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_zipato_siren.lua @@ -61,7 +61,10 @@ test.register_coroutine_test( mock_siren, Basic:Set({value=0x00}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -89,7 +92,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -106,7 +112,10 @@ test.register_coroutine_test( mock_siren, Battery:Get({}) )) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -124,6 +133,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.alarm.alarm.off()) } + }, + { + min_api_version = 19 } ) @@ -142,6 +154,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.alarm.alarm.both()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-siren/src/test/test_zwave_multifunctional-siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_zwave_multifunctional-siren.lua index a40b510b49..c1ff4cbb31 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_zwave_multifunctional-siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_zwave_multifunctional-siren.lua @@ -50,6 +50,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.alarm.alarm.off()) } + }, + { + min_api_version = 19 } ) @@ -69,6 +72,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -88,6 +94,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({value = 25})) } + }, + { + min_api_version = 19 } ) @@ -107,6 +116,9 @@ test.register_message_test( direction = "send", message = mock_siren:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 25, unit = 'C'})) } + }, + { + min_api_version = 19 } ) @@ -132,7 +144,10 @@ test.register_coroutine_test( Basic:Get({}) )) mock_siren:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-siren/src/test/test_zwave_notification_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_zwave_notification_siren.lua index 0e0f407523..2cc31d91c6 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_zwave_notification_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_zwave_notification_siren.lua @@ -49,6 +49,9 @@ test.register_message_test( direction = "send", message = mock_siren_notification:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -73,6 +76,9 @@ test.register_message_test( direction = "send", message = mock_siren_notification:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -92,6 +98,9 @@ test.register_message_test( direction = "send", message = mock_siren_notification:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -116,6 +125,9 @@ test.register_message_test( direction = "send", message = mock_siren_notification:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-siren/src/test/test_zwave_siren.lua b/drivers/SmartThings/zwave-siren/src/test/test_zwave_siren.lua index 121f6170e2..9f9f8cc9d3 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_zwave_siren.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_zwave_siren.lua @@ -82,6 +82,9 @@ test.register_message_test( direction = "send", message = mock_siren_basic:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -105,6 +108,9 @@ test.register_message_test( direction = "send", message = mock_siren_basic:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -128,6 +134,9 @@ test.register_message_test( direction = "send", message = mock_siren_basic:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -151,6 +160,9 @@ test.register_message_test( direction = "send", message = mock_siren_basic:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -174,6 +186,9 @@ test.register_message_test( direction = "send", message = mock_siren_switch_binary:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -197,6 +212,9 @@ test.register_message_test( direction = "send", message = mock_siren_switch_binary:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -220,6 +238,9 @@ test.register_message_test( direction = "send", message = mock_siren_switch_binary:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -243,6 +264,9 @@ test.register_message_test( direction = "send", message = mock_siren_switch_binary:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -271,7 +295,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -299,7 +326,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) @@ -328,7 +358,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -356,7 +389,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -384,7 +420,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -422,7 +461,10 @@ test.register_coroutine_test( test.socket.device_lifecycle:__queue_receive({ mock_siren_basic.id, "added" }) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-siren/src/test/test_zwave_sound_sensor.lua b/drivers/SmartThings/zwave-siren/src/test/test_zwave_sound_sensor.lua index 10595c7137..4ed0e53e90 100644 --- a/drivers/SmartThings/zwave-siren/src/test/test_zwave_sound_sensor.lua +++ b/drivers/SmartThings/zwave-siren/src/test/test_zwave_sound_sensor.lua @@ -48,6 +48,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.soundSensor.sound.detected()) } + }, + { + min_api_version = 19 } ) @@ -67,6 +70,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.soundSensor.sound.not_detected()) } + }, + { + min_api_version = 19 } ) @@ -83,6 +89,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.soundSensor.sound.not_detected()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/apiv6_bugfix/can_handle.lua b/drivers/SmartThings/zwave-smoke-alarm/src/apiv6_bugfix/can_handle.lua new file mode 100644 index 0000000000..8a9b8cc6cc --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/apiv6_bugfix/can_handle.lua @@ -0,0 +1,16 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle(opts, driver, device, cmd, ...) + local cc = require "st.zwave.CommandClass" + local WakeUp = (require "st.zwave.CommandClass.WakeUp")({ version = 1 }) + local version = require "version" + if version.api == 6 and + cmd.cmd_class == cc.WAKE_UP and + cmd.cmd_id == WakeUp.NOTIFICATION then + return true, require("apiv6_bugfix") + end + return false +end + +return can_handle diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/apiv6_bugfix/init.lua b/drivers/SmartThings/zwave-smoke-alarm/src/apiv6_bugfix/init.lua index 0204b7b2d5..94dc5975ab 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/apiv6_bugfix/init.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/apiv6_bugfix/init.lua @@ -1,14 +1,9 @@ +-- 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 }) - -local function can_handle(opts, driver, device, cmd, ...) - local version = require "version" - return version.api == 6 and - cmd.cmd_class == cc.WAKE_UP and - cmd.cmd_id == WakeUp.NOTIFICATION -end - local function wakeup_notification(driver, device, cmd) device:refresh() end @@ -20,7 +15,7 @@ local apiv6_bugfix = { } }, NAME = "apiv6_bugfix", - can_handle = can_handle + can_handle = require("apiv6_bugfix.can_handle"), } return apiv6_bugfix diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/can_handle.lua b/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/can_handle.lua new file mode 100644 index 0000000000..4a3f51183b --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_fibaro_smoke_sensor(opts, driver, device, cmd, ...) + local FINGERPRINTS = require("fibaro-smoke-sensor.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:id_match( fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then + return true, require("fibaro-smoke-sensor") + end + end + return false +end + +return can_handle_fibaro_smoke_sensor diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/fingerprints.lua b/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/fingerprints.lua new file mode 100644 index 0000000000..81c04eccfc --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/fingerprints.lua @@ -0,0 +1,11 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local FIBARO_SMOKE_SENSOR_FINGERPRINTS = { + { manufacturerId = 0x010F, productType = 0x0C02, productId = 0x1002 }, -- Fibaro Smoke Sensor + { manufacturerId = 0x010F, productType = 0x0C02, productId = 0x1003 }, -- Fibaro Smoke Sensor + { manufacturerId = 0x010F, productType = 0x0C02, productId = 0x3002 }, -- Fibaro Smoke Sensor + { manufacturerId = 0x010F, productType = 0x0C02, productId = 0x4002 } -- Fibaro Smoke Sensor +} + +return FIBARO_SMOKE_SENSOR_FINGERPRINTS diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua b/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua index a4d62fa1a4..bf7d554613 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" --- @type st.zwave.CommandClass @@ -24,26 +14,12 @@ local WakeUp = (require "st.zwave.CommandClass.WakeUp")({version=1}) local FIBARO_SMOKE_SENSOR_WAKEUP_INTERVAL = 21600 --seconds -local FIBARO_SMOKE_SENSOR_FINGERPRINTS = { - { manufacturerId = 0x010F, productType = 0x0C02, productId = 0x1002 }, -- Fibaro Smoke Sensor - { manufacturerId = 0x010F, productType = 0x0C02, productId = 0x1003 }, -- Fibaro Smoke Sensor - { manufacturerId = 0x010F, productType = 0x0C02, productId = 0x3002 }, -- Fibaro Smoke Sensor - { manufacturerId = 0x010F, productType = 0x0C02, productId = 0x4002 } -- Fibaro Smoke Sensor -} --- Determine whether the passed device is fibaro smoke sensro --- --- @param driver st.zwave.Driver --- @param device st.zwave.Device --- @return boolean true if the device is fibaro smoke sensor -local function can_handle_fibaro_smoke_sensor(opts, driver, device, cmd, ...) - for _, fingerprint in ipairs(FIBARO_SMOKE_SENSOR_FINGERPRINTS) do - if device:id_match( fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true - end - end - return false -end local function device_added(self, device) device:send(WakeUp:IntervalSet({node_id = self.environment_info.hub_zwave_id, seconds = FIBARO_SMOKE_SENSOR_WAKEUP_INTERVAL})) @@ -76,7 +52,7 @@ local fibaro_smoke_sensor = { added = device_added }, NAME = "fibaro smoke sensor", - can_handle = can_handle_fibaro_smoke_sensor, + can_handle = require("fibaro-smoke-sensor.can_handle"), health_check = false, } diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/init.lua b/drivers/SmartThings/zwave-smoke-alarm/src/init.lua index 0d0a5d1bfd..7968983f63 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/init.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local capabilities = require "st.capabilities" --- @type st.zwave.CommandClass @@ -83,12 +73,7 @@ local driver_template = { capabilities.temperatureAlarm, capabilities.temperatureMeasurement }, - sub_drivers = { - require("zwave-smoke-co-alarm-v1"), - require("zwave-smoke-co-alarm-v2"), - require("fibaro-smoke-sensor"), - require("apiv6_bugfix"), - }, + sub_drivers = require("sub_drivers"), lifecycle_handlers = { init = device_init, infoChanged = info_changed, diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/lazy_load_subdriver.lua b/drivers/SmartThings/zwave-smoke-alarm/src/lazy_load_subdriver.lua new file mode 100644 index 0000000000..45115081e4 --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/lazy_load_subdriver.lua @@ -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 diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/preferences.lua b/drivers/SmartThings/zwave-smoke-alarm/src/preferences.lua index 25606a5255..55fa70d48b 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/preferences.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/preferences.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local devices = { FIBARO = { diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/sub_drivers.lua b/drivers/SmartThings/zwave-smoke-alarm/src/sub_drivers.lua new file mode 100644 index 0000000000..f0a2d96412 --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/sub_drivers.lua @@ -0,0 +1,11 @@ +-- 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("zwave-smoke-co-alarm-v1"), + lazy_load_if_possible("zwave-smoke-co-alarm-v2"), + lazy_load_if_possible("fibaro-smoke-sensor"), + lazy_load_if_possible("apiv6_bugfix"), +} +return sub_drivers diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_fibaro_co_sensor_zw5.lua b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_fibaro_co_sensor_zw5.lua index 4f3b08d3f3..2759e456c0 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_fibaro_co_sensor_zw5.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_fibaro_co_sensor_zw5.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -78,7 +68,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = ACOUSTIC_SIGNALS, configuration_value = EXCEEDING_THE_TEMPERATURE}) )) mock_fibaro_CO_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -94,6 +87,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -119,6 +115,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -144,6 +143,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 70.7, unit = 'F' })) } + }, + { + min_api_version = 19 } ) @@ -168,6 +170,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.detected()) } + }, + { + min_api_version = 19 } ) @@ -192,6 +197,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.tamperAlert.tamper.clear()) } + }, + { + min_api_version = 19 } ) @@ -216,6 +224,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.detected()) } + }, + { + min_api_version = 19 } ) @@ -240,6 +251,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.clear()) } + }, + { + min_api_version = 19 } ) @@ -263,6 +277,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.tested()) } + }, + { + min_api_version = 19 } ) @@ -288,6 +305,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.clear()) } + }, + { + min_api_version = 19 } ) @@ -312,6 +332,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) } + }, + { + min_api_version = 19 } ) @@ -336,6 +359,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_CO_sensor:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) } + }, + { + min_api_version = 19 } ) @@ -365,7 +391,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -472,7 +499,10 @@ test.register_coroutine_test( Configuration:Report({ parameter_number = 2, configuration_value = 3 }) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_fibaro_smoke_sensor.lua b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_fibaro_smoke_sensor.lua index ebb50eaa6e..8dc52eb471 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_fibaro_smoke_sensor.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_fibaro_smoke_sensor.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -158,7 +148,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number=32, size=2, configuration_value=4320}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -191,7 +184,10 @@ test.register_coroutine_test( Battery:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -211,7 +207,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_alarm_v1.lua b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_alarm_v1.lua index fd2996b9d1..e87ecfa22a 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_alarm_v1.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_alarm_v1.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -62,6 +52,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -81,6 +74,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -100,6 +96,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.detected()) } + }, + { + min_api_version = 19 } ) @@ -119,6 +118,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.clear()) } + }, + { + min_api_version = 19 } ) @@ -161,6 +163,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.clear()) }, + }, + { + min_api_version = 19 } ) @@ -180,6 +185,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -199,6 +207,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_co_detector.lua b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_co_detector.lua index e42edd4828..63d81ae54f 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_co_detector.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_co_detector.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -63,6 +53,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.detected()) } + }, + { + min_api_version = 19 } ) @@ -82,6 +75,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.detected()) }, + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -100,6 +96,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.clear()) }, + }, + { + min_api_version = 19 } ) @@ -119,6 +118,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.detected()) } + }, + { + min_api_version = 19 } ) @@ -138,6 +140,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.tested()) } + }, + { + min_api_version = 19 } ) @@ -157,6 +162,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.carbonMonoxideDetector.carbonMonoxide.clear()) } + }, + { + min_api_version = 19 } ) @@ -171,6 +179,9 @@ test.register_message_test( alarm_level = 1 })) } }, + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_smoke_detector.lua b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_smoke_detector.lua index 95121b1673..1d2826bd97 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_smoke_detector.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/test/test_zwave_smoke_detector.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local test = require "integration_test" local capabilities = require "st.capabilities" @@ -64,6 +54,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -83,6 +76,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) }, + }, + { + min_api_version = 19 } ) @@ -102,6 +98,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) }, + }, + { + min_api_version = 19 } ) @@ -121,6 +120,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -140,6 +142,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -159,6 +164,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.tested()) } + }, + { + min_api_version = 19 } ) @@ -178,6 +186,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -192,6 +203,9 @@ test.register_message_test( alarm_level = 1 })) } }, + }, + { + min_api_version = 19 } ) @@ -238,7 +252,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -258,6 +273,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) } + }, + { + min_api_version = 19 } ) @@ -277,6 +295,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) } + }, + { + min_api_version = 19 } ) @@ -296,6 +317,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) } + }, + { + min_api_version = 19 } ) @@ -315,6 +339,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) } + }, + { + min_api_version = 19 } ) @@ -334,6 +361,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.cleared()) } + }, + { + min_api_version = 19 } ) @@ -376,7 +406,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v1/can_handle.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v1/can_handle.lua new file mode 100644 index 0000000000..dc78d0e4ac --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v1/can_handle.lua @@ -0,0 +1,13 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_v1_alarm(opts, driver, device, cmd, ...) + -- The default handlers for the Alarm/Notification command class(es) for the + -- Smoke Detector and Carbon Monoxide Detector only handles V3 and up. + if opts.dispatcher_class == "ZwaveDispatcher" and cmd ~= nil and cmd.version ~= nil and cmd.version < 3 then + return true, require("zwave-smoke-co-alarm-v1") + end + return false +end + +return can_handle_v1_alarm diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v1/init.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v1/init.lua index 923c516167..8e3cc4e267 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v1/init.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v1/init.lua @@ -1,16 +1,5 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 local capabilities = require "st.capabilities" --- @type st.zwave.CommandClass @@ -23,17 +12,6 @@ local Alarm = (require "st.zwave.CommandClass.Alarm")({ version = 1 }) -- manufacturerId = 0x0138, productType = 0x0001, productId = 0x0002 -- First Alert Smoke & CO Detector -- manufacturerId = 0x0138, productType = 0x0001, productId = 0x0003 -- First Alert Smoke & CO Detector ---- Determine whether the passed device only supports V1 or V2 of the Alarm command class ---- ---- @param driver st.zwave.Driver ---- @param device st.zwave.Device ---- @return boolean true if the device is smoke co alarm -local function can_handle_v1_alarm(opts, driver, device, cmd, ...) - -- The default handlers for the Alarm/Notification command class(es) for the - -- Smoke Detector and Carbon Monoxide Detector only handles V3 and up. - return opts.dispatcher_class == "ZwaveDispatcher" and cmd ~= nil and cmd.version ~= nil and cmd.version < 3 -end - --- Default handler for alarm command class reports --- --- This converts alarm V1 reports to correct smoke events @@ -75,7 +53,7 @@ local zwave_alarm = { } }, NAME = "Z-Wave smoke and CO alarm V1", - can_handle = can_handle_v1_alarm, + can_handle = require("zwave-smoke-co-alarm-v1.can_handle"), } return zwave_alarm diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/can_handle.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/can_handle.lua new file mode 100644 index 0000000000..6666e7abc2 --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_v2_alarm(opts, driver, device, cmd, ...) + local FINGERPRINTS = require("zwave-smoke-co-alarm-v2.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:id_match( fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then + return true, require("zwave-smoke-co-alarm-v2") + end + end + return false +end + +return can_handle_v2_alarm diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/can_handle.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/can_handle.lua new file mode 100644 index 0000000000..baa0d7bbf0 --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/can_handle.lua @@ -0,0 +1,14 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local function can_handle_fibaro_co_sensor(opts, driver, device, cmd, ...) + local FINGERPRINTS = require("zwave-smoke-co-alarm-v2.fibaro-co-sensor-zw5.fingerprints") + for _, fingerprint in ipairs(FINGERPRINTS) do + if device:id_match( fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then + return true, require("zwave-smoke-co-alarm-v2.fibaro-co-sensor-zw5") + end + end + return false +end + +return can_handle_fibaro_co_sensor diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/fingerprints.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/fingerprints.lua new file mode 100644 index 0000000000..37fb1f508c --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/fingerprints.lua @@ -0,0 +1,9 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local FIBARO_CO_SENSORS_FINGERPRINTS = { + { manufacturerId = 0x010F, productType = 0x1201, productId = 0x1000 }, -- Fibaro CO Sensor + { manufacturerId = 0x010F, productType = 0x1201, productId = 0x1001 } -- Fibaro CO Sensor +} + +return FIBARO_CO_SENSORS_FINGERPRINTS diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/init.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/init.lua index bde1cbc877..0559b83983 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/init.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5/init.lua @@ -1,16 +1,6 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + local cc = require "st.zwave.CommandClass" local Configuration = (require "st.zwave.CommandClass.Configuration")({ version = 2 }) @@ -21,10 +11,6 @@ local TAMPERING_AND_EXCEEDING_THE_TEMPERATURE = 3 local ACOUSTIC_SIGNALS = 4 local EXCEEDING_THE_TEMPERATURE = 2 -local FIBARO_CO_SENSORS_FINGERPRINTS = { - { manufacturerId = 0x010F, productType = 0x1201, productId = 0x1000 }, -- Fibaro CO Sensor - { manufacturerId = 0x010F, productType = 0x1201, productId = 0x1001 } -- Fibaro CO Sensor -} local function parameterNumberToParameterName(preferences,parameterNumber) for id, parameter in pairs(preferences) do @@ -40,14 +26,6 @@ end --- @param driver st.zwave.Driver --- @param device st.zwave.Device --- @return boolean true if the device is smoke co alarm -local function can_handle_fibaro_co_sensor(opts, driver, device, cmd, ...) - for _, fingerprint in ipairs(FIBARO_CO_SENSORS_FINGERPRINTS) do - if device:id_match( fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true - end - end - return false -end local function update_preferences(self, device, args) local preferences = preferencesMap.get_device_parameters(device) @@ -108,7 +86,7 @@ local fibaro_co_sensor = { init = device_init, infoChanged = info_changed }, - can_handle = can_handle_fibaro_co_sensor + can_handle = require("zwave-smoke-co-alarm-v2.fibaro-co-sensor-zw5.can_handle"), } return fibaro_co_sensor diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fingerprints.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fingerprints.lua new file mode 100644 index 0000000000..8dc021cc28 --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/fingerprints.lua @@ -0,0 +1,9 @@ +-- Copyright 2025 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + +local SMOKE_CO_ALARM_V2_FINGERPRINTS = { + { manufacturerId = 0x010F, productType = 0x1201, productId = 0x1000 }, -- Fibaro CO Sensor + { manufacturerId = 0x010F, productType = 0x1201, productId = 0x1001 } -- Fibaro CO Sensor +} + +return SMOKE_CO_ALARM_V2_FINGERPRINTS diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/init.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/init.lua index b49b010cdb..5e69f7108d 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/init.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/init.lua @@ -1,16 +1,7 @@ --- Copyright 2022 SmartThings --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. +-- Copyright 2022 SmartThings, Inc. +-- Licensed under the Apache License, Version 2.0 + + local capabilities = require "st.capabilities" --- @type st.zwave.CommandClass @@ -20,24 +11,12 @@ local Alarm = (require "st.zwave.CommandClass.Alarm")({ version = 2 }) --- @type st.zwave.CommandClass.Notification local Notification = (require "st.zwave.CommandClass.Notification")({version=3}) -local SMOKE_CO_ALARM_V2_FINGERPRINTS = { - { manufacturerId = 0x010F, productType = 0x1201, productId = 0x1000 }, -- Fibaro CO Sensor - { manufacturerId = 0x010F, productType = 0x1201, productId = 0x1001 } -- Fibaro CO Sensor -} --- Determine whether the passed device is Smoke Alarm --- --- @param driver st.zwave.Driver --- @param device st.zwave.Device --- @return boolean true if the device is smoke co alarm -local function can_handle_v2_alarm(opts, driver, device, cmd, ...) - for _, fingerprint in ipairs(SMOKE_CO_ALARM_V2_FINGERPRINTS) do - if device:id_match( fingerprint.manufacturerId, fingerprint.productType, fingerprint.productId) then - return true - end - end - return false -end local device_added = function(self, device) device:emit_event(capabilities.carbonMonoxideDetector.carbonMonoxide.clear()) @@ -94,13 +73,11 @@ local zwave_alarm = { } }, NAME = "Z-Wave smoke and CO alarm V2", - can_handle = can_handle_v2_alarm, + can_handle = require("zwave-smoke-co-alarm-v2.can_handle"), lifecycle_handlers = { added = device_added }, - sub_drivers = { - require("zwave-smoke-co-alarm-v2/fibaro-co-sensor-zw5") - } + sub_drivers = require("zwave-smoke-co-alarm-v2.sub_drivers"), } return zwave_alarm diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/sub_drivers.lua b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/sub_drivers.lua new file mode 100644 index 0000000000..0699743371 --- /dev/null +++ b/drivers/SmartThings/zwave-smoke-alarm/src/zwave-smoke-co-alarm-v2/sub_drivers.lua @@ -0,0 +1,8 @@ +-- 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("zwave-smoke-co-alarm-v2.fibaro-co-sensor-zw5"), +} +return sub_drivers diff --git a/drivers/SmartThings/zwave-switch/fingerprints.yml b/drivers/SmartThings/zwave-switch/fingerprints.yml index d90a0c6b76..46faa7d106 100644 --- a/drivers/SmartThings/zwave-switch/fingerprints.yml +++ b/drivers/SmartThings/zwave-switch/fingerprints.yml @@ -916,6 +916,13 @@ zwaveManufacturer: manufacturerId: 0x010F productType: 0x0102 deviceProfileName: fibaro-dimmer-2 +#Zooz + - id: "Zooz/ZEN05" + deviceLabel: Zooz Outdoor Plug ZEN05 + manufacturerId: 0x027A + productType: 0x7000 + productId: 0xB001 + deviceProfileName: zooz-zen05-plug #Shelly/Qubino - id: 1120/2/137 deviceLabel: Wave Plug UK diff --git a/drivers/SmartThings/zwave-switch/profiles/zooz-zen05-plug.yml b/drivers/SmartThings/zwave-switch/profiles/zooz-zen05-plug.yml new file mode 100644 index 0000000000..43685ff2c7 --- /dev/null +++ b/drivers/SmartThings/zwave-switch/profiles/zooz-zen05-plug.yml @@ -0,0 +1,90 @@ +name: zooz-zen05-plug +components: +- id: main + capabilities: + - id: switch + version: 1 + - id: powerMeter + version: 1 + - id: energyMeter + version: 1 + - id: voltageMeasurement + version: 1 + - id: refresh + version: 1 + categories: + - name: SmartPlug +preferences: + - name: "driverInfo" + title: "Driver Info" + description: "This driver may have limited features, check the online Zooz documentation for information about custom drivers." + preferenceType: string + definition: + stringType: paragraph + #param 1 + - name: "ledMode" + title: "LED Indicator Behavior" + description: "Decide how the LED indicator behaves depending on the on/off status of the plug." + required: false + preferenceType: enumeration + definition: + options: + 0: "On when on, off when off *" + 1: "On when off, off when on" + 2: "Always off" + default: 0 + #param 7 + - name: "ledBrightness" + title: "LED Brightness" + description: "Choose the LED indicator brightness level." + required: false + preferenceType: enumeration + definition: + options: + 0: "High" + 1: "Medium" + 2: "Low *" + default: 2 + #param 2 + - name: "autoTurnOff" + title: "Auto-off Timer" + description: "Default: 0=disabled; Auto-off timer will automatically turn the Smart Plug off after x minutes once it has been turned on." + required: false + preferenceType: integer + definition: + minimum: 0 + maximum: 65535 + default: 0 + #param 4 + - name: "autoTurnOn" + title: "Auto-on Timer" + description: "Default: 0=disabled; Auto-on timer will automatically turn the Smart Plug on after x minutes once it has been turned off." + required: false + preferenceType: integer + definition: + minimum: 0 + maximum: 65535 + default: 0 + #param 6 + - name: "powerRecovery" + title: "On/Off Status After Power Failure" + description: "Choose the recovery state for your Smart Plug if power outage occurs." + required: false + preferenceType: enumeration + definition: + options: + 2: "Restores Prior Status *" + 0: "Always Off once restored" + 1: "Always On once restored" + default: 2 + #param 8 + - name: "manualControl" + title: "Manual Control" + description: "Disable or enable manual control (turning the Smart Plug on and off using the physical button)." + required: false + preferenceType: enumeration + definition: + options: + 0: "Disabled" + 1: "Enabled *" + default: 1 \ No newline at end of file diff --git a/drivers/SmartThings/zwave-switch/src/init.lua b/drivers/SmartThings/zwave-switch/src/init.lua index 26cca570a7..9f40fd84e4 100644 --- a/drivers/SmartThings/zwave-switch/src/init.lua +++ b/drivers/SmartThings/zwave-switch/src/init.lua @@ -102,6 +102,7 @@ local driver_template = { capabilities.battery, capabilities.energyMeter, capabilities.powerMeter, + capabilities.voltageMeasurement, capabilities.colorControl, capabilities.button, capabilities.temperatureMeasurement, diff --git a/drivers/SmartThings/zwave-switch/src/preferences.lua b/drivers/SmartThings/zwave-switch/src/preferences.lua index 824e570070..798efaddf0 100644 --- a/drivers/SmartThings/zwave-switch/src/preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/preferences.lua @@ -362,6 +362,21 @@ local devices = { dimmerPaddleControl = {parameter_number = 27, size = 1} } }, + ZOOZ_ZEN05 = { + MATCHING_MATRIX = { + mfrs = 0x027A, + product_types = 0x7000, + product_ids = 0xB001 + }, + PARAMETERS = { + ledMode = { parameter_number = 1, size = 1 }, + autoTurnOff = { parameter_number = 2, size = 4 }, + autoTurnOn = { parameter_number = 4, size = 4 }, + powerRecovery = { parameter_number = 6, size = 1 }, + ledBrightness = { parameter_number = 7, size = 1 }, + manualControl = { parameter_number = 8, size = 1 }, + } + }, AEOTEC_HEAVY_DUTY = { MATCHING_MATRIX = { mfrs = 0x0086, diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeon_smart_strip.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeon_smart_strip.lua index f11a379666..d4317636be 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeon_smart_strip.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeon_smart_strip.lua @@ -150,6 +150,9 @@ test.register_message_test( {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {6}}) ) } + }, + { + min_api_version = 19 } ) @@ -236,6 +239,9 @@ test.register_message_test( {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {6}}) ) } + }, + { + min_api_version = 19 } ) @@ -284,6 +290,9 @@ test.register_message_test( {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {3}}) ) } + }, + { + min_api_version = 19 } ) @@ -332,6 +341,9 @@ test.register_message_test( {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {4}}) ) } + }, + { + min_api_version = 19 } ) @@ -363,6 +375,9 @@ test.register_message_test( direction = "send", message = mock_metering_switch:generate_test_message("switch1", capabilities.energyMeter.energy({ value = 50.0, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -394,6 +409,9 @@ test.register_message_test( direction = "send", message = mock_metering_switch:generate_test_message("switch2", capabilities.energyMeter.energy({ value = 50.0, unit = "kVAh" })) } + }, + { + min_api_version = 19 } ) @@ -425,6 +443,9 @@ test.register_message_test( direction = "send", message = mock_metering_switch:generate_test_message("switch3", capabilities.powerMeter.power({ value = 50, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -492,6 +513,9 @@ test.register_message_test( {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {6}}) ) } + }, + { + min_api_version = 19 } ) @@ -523,6 +547,9 @@ test.register_message_test( direction = "send", message = mock_metering_switch:generate_test_message("main", capabilities.powerMeter.power({ value = 50, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -592,7 +619,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 112, size = 4, configuration_value = 90}) )) mock_metering_switch:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -723,7 +753,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -854,7 +887,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -942,7 +978,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1030,7 +1069,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1118,7 +1160,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1206,7 +1251,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_dimmer_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_dimmer_switch.lua index 6fb6c9c5ef..052516689d 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_dimmer_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_dimmer_switch.lua @@ -58,7 +58,10 @@ test.register_coroutine_test( Configuration:Set({ parameter_number=111, size=4, configuration_value=300 }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -95,7 +98,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -133,6 +137,9 @@ test.register_message_test( Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) ) } + }, + { + min_api_version = 19 } ) @@ -170,6 +177,9 @@ test.register_message_test( Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) ) } + }, + { + min_api_version = 19 } ) @@ -211,6 +221,9 @@ test.register_message_test( Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) ) } + }, + { + min_api_version = 19 } ) @@ -265,6 +278,9 @@ test.register_message_test( Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) ) } + }, + { + min_api_version = 19 } ) @@ -294,6 +310,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -315,6 +334,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -381,7 +403,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -448,7 +473,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -480,7 +508,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_dual_nano_switch_configuration.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_dual_nano_switch_configuration.lua index 272321f53f..a1abd8c4d4 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_dual_nano_switch_configuration.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_dual_nano_switch_configuration.lua @@ -111,7 +111,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_heavy_duty_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_heavy_duty_switch.lua index a11fe3abcb..5b40b8ee2e 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_heavy_duty_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_heavy_duty_switch.lua @@ -55,6 +55,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 27, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -76,6 +79,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -116,7 +122,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -127,7 +134,10 @@ test.register_coroutine_test( test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command(mock_device, Meter:Reset({}))) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command(mock_device, Meter:Get({ scale = Meter.scale.electric_meter.KILOWATT_HOURS }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -155,7 +165,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 5000 })) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -178,7 +191,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -201,7 +217,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -225,7 +244,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -249,7 +271,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -273,7 +298,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -297,7 +325,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -321,7 +352,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -345,7 +379,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -369,7 +406,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -393,7 +433,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -417,7 +460,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -441,7 +487,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -465,7 +514,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_metering_switch_configuration.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_metering_switch_configuration.lua index 2ebeb664bb..83262067e7 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_metering_switch_configuration.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_metering_switch_configuration.lua @@ -63,7 +63,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_nano_dimmer.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_nano_dimmer.lua index db1e4c2498..f5d81db100 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_nano_dimmer.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_nano_dimmer.lua @@ -82,7 +82,10 @@ test.register_coroutine_test( Configuration:Set({ parameter_number=113, size=4, configuration_value=300 }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -119,7 +122,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -157,6 +161,9 @@ test.register_message_test( Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) ) } + }, + { + min_api_version = 19 } ) @@ -194,6 +201,9 @@ test.register_message_test( Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) ) } + }, + { + min_api_version = 19 } ) @@ -235,6 +245,9 @@ test.register_message_test( Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) ) } + }, + { + min_api_version = 19 } ) @@ -289,6 +302,9 @@ test.register_message_test( Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) ) } + }, + { + min_api_version = 19 } ) @@ -318,6 +334,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -339,6 +358,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -405,7 +427,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -472,7 +497,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -504,7 +532,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_nano_dimmer_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_nano_dimmer_preferences.lua index a8206a0052..679815ef97 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_nano_dimmer_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_nano_dimmer_preferences.lua @@ -57,7 +57,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch.lua index fdba32d9cb..5da5ef2739 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch.lua @@ -58,7 +58,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -85,7 +88,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_7_eu.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_7_eu.lua index 079616dba4..7e9d8a8064 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_7_eu.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_7_eu.lua @@ -64,7 +64,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -91,7 +94,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -112,6 +118,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 55, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -133,6 +142,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -161,7 +173,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 5000 })) ) - end + end, + { + min_api_version = 19 + } ) do @@ -205,7 +220,11 @@ do SwitchColor:Get({ color_component_id=SwitchColor.color_component_id.RED }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_7_us.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_7_us.lua index 0ecb71e59d..c23d236239 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_7_us.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_7_us.lua @@ -52,7 +52,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -79,7 +82,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -106,7 +112,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -127,6 +136,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 55, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -148,6 +160,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -176,7 +191,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.powerConsumptionReport.powerConsumption({ deltaEnergy = 0.0, energy = 5000 })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_gen5.lua b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_gen5.lua index 4c2b76fdf6..29e491fab7 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_gen5.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_aeotec_smart_switch_gen5.lua @@ -53,7 +53,10 @@ test.register_coroutine_test( Configuration:Set({ parameter_number = 103, configuration_value = 0, size = 4 }) )) mock_switch:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_dawon_smart_plug.lua b/drivers/SmartThings/zwave-switch/src/test/test_dawon_smart_plug.lua index cbfe5f42a0..22fb2bd00a 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_dawon_smart_plug.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_dawon_smart_plug.lua @@ -47,6 +47,9 @@ test.register_message_test( direction = "send", message = mock_metering_switch:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -66,6 +69,9 @@ test.register_message_test( direction = "send", message = mock_metering_switch:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_dawon_wall_smart_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_dawon_wall_smart_switch.lua index ee48f99494..ce3d0d172b 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_dawon_wall_smart_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_dawon_wall_smart_switch.lua @@ -75,6 +75,9 @@ test.register_message_test( direction = "send", message = mock_multi_switch:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 22 })) } + }, + { + min_api_version = 19 } ) @@ -101,6 +104,9 @@ test.register_message_test( direction = "send", message = mock_multi_switch:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 25, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -130,6 +136,9 @@ test.register_message_test( direction = "send", message = mock_multi_switch:generate_test_message("switch1", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -159,6 +168,9 @@ test.register_message_test( direction = "send", message = mock_multi_switch:generate_test_message("switch1", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -188,6 +200,9 @@ test.register_message_test( direction = "send", message = mock_multi_switch:generate_test_message("switch2", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -217,6 +232,9 @@ test.register_message_test( direction = "send", message = mock_multi_switch:generate_test_message("switch2", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -246,6 +264,9 @@ test.register_message_test( direction = "send", message = mock_multi_switch:generate_test_message("switch3", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -275,6 +296,9 @@ test.register_message_test( direction = "send", message = mock_multi_switch:generate_test_message("switch3", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -295,7 +319,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 1, size = 2, configuration_value = 10 * 60}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -357,7 +384,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_eaton_5_scene_keypad.lua b/drivers/SmartThings/zwave-switch/src/test/test_eaton_5_scene_keypad.lua index d50b7cdaa5..ce422f61d0 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_eaton_5_scene_keypad.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_eaton_5_scene_keypad.lua @@ -74,7 +74,10 @@ test.register_coroutine_test( capabilities.switch.switch.off() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -113,7 +116,10 @@ test.register_coroutine_test( capabilities.switch.switch.on() ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -139,7 +145,10 @@ test.register_coroutine_test( ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -224,7 +233,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -259,7 +271,10 @@ test.register_coroutine_test( ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -316,7 +331,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -361,7 +379,10 @@ test.register_coroutine_test( } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -375,7 +396,10 @@ test.register_coroutine_test( ) } ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -432,7 +456,10 @@ test.register_coroutine_test( } ) -- if group_id and scene_id are same, do nothing. - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -454,7 +481,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -469,7 +499,10 @@ test.register_coroutine_test( } ) -- driver should do nothing. - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -486,7 +519,10 @@ test.register_coroutine_test( Indicator:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -503,7 +539,10 @@ test.register_coroutine_test( Indicator:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_eaton_accessory_dimmer.lua b/drivers/SmartThings/zwave-switch/src/test/test_eaton_accessory_dimmer.lua index 8b5e96b161..e40913a9ae 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_eaton_accessory_dimmer.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_eaton_accessory_dimmer.lua @@ -42,6 +42,9 @@ test.register_message_test( direction = "receive", message = { mock_device.id, zw_test_utils.zwave_test_build_receive_command(Basic:Report({ value = 0xFF })) } } + }, + { + min_api_version = 19 } ) @@ -63,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level(0)) } + }, + { + min_api_version = 19 } ) @@ -87,6 +93,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -119,7 +128,11 @@ do direction = "send", message = mock_device:generate_test_message("main", capabilities.switchLevel.level(level)) } + }, + { + min_api_version = 19 } + ) end @@ -161,6 +174,9 @@ test.register_message_test( SwitchMultilevel:Get({}) ) } + }, + { + min_api_version = 19 } ) end @@ -185,7 +201,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -208,7 +227,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -233,7 +255,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_eaton_anyplace_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_eaton_anyplace_switch.lua index 6815a408da..4e5dfb1a8a 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_eaton_anyplace_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_eaton_anyplace_switch.lua @@ -71,6 +71,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -114,6 +117,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -134,7 +140,10 @@ test.register_coroutine_test( Basic:Report({value=0xFF}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -154,7 +163,10 @@ test.register_coroutine_test( Basic:Report({value=0x00}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -170,6 +182,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -186,6 +201,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_eaton_rf_dimmer.lua b/drivers/SmartThings/zwave-switch/src/test/test_eaton_rf_dimmer.lua index 99c6ae4068..0a5e2baf2a 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_eaton_rf_dimmer.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_eaton_rf_dimmer.lua @@ -41,7 +41,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number=7, configuration_value=1, size=1}) )) mock_sensor:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_ecolink_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_ecolink_switch.lua index 4f5557f9a3..83e1aa9354 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_ecolink_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_ecolink_switch.lua @@ -62,7 +62,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -92,7 +93,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -109,6 +111,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -138,6 +143,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -167,6 +175,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -204,6 +215,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -233,6 +247,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -256,7 +273,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -280,7 +298,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_double_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_double_switch.lua index 59934e6439..2b531b3c2d 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_double_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_double_switch.lua @@ -133,6 +133,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -182,6 +185,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) test.register_message_test( @@ -229,6 +235,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -277,6 +286,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -314,7 +326,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -351,7 +366,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -388,7 +406,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -425,7 +446,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -575,7 +599,10 @@ test.register_coroutine_test( ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -624,7 +651,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_single_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_single_switch.lua index 0b40d6be33..aeabf6c725 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_single_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_single_switch.lua @@ -53,7 +53,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -71,7 +74,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -101,6 +107,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -131,6 +140,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -161,6 +173,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -191,6 +206,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -218,6 +236,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -244,6 +265,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -264,6 +288,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.button.held({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -290,6 +317,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -310,6 +340,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.button.down_hold({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -336,6 +369,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -356,6 +392,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.button.double({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -382,6 +421,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -402,6 +444,9 @@ test.register_message_test( message = mock_device:generate_test_message("main", capabilities.button.button.pushed_3x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -428,6 +473,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -447,6 +495,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -473,6 +524,9 @@ test.register_message_test( ) } }, + }, + { + min_api_version = 19 } ) @@ -492,6 +546,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 27, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -518,6 +575,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -629,7 +689,10 @@ test.register_coroutine_test( ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_eu.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_eu.lua index 58ef03fc3f..37a567ce5e 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_eu.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_eu.lua @@ -106,7 +106,10 @@ test.register_coroutine_test( ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_uk_configuration.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_uk_configuration.lua index 44aae0f2fa..262fb111d4 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_uk_configuration.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_uk_configuration.lua @@ -55,7 +55,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_us.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_us.lua index 8aa815e829..248e565e01 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_us.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_wall_plug_us.lua @@ -69,6 +69,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}, {dst_channels = {1}}) ) }, + }, + { + min_api_version = 19 } ) @@ -103,6 +106,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}, {dst_channels = {1}}) ) }, + }, + { + min_api_version = 19 } ) @@ -134,6 +140,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.powerMeter.power({ value = 55, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -165,6 +174,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("smartplug1", capabilities.powerMeter.power({ value = 89, unit = "W" })) } + }, + { + min_api_version = 19 } ) @@ -196,6 +208,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -227,6 +242,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("smartplug1", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -238,7 +256,10 @@ test.register_coroutine_test( mock_device, SwitchBinary:Set({target_value=0xFF},{dst_channels={1}}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -317,7 +338,10 @@ test.register_coroutine_test( ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_dimmer_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_dimmer_preferences.lua index db69dc9845..412b137c14 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_dimmer_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_dimmer_preferences.lua @@ -51,7 +51,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -71,7 +75,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -91,7 +99,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -111,7 +123,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -131,7 +147,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -152,7 +172,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -172,7 +196,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua index f4e41b5bee..10c27f89ba 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua @@ -115,6 +115,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -168,6 +171,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -212,6 +218,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -243,6 +252,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -296,6 +308,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -349,6 +364,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -393,6 +411,9 @@ test.register_message_test( { device_uuid = mock_child.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -429,6 +450,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -496,7 +520,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -562,7 +589,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -626,7 +656,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -692,7 +725,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -733,7 +769,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -765,7 +804,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -797,7 +839,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch_preferences.lua index 2771cbc3a7..83743d1e3a 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch_preferences.lua @@ -51,7 +51,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -68,7 +71,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -85,7 +91,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -102,7 +111,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -119,7 +131,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -136,7 +151,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_generic_zwave_device1.lua b/drivers/SmartThings/zwave-switch/src/test/test_generic_zwave_device1.lua index 309d2c79b0..26a8261d9b 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_generic_zwave_device1.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_generic_zwave_device1.lua @@ -44,7 +44,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -69,7 +70,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -110,6 +112,9 @@ test.register_message_test( { device_uuid = mock_zwave_device1.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -137,6 +142,9 @@ test.register_message_test( { device_uuid = mock_zwave_device1.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -177,6 +185,9 @@ test.register_message_test( { device_uuid = mock_zwave_device1.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -203,7 +214,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -229,7 +243,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) local level = 49 @@ -256,7 +273,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_go_control_plug_in_switch_configuraton.lua b/drivers/SmartThings/zwave-switch/src/test/test_go_control_plug_in_switch_configuraton.lua index 9b72af072e..3b322000ab 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_go_control_plug_in_switch_configuraton.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_go_control_plug_in_switch_configuraton.lua @@ -47,7 +47,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_honeywell_dimmer.lua b/drivers/SmartThings/zwave-switch/src/test/test_honeywell_dimmer.lua index 4125fc6f00..2dc8087d3d 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_honeywell_dimmer.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_honeywell_dimmer.lua @@ -53,7 +53,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number=10, configuration_value=1, size=2}) )) mock_dimmer:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_2_channel_smart_plug.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_2_channel_smart_plug.lua index bc752ec6f1..bf707557da 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_2_channel_smart_plug.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_2_channel_smart_plug.lua @@ -95,6 +95,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -156,6 +159,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -196,6 +202,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -236,6 +245,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -276,6 +288,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -316,6 +331,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -385,6 +403,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -455,6 +476,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -512,6 +536,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -569,6 +596,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -630,6 +660,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -691,6 +724,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -736,6 +772,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -781,6 +820,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -818,6 +860,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -856,6 +901,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -893,6 +941,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) @@ -931,6 +982,9 @@ test.register_message_test( }) ) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_button.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_button.lua index 0863f9eb43..0a570a6263 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_button.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_button.lua @@ -129,7 +129,10 @@ test.register_coroutine_test( ) ) end - end + end, + { + min_api_version = 19 + } ) @@ -154,6 +157,9 @@ test.register_message_test( direction = "send", message = mock_inovelli_dimmer:generate_test_message("button2", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -178,6 +184,9 @@ test.register_message_test( direction = "send", message = mock_inovelli_dimmer:generate_test_message("button1", capabilities.button.button.pushed_4x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -202,6 +211,9 @@ test.register_message_test( direction = "send", message = mock_inovelli_dimmer:generate_test_message("button3", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer.lua index d7dfe35b24..0f8aa8b1c1 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer.lua @@ -46,7 +46,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -71,7 +72,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -99,6 +101,7 @@ test.register_message_test( } }, { + min_api_version = 19 } ) @@ -131,7 +134,11 @@ do direction = "send", message = mock_inovelli_dimmer:generate_test_message("main", capabilities.switchLevel.level(level)) } + }, + { + min_api_version = 19 } + ) end @@ -160,7 +167,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -188,7 +198,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) do @@ -218,7 +231,10 @@ do SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_led.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_led.lua index 6df8b97048..63bdb67d50 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_led.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_led.lua @@ -97,7 +97,11 @@ do Configuration:Get({ parameter_number=LED_COLOR_CONTROL_PARAMETER_NUMBER }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -129,7 +133,11 @@ do direction = "send", message = mock_inovelli_dimmer:generate_test_message(LED_BAR_COMPONENT_NAME, capabilities.colorControl.saturation(LED_GENERIC_SATURATION)) } + }, + { + min_api_version = 19 } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_power_energy.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_power_energy.lua index eab58c99f9..add536f97a 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_power_energy.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_power_energy.lua @@ -69,7 +69,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -110,7 +111,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -132,7 +134,11 @@ do direction = "send", message = mock_inovelli_dimmer:generate_test_message("main", capabilities.energyMeter.energy({ value = energy, unit = "kWh" })) } + }, + { + min_api_version = 19 } + ) end @@ -154,7 +160,11 @@ do direction = "send", message = mock_inovelli_dimmer:generate_test_message("main", capabilities.powerMeter.power({ value = power, unit = "W" })) } + }, + { + min_api_version = 19 } + ) end @@ -188,6 +198,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -228,7 +241,11 @@ do Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } + ) end @@ -257,7 +274,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -285,7 +305,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) do @@ -315,7 +338,11 @@ do SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_preferences.lua index 43dd38ee7f..a473ddda1b 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_preferences.lua @@ -54,7 +54,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -78,7 +82,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -102,7 +110,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -126,7 +138,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -151,7 +167,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_scenes.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_scenes.lua index 316b9b1254..681bb514a0 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_scenes.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_dimmer_scenes.lua @@ -57,6 +57,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button2", capabilities.button.button.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -77,6 +80,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button2", capabilities.button.button.pushed_2x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -97,6 +103,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button2", capabilities.button.button.pushed_3x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -117,6 +126,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button2", capabilities.button.button.pushed_4x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -137,6 +149,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button2", capabilities.button.button.pushed_5x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -157,6 +172,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button1", capabilities.button.button.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -177,6 +195,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button1", capabilities.button.button.pushed_2x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -197,6 +218,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button1", capabilities.button.button.pushed_3x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -217,6 +241,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button1", capabilities.button.button.pushed_4x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -237,6 +264,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button1", capabilities.button.button.pushed_5x({ state_change = true })) } + }, + { + min_api_version = 19 } ) @@ -257,6 +287,9 @@ test.register_message_test( message = mock_inovelli_dimmer:generate_test_message("button3", capabilities.button.button.pushed({ state_change = true })) } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn.lua index 5593ced043..7163c70a17 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn.lua @@ -128,7 +128,10 @@ test.register_coroutine_test( Notification:Get({notification_type = Notification.notification_type.HOME_SECURITY, event = Notification.event.home_security.MOTION_DETECTION}) ) ) - end + end, + { + min_api_version = 19 + } ) -- Test switch on command @@ -154,7 +157,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) -- Test switch off command @@ -180,7 +186,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) -- Test switch level command @@ -211,7 +220,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) -- Test central scene notifications @@ -235,7 +247,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -260,7 +273,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -318,7 +332,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn_child.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn_child.lua index 40213851c7..d8dfbc89a9 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn_child.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn_child.lua @@ -89,7 +89,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -142,7 +143,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) -- Test child device switch off command @@ -173,7 +177,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) -- Test child device level command @@ -229,7 +236,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) -- Test child device color command @@ -289,7 +299,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) -- Test child device color temperature command @@ -329,7 +342,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn_preferences.lua index 8cccb5726e..8d3e25bd9e 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_inovelli_vzw32_sn_preferences.lua @@ -58,7 +58,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -80,7 +84,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -102,7 +110,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -124,7 +136,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -144,8 +160,13 @@ do parent_device_id = mock_inovelli_vzw32_sn.id, parent_assigned_child_key = "notification" }) - end + end, + { + min_api_version = 19 + } + ) end -test.run_registered_tests() \ No newline at end of file +test.run_registered_tests() + diff --git a/drivers/SmartThings/zwave-switch/src/test/test_multi_metering_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_multi_metering_switch.lua index 11a79bc12d..1f761dc11c 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_multi_metering_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_multi_metering_switch.lua @@ -114,7 +114,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -163,7 +166,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -212,7 +218,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -237,6 +246,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -262,6 +274,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -287,6 +302,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -312,6 +330,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -358,7 +379,10 @@ test.register_coroutine_test( )) mock_parent_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -398,6 +422,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -438,6 +465,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -465,7 +495,11 @@ do message = mock_parent_device:generate_test_message( "main", capabilities.energyMeter.energy({ value = energy, unit = "kWh" })) } + }, + { + min_api_version = 19 } + ) end @@ -495,7 +529,11 @@ do "main", capabilities.energyMeter.energy({ value = energy, unit = "kWh" }) ) } + }, + { + min_api_version = 19 } + ) end @@ -523,7 +561,11 @@ do message = mock_parent_device:generate_test_message( "main", capabilities.powerMeter.power({ value = power, unit = "W" })) } + }, + { + min_api_version = 19 } + ) end @@ -551,7 +593,11 @@ do message = mock_child_device:generate_test_message( "main", capabilities.powerMeter.power({ value = power, unit = "W" })) } + }, + { + min_api_version = 19 } + ) end @@ -582,7 +628,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -612,7 +661,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) do @@ -703,7 +755,11 @@ do ) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -716,7 +772,10 @@ test.register_coroutine_test( current_value = 0xFF }) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_multichannel_device.lua b/drivers/SmartThings/zwave-switch/src/test/test_multichannel_device.lua index 7f584e3125..0884e87c58 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_multichannel_device.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_multichannel_device.lua @@ -167,6 +167,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -201,6 +204,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -235,6 +241,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -269,6 +278,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -316,6 +328,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -358,6 +373,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -400,6 +418,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -447,6 +468,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -494,6 +518,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -536,6 +563,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -578,6 +608,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -625,6 +658,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -665,6 +701,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -705,6 +744,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -745,6 +787,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -785,6 +830,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -838,6 +886,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -878,6 +929,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -931,6 +985,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -998,6 +1055,9 @@ test.register_message_test( SwitchMultilevel:Get({}, { dst_channels = { 5 } }) ) }, + }, + { + min_api_version = 19 } ) @@ -1038,7 +1098,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1079,7 +1140,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1120,7 +1182,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1164,6 +1227,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -1215,6 +1281,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -1241,6 +1310,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.contactSensor.contact.open()) } + }, + { + min_api_version = 19 } ) @@ -1267,6 +1339,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -1298,6 +1373,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.motionSensor.motion.active()) } + }, + { + min_api_version = 19 } ) @@ -1329,6 +1407,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -1450,6 +1531,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.contactSensor.contact.closed()) } + }, + { + min_api_version = 19 } ) @@ -1571,6 +1655,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.motionSensor.motion.inactive()) } + }, + { + min_api_version = 19 } ) @@ -1697,6 +1784,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -1723,6 +1813,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -1749,6 +1842,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -1775,6 +1871,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.smokeDetector.smoke.detected()) } + }, + { + min_api_version = 19 } ) @@ -1801,6 +1900,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.smokeDetector.smoke.clear()) } + }, + { + min_api_version = 19 } ) @@ -1827,6 +1929,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -1853,6 +1958,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -1879,6 +1987,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -1905,6 +2016,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -1931,6 +2045,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -1957,6 +2074,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -1983,6 +2103,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.waterSensor.water.wet()) } + }, + { + min_api_version = 19 } ) @@ -2009,6 +2132,9 @@ test.register_message_test( direction = "send", message = mock_child_4:generate_test_message("main", capabilities.waterSensor.water.dry()) } + }, + { + min_api_version = 19 } ) @@ -2044,6 +2170,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -2070,6 +2199,9 @@ test.register_message_test( direction = "send", message = mock_child_5:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 70 })) } + }, + { + min_api_version = 19 } ) @@ -2097,6 +2229,9 @@ test.register_message_test( direction = "send", message = mock_child_5:generate_test_message("main", capabilities.illuminanceMeasurement.illuminance({ value = 400, unit = "lux" })) } + }, + { + min_api_version = 19 } ) @@ -2145,7 +2280,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -2200,7 +2336,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -2327,7 +2464,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -2370,7 +2508,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -2390,6 +2529,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -2406,7 +2548,10 @@ test.register_coroutine_test( base_parent:expect_device_create( prepare_metadata(base_parent, 1, "metering-switch") ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -2425,6 +2570,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -2441,7 +2589,10 @@ test.register_coroutine_test( base_parent:expect_device_create( prepare_metadata(base_parent, 3, "metering-dimmer") ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -2460,6 +2611,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -2476,7 +2630,10 @@ test.register_coroutine_test( base_parent:expect_device_create( prepare_metadata(base_parent, 4, "generic-sensor") ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -2495,6 +2652,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -2511,7 +2671,10 @@ test.register_coroutine_test( base_parent:expect_device_create( prepare_metadata(base_parent, 5, "generic-multi-sensor") ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_popp_outdoor_plug_configuration.lua b/drivers/SmartThings/zwave-switch/src/test/test_popp_outdoor_plug_configuration.lua index 165dab059e..6190872abd 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_popp_outdoor_plug_configuration.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_popp_outdoor_plug_configuration.lua @@ -47,7 +47,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_din_dimmer.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_din_dimmer.lua index 9cec4ecd4e..9a69692271 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_din_dimmer.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_din_dimmer.lua @@ -68,7 +68,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -121,7 +124,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -159,6 +163,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -197,6 +204,9 @@ test.register_message_test( {scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -238,6 +248,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -292,6 +305,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -321,6 +337,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -342,6 +361,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -358,7 +380,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -424,7 +449,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -491,7 +519,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -522,7 +553,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_din_dimmer_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_din_dimmer_preferences.lua index 920c6c5b2f..f80ebcbca4 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_din_dimmer_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_din_dimmer_preferences.lua @@ -54,7 +54,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -74,7 +78,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -94,7 +102,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -114,7 +126,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -134,7 +150,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -155,7 +175,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -175,7 +199,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_1_relay_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_1_relay_preferences.lua index d44eb8f7cb..c88d4fbd88 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_1_relay_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_1_relay_preferences.lua @@ -46,7 +46,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -66,7 +70,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -86,7 +94,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -106,7 +118,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -126,7 +142,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_1d_relay_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_1d_relay_preferences.lua index 3436ccba26..a927de9f78 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_1d_relay_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_1d_relay_preferences.lua @@ -46,7 +46,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -66,7 +70,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -86,7 +94,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_2_relay.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_2_relay.lua index 61a62ef0d7..1da5aa3446 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_2_relay.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_2_relay.lua @@ -104,7 +104,10 @@ test.register_coroutine_test( { dst_channels = { 1 } } ) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -133,7 +136,10 @@ test.register_coroutine_test( { dst_channels = { 2 } } ) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -151,7 +157,10 @@ test.register_coroutine_test( { encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = { 3 } } ) )) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -177,7 +186,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -204,7 +214,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -228,7 +239,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -252,7 +264,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -277,6 +290,9 @@ test.register_message_test( direction = "send", message = mock_parent_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -301,6 +317,9 @@ test.register_message_test( direction = "send", message = mock_child_2_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -333,6 +352,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -365,6 +387,9 @@ test.register_message_test( { device_uuid = mock_parent_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -391,6 +416,9 @@ test.register_message_test( "main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' }) ) } + }, + { + min_api_version = 19 } ) @@ -430,7 +458,10 @@ test.register_coroutine_test( mock_parent_device, Meter:Get({ scale = Meter.scale.electric_meter.KILOWATT_HOURS }, { dst_channels = { 1 } }) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -469,7 +500,10 @@ test.register_coroutine_test( mock_parent_device, Meter:Get({ scale = Meter.scale.electric_meter.KILOWATT_HOURS }, { dst_channels = { 1 } }) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -508,7 +542,10 @@ test.register_coroutine_test( mock_parent_device, Meter:Get({ scale = Meter.scale.electric_meter.KILOWATT_HOURS }, { dst_channels = { 2 } }) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -547,7 +584,10 @@ test.register_coroutine_test( mock_parent_device, Meter:Get({ scale = Meter.scale.electric_meter.KILOWATT_HOURS }, { dst_channels = { 2 } }) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -597,7 +637,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_2_relay_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_2_relay_preferences.lua index 3ac1fda4b4..60f2e457ae 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_2_relay_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_2_relay_preferences.lua @@ -46,7 +46,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -66,7 +70,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -86,7 +94,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -106,7 +118,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -126,7 +142,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer.lua index cfe8dccde7..92d259df4b 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer.lua @@ -59,7 +59,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -112,7 +115,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -150,6 +154,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -188,6 +195,9 @@ test.register_message_test( {scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -229,6 +239,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -283,6 +296,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -312,6 +328,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -333,6 +352,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -347,7 +369,10 @@ test.register_coroutine_test( } ) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' }))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -413,7 +438,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -480,7 +508,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -511,7 +542,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer_0_10V_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer_0_10V_preferences.lua index db28991f2d..88b7f06726 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer_0_10V_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer_0_10V_preferences.lua @@ -50,7 +50,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -70,7 +74,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -90,7 +98,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -110,7 +122,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -130,7 +146,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -154,7 +174,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -178,7 +202,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer_preferences.lua index d88d6c39b1..3addd1ec20 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_flush_dimmer_preferences.lua @@ -49,7 +49,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -69,7 +73,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -89,7 +97,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -109,7 +121,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -129,7 +145,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -149,7 +169,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -169,7 +193,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -190,7 +218,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -210,7 +242,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_mini_dimmer_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_mini_dimmer_preferences.lua index f385e0be33..0d1668fdd1 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_mini_dimmer_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_mini_dimmer_preferences.lua @@ -49,7 +49,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -69,7 +73,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -89,7 +97,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -109,7 +121,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -129,7 +145,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -150,7 +170,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -170,7 +194,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -190,7 +218,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_temperature_sensor_with_power.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_temperature_sensor_with_power.lua index ccaf9c7aec..80ba20105a 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_temperature_sensor_with_power.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_temperature_sensor_with_power.lua @@ -57,7 +57,10 @@ test.register_coroutine_test( ) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -94,6 +97,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -132,6 +138,9 @@ test.register_message_test( {scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -161,6 +170,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -182,6 +194,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -204,6 +219,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -270,7 +288,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -337,7 +358,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -378,7 +402,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_qubino_temperature_sensor_without_power.lua b/drivers/SmartThings/zwave-switch/src/test/test_qubino_temperature_sensor_without_power.lua index c06f516249..bacd11020e 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_qubino_temperature_sensor_without_power.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_qubino_temperature_sensor_without_power.lua @@ -58,6 +58,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -87,6 +90,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -109,6 +115,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -159,7 +168,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.switch.switch.on()) ) mock_device:expect_native_attr_handler_registration("switch", "switch") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -210,7 +222,10 @@ test.register_coroutine_test( mock_device:generate_test_message("main", capabilities.switch.switch.off()) ) mock_device:expect_native_attr_handler_registration("switch", "switch") - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -251,7 +266,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send( mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' })) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_shelly_multi_metering_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_shelly_multi_metering_switch.lua index 331640b1be..8cacbcf26e 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_shelly_multi_metering_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_shelly_multi_metering_switch.lua @@ -113,7 +113,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -162,7 +165,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -211,7 +217,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -236,6 +245,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -261,6 +273,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -286,6 +301,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -311,6 +329,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -351,6 +372,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -391,6 +415,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -418,7 +445,11 @@ do message = mock_parent_device:generate_test_message( "main", capabilities.energyMeter.energy({ value = energy, unit = "kWh" })) } + }, + { + min_api_version = 19 } + ) end @@ -448,7 +479,11 @@ do "main", capabilities.energyMeter.energy({ value = energy, unit = "kWh" }) ) } + }, + { + min_api_version = 19 } + ) end @@ -476,7 +511,11 @@ do message = mock_parent_device:generate_test_message( "main", capabilities.powerMeter.power({ value = power, unit = "W" })) } + }, + { + min_api_version = 19 } + ) end @@ -504,7 +543,11 @@ do message = mock_child_device:generate_test_message( "main", capabilities.powerMeter.power({ value = power, unit = "W" })) } + }, + { + min_api_version = 19 } + ) end @@ -535,7 +578,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -565,7 +611,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) do @@ -656,7 +705,11 @@ do ) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -669,7 +722,10 @@ test.register_coroutine_test( current_value = 0xFF }) }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_wyfy_touch.lua b/drivers/SmartThings/zwave-switch/src/test/test_wyfy_touch.lua index 9bc1387f2b..efd75fe27c 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_wyfy_touch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_wyfy_touch.lua @@ -69,7 +69,10 @@ test.register_coroutine_test( Configuration:Set({parameter_number = 2, size = 1, configuration_value = 1}) )) mock_parent_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -94,6 +97,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -119,6 +125,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -144,6 +153,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -169,6 +181,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -199,6 +214,9 @@ test.register_message_test( direction = "send", message = mock_parent_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -229,6 +247,9 @@ test.register_message_test( direction = "send", message = mock_child_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -260,7 +281,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -290,7 +314,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) local function prepare_metadata(device, endpoint, profile) @@ -321,7 +348,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -337,7 +367,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_wyfy_touch_configuration.lua b/drivers/SmartThings/zwave-switch/src/test/test_wyfy_touch_configuration.lua index 010607fc2d..3e1d6012e8 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_wyfy_touch_configuration.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_wyfy_touch_configuration.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( }) )) mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua b/drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua index abf41946cc..ef5c00c7e1 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua @@ -71,7 +71,10 @@ test.register_coroutine_test( }) )) mock_parent:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -119,7 +122,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -166,7 +172,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -190,6 +199,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -215,6 +227,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -239,6 +254,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -264,6 +282,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -303,6 +324,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -342,6 +366,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -381,6 +408,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -420,6 +450,9 @@ test.register_message_test( ) ) } + }, + { + min_api_version = 19 } ) @@ -441,6 +474,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -462,6 +498,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -491,6 +530,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -520,6 +562,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zooz_power_strip.lua b/drivers/SmartThings/zwave-switch/src/test/test_zooz_power_strip.lua index 477886d76e..281b75d6a2 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zooz_power_strip.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zooz_power_strip.lua @@ -83,6 +83,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -119,6 +122,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -155,6 +161,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -191,6 +200,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -227,6 +239,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -263,6 +278,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -299,6 +317,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -336,6 +357,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -373,6 +397,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -410,6 +437,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -451,6 +481,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -491,6 +524,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -531,6 +567,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -571,6 +610,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -611,6 +653,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -651,6 +696,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -691,6 +739,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -731,6 +782,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -771,6 +825,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -811,6 +868,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -870,7 +930,10 @@ test.register_coroutine_test( ) test.socket.capability:__expect_send(mock_device:generate_test_message("switch1", capabilities.switch.switch.off())) test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.switch.switch.off())) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -947,7 +1010,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1025,7 +1089,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1060,7 +1125,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1095,7 +1161,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1130,7 +1197,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1165,7 +1233,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1200,7 +1269,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1235,7 +1305,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1270,7 +1341,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1305,7 +1377,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1340,7 +1413,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -1375,7 +1449,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zooz_zen_30_dimmer_relay.lua b/drivers/SmartThings/zwave-switch/src/test/test_zooz_zen_30_dimmer_relay.lua index b3a18291e7..2d9f2a86a4 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zooz_zen_30_dimmer_relay.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zooz_zen_30_dimmer_relay.lua @@ -92,7 +92,10 @@ test.register_coroutine_test( Version:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -109,7 +112,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, { dst_channels = { 1 } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -138,6 +144,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -167,6 +176,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -204,6 +216,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -246,6 +261,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -292,6 +310,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -325,6 +346,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -354,6 +378,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -383,6 +410,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -411,7 +441,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}, { dst_channels = { 0 } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -439,7 +472,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}, { dst_channels = { 0 } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -467,7 +503,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, { dst_channels = { 1 } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -495,7 +534,10 @@ test.register_coroutine_test( SwitchBinary:Get({}, { dst_channels = { 1 } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -528,7 +570,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}, { dst_channels = { 0 } }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -574,6 +619,9 @@ test.register_message_test( { device_uuid = mock_parent.id, capability_id = "switchLevel", capability_attr_id = "level" } } }, + }, + { + min_api_version = 19 } ) @@ -598,6 +646,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.up({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -622,6 +673,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.down({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -646,6 +700,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.pushed({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -670,6 +727,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.up_2x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -694,6 +754,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.down_2x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -718,6 +781,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.pushed_2x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -742,6 +808,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.up_3x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -766,6 +835,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.down_3x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -790,6 +862,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.pushed_3x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -814,6 +889,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.up_4x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -838,6 +916,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.down_4x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -862,6 +943,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.pushed_4x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -886,6 +970,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.up_5x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -910,6 +997,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.down_5x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -934,6 +1024,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.pushed_5x({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -958,6 +1051,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.up_hold({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -982,6 +1078,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.down_hold({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -1006,6 +1105,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.button.button.held({state_change = true})) } + }, + { + min_api_version = 19 } ) @@ -1025,6 +1127,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -1050,7 +1155,10 @@ test.register_coroutine_test( } ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1075,7 +1183,10 @@ test.register_coroutine_test( } ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1111,7 +1222,10 @@ test.register_coroutine_test( }) }) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1156,7 +1270,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -1172,7 +1289,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zooz_zen_30_dimmer_relay_preferences.lua b/drivers/SmartThings/zwave-switch/src/test/test_zooz_zen_30_dimmer_relay_preferences.lua index c186f9d36b..f7a59d38b4 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zooz_zen_30_dimmer_relay_preferences.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zooz_zen_30_dimmer_relay_preferences.lua @@ -77,7 +77,11 @@ do }) ) test.wait_for_events() - end + end, + { + min_api_version = 19 + } + ) end diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_dimmer_power_energy.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_dimmer_power_energy.lua index 215cc0675d..a958fea2a6 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_dimmer_power_energy.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_dimmer_power_energy.lua @@ -70,6 +70,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -108,6 +111,9 @@ test.register_message_test( {scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -149,6 +155,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -203,6 +212,9 @@ test.register_message_test( Meter:Get({scale = Meter.scale.electric_meter.WATTS}) ) } + }, + { + min_api_version = 19 } ) @@ -232,6 +244,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -253,6 +268,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -319,7 +337,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -385,7 +406,10 @@ test.register_coroutine_test( ) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -415,7 +439,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_dual_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_dual_switch.lua index 84502e9835..9fe7a588f3 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_dual_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_dual_switch.lua @@ -80,6 +80,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -111,6 +114,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -142,6 +148,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -173,6 +182,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -204,6 +216,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -235,6 +250,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -266,6 +284,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -297,6 +318,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -334,6 +358,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -371,6 +398,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -408,6 +438,9 @@ test.register_message_test( direction = "send", message = mock_parent:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -445,6 +478,9 @@ test.register_message_test( direction = "send", message = mock_child:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -482,7 +518,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -519,7 +558,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -556,7 +598,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -593,7 +638,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -614,7 +662,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -635,7 +686,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_dual_switch_migration.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_dual_switch_migration.lua index ac396439f6..6e616bcb38 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_dual_switch_migration.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_dual_switch_migration.lua @@ -72,7 +72,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -96,7 +99,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch.lua index effb5845b4..76e0031806 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch.lua @@ -76,6 +76,9 @@ test.register_message_test( { device_uuid = mock_switch_binary.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -100,6 +103,9 @@ test.register_message_test( { device_uuid = mock_switch_binary.id, capability_id = "switch", capability_attr_id = "switch" } } }, + }, + { + min_api_version = 19 } ) @@ -122,7 +128,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -147,7 +154,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -169,7 +177,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -194,7 +203,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -226,7 +236,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -257,7 +270,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -288,7 +304,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -319,7 +338,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_battery.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_battery.lua index 26a72eb4e6..a5c4c24a95 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_battery.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_battery.lua @@ -43,6 +43,9 @@ test.register_message_test( direction = "send", message = mock_switch:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -72,7 +75,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -105,7 +109,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_electric_meter.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_electric_meter.lua index 935e4b63e8..0882b0a253 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_electric_meter.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_electric_meter.lua @@ -55,6 +55,9 @@ test.register_message_test( { device_uuid = mock_switch.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -74,6 +77,9 @@ test.register_message_test( direction = "send", message = mock_switch:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -111,7 +117,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -152,7 +159,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_energy_meter.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_energy_meter.lua index 016cb56ef1..ffdbd50f8a 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_energy_meter.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_energy_meter.lua @@ -61,6 +61,9 @@ test.register_message_test( { device_uuid = mock_switch.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -80,6 +83,9 @@ test.register_message_test( direction = "send", message = mock_switch:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -109,7 +115,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -142,7 +149,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -152,7 +160,10 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({mock_switch.id, { capability = "energyMeter", component = "main", command = "resetEnergyMeter", args = {}}}) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_switch, Meter:Reset({}))) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command( mock_switch, Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}))) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_level.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_level.lua index c8cca92dfb..cb8d35a953 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_level.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_level.lua @@ -45,7 +45,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -70,7 +71,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_power_meter.lua b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_power_meter.lua index edec7aefba..f377c003ca 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_power_meter.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zwave_switch_power_meter.lua @@ -66,6 +66,9 @@ test.register_message_test( { device_uuid = mock_switch.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -80,6 +83,9 @@ test.register_message_test( meter_value = 5}) )} }, + }, + { + min_api_version = 19 } ) @@ -109,7 +115,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -142,7 +149,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) diff --git a/drivers/SmartThings/zwave-thermostat/src/test/test_aeotec_radiator_thermostat.lua b/drivers/SmartThings/zwave-thermostat/src/test/test_aeotec_radiator_thermostat.lua index 69034f9b5a..4df09a847a 100755 --- a/drivers/SmartThings/zwave-thermostat/src/test/test_aeotec_radiator_thermostat.lua +++ b/drivers/SmartThings/zwave-thermostat/src/test/test_aeotec_radiator_thermostat.lua @@ -94,7 +94,8 @@ test.register_message_test( -- }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -111,6 +112,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -127,6 +131,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -155,6 +162,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -172,6 +182,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode({ value = "heat" })) } + }, + { + min_api_version = 19 } ) @@ -192,6 +205,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -217,7 +233,10 @@ test.register_coroutine_test( ThermostatMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -247,7 +266,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-thermostat/src/test/test_ct100_thermostat.lua b/drivers/SmartThings/zwave-thermostat/src/test/test_ct100_thermostat.lua index 55a35dd2a9..cbc269824f 100644 --- a/drivers/SmartThings/zwave-thermostat/src/test/test_ct100_thermostat.lua +++ b/drivers/SmartThings/zwave-thermostat/src/test/test_ct100_thermostat.lua @@ -136,7 +136,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -162,7 +163,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({value = 68, unit = "C"}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -187,7 +191,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({value = 68, unit = "C"}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -212,7 +219,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({value = 45}) )) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -268,6 +278,9 @@ test.register_message_test( ThermostatSetpoint:Get({setpoint_type = ThermostatSetpoint.setpoint_type.COOLING_1}) ) } + }, + { + min_api_version = 19 } ) @@ -324,6 +337,9 @@ test.register_message_test( ThermostatSetpoint:Get({setpoint_type = ThermostatSetpoint.setpoint_type.HEATING_1}) ) } + }, + { + min_api_version = 19 } ) @@ -386,7 +402,10 @@ test.register_coroutine_test( ThermostatOperatingState:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -452,7 +471,10 @@ test.register_coroutine_test( ThermostatOperatingState:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) -- these next two tests are based on actual messages from a real device @@ -475,7 +497,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 60.0, unit = 'F'}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -497,7 +522,10 @@ test.register_coroutine_test( test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({value = 48}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-thermostat/src/test/test_fibaro_heat_controller.lua b/drivers/SmartThings/zwave-thermostat/src/test/test_fibaro_heat_controller.lua index cac8b883e4..58d263cd6e 100644 --- a/drivers/SmartThings/zwave-thermostat/src/test/test_fibaro_heat_controller.lua +++ b/drivers/SmartThings/zwave-thermostat/src/test/test_fibaro_heat_controller.lua @@ -115,7 +115,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -172,7 +173,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -189,6 +191,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -209,6 +214,9 @@ test.register_message_test( direction = "send", message = mock_device_extended:generate_test_message("extraTemperatureSensor", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -225,6 +233,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -253,6 +264,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -270,6 +284,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode({ value = "heat" })) } + }, + { + min_api_version = 19 } ) @@ -290,6 +307,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -333,7 +353,10 @@ test.register_coroutine_test( Configuration:Get({parameter_number = 3}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -358,7 +381,10 @@ test.register_coroutine_test( ThermostatMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -388,7 +414,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-thermostat/src/test/test_popp_radiator_thermostat.lua b/drivers/SmartThings/zwave-thermostat/src/test/test_popp_radiator_thermostat.lua index 3671cd4029..5aea3afd5a 100755 --- a/drivers/SmartThings/zwave-thermostat/src/test/test_popp_radiator_thermostat.lua +++ b/drivers/SmartThings/zwave-thermostat/src/test/test_popp_radiator_thermostat.lua @@ -60,6 +60,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -76,6 +79,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -104,6 +110,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -124,6 +133,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -145,7 +157,10 @@ test.register_coroutine_test( ) test.mock_time.advance_time(200) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -186,7 +201,10 @@ test.register_coroutine_test( mock_device, ThermostatSetpoint:Get({setpoint_type = ThermostatSetpoint.setpoint_type.HEATING_1})) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-thermostat/src/test/test_qubino_flush_thermostat.lua b/drivers/SmartThings/zwave-thermostat/src/test/test_qubino_flush_thermostat.lua index 2c9b04d82d..15ccb6ee9a 100644 --- a/drivers/SmartThings/zwave-thermostat/src/test/test_qubino_flush_thermostat.lua +++ b/drivers/SmartThings/zwave-thermostat/src/test/test_qubino_flush_thermostat.lua @@ -122,7 +122,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -144,7 +145,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -168,6 +170,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -186,6 +191,9 @@ test.register_message_test( ) } } + }, + { + min_api_version = 19 } ) @@ -203,6 +211,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode({ value = "heat" })) } + }, + { + min_api_version = 19 } ) @@ -227,6 +238,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -251,6 +265,9 @@ test.register_message_test( direction = "send", message = mock_device_cooling:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -305,7 +322,10 @@ test.register_coroutine_test( Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -354,7 +374,10 @@ test.register_coroutine_test( Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -379,7 +402,10 @@ test.register_coroutine_test( ThermostatMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -409,7 +435,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -434,6 +463,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.heating()) } + }, + { + min_api_version = 19 } ) @@ -453,6 +485,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.energyMeter.energy({ value = 5, unit = "kWh" })) } + }, + { + min_api_version = 19 } ) @@ -480,6 +515,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "powerMeter", capability_attr_id = "power" } } } + }, + { + min_api_version = 19 } ) @@ -530,7 +568,10 @@ test.register_coroutine_test( Configuration:Get({ parameter_number = 59 }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-thermostat/src/test/test_stelpro_ki_thermostat.lua b/drivers/SmartThings/zwave-thermostat/src/test/test_stelpro_ki_thermostat.lua index 2c9c370bec..0222443eb7 100644 --- a/drivers/SmartThings/zwave-thermostat/src/test/test_stelpro_ki_thermostat.lua +++ b/drivers/SmartThings/zwave-thermostat/src/test/test_stelpro_ki_thermostat.lua @@ -66,7 +66,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -102,6 +105,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 33, unit = 'C'})) } + }, + { + min_api_version = 19 } ) @@ -138,6 +144,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 55, unit = 'F'})) } + }, + { + min_api_version = 19 } ) @@ -179,6 +188,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 30, unit = 'F'})) } + }, + { + min_api_version = 19 } ) @@ -220,6 +232,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureMeasurement.temperature({value = 122, unit = 'F'})) } + }, + { + min_api_version = 19 } ) @@ -256,6 +271,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.freeze()) } + }, + { + min_api_version = 19 } ) @@ -292,6 +310,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.temperatureAlarm.temperatureAlarm.heat()) } + }, + { + min_api_version = 19 } ) @@ -307,6 +328,9 @@ test.register_message_test( energy_save_heat = true })) } } + }, + { + min_api_version = 19 } ) @@ -325,6 +349,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode({ value = "eco" })) } + }, + { + min_api_version = 19 } ) @@ -348,7 +375,10 @@ test.register_coroutine_test( ThermostatMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) diff --git a/drivers/SmartThings/zwave-thermostat/src/test/test_thermostat_heating_battery.lua b/drivers/SmartThings/zwave-thermostat/src/test/test_thermostat_heating_battery.lua index 9680419946..827dc87b57 100644 --- a/drivers/SmartThings/zwave-thermostat/src/test/test_thermostat_heating_battery.lua +++ b/drivers/SmartThings/zwave-thermostat/src/test/test_thermostat_heating_battery.lua @@ -102,7 +102,10 @@ test.register_coroutine_test( "doConfigure() should generate WakeUp:IntervalSet", function() do_initial_setup() - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -118,6 +121,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -147,7 +153,10 @@ test.register_coroutine_test( mock_device, WakeUp:IntervalGet({}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -206,7 +215,10 @@ test.register_coroutine_test( zw_test_utilities.zwave_test_build_send_command(mock_device, Clock:Set({hour=now.hour, minute=now.min, weekday=WEEK[now.wday]})) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -225,6 +237,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({value = 25, unit = "C"})) }, + }, + { + min_api_version = 19 } ) @@ -254,6 +269,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({value = 4, unit = "C"})) }, + }, + { + min_api_version = 19 } ) @@ -283,6 +301,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({value = 28, unit = "C"})) }, + }, + { + min_api_version = 19 } ) @@ -309,7 +330,10 @@ test.register_coroutine_test( capabilities.thermostatHeatingSetpoint.heatingSetpoint({value = 50, unit = "F"}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -399,7 +423,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -510,7 +537,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -610,7 +640,10 @@ test.register_coroutine_test( {mock_device.id, zw_test_utilities.zwave_test_build_receive_command(WakeUp:Notification({}))} ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -693,7 +726,10 @@ test.register_coroutine_test( }) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -732,7 +768,10 @@ test.register_coroutine_test( mock_device, WakeUp:IntervalGet({}) )) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -769,7 +808,10 @@ test.register_coroutine_test( WakeUp:IntervalGet({}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-thermostat/src/test/test_zwave_thermostat.lua b/drivers/SmartThings/zwave-thermostat/src/test/test_zwave_thermostat.lua index ea14555a0a..f2a96b5c26 100644 --- a/drivers/SmartThings/zwave-thermostat/src/test/test_zwave_thermostat.lua +++ b/drivers/SmartThings/zwave-thermostat/src/test/test_zwave_thermostat.lua @@ -143,7 +143,8 @@ test.register_message_test( table.unpack(refresh_commands) }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -161,7 +162,8 @@ test.register_message_test( table.unpack(refresh_commands) }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -178,6 +180,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(99)) } + }, + { + min_api_version = 19 } ) @@ -194,6 +199,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.battery.battery(1)) } + }, + { + min_api_version = 19 } ) @@ -216,6 +224,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.supportedThermostatModes({ "off", "heat", "cool", "auto" }, {visibility={displayed=false}})) } + }, + { + min_api_version = 19 } ) @@ -237,6 +248,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatFanMode.supportedThermostatFanModes({ "on", "auto", "circulate" }, {visibility={displayed=false}})) } + }, + { + min_api_version = 19 } ) @@ -265,6 +279,9 @@ test.register_message_test( { device_uuid = mock_device.id, capability_id = "temperatureMeasurement", capability_attr_id = "temperature" } } } + }, + { + min_api_version = 19 } ) @@ -285,6 +302,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.relativeHumidityMeasurement.humidity({ value = 22 })) } + }, + { + min_api_version = 19 } ) @@ -302,6 +322,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatMode.thermostatMode({ value = "heat" })) } + }, + { + min_api_version = 19 } ) @@ -319,6 +342,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatFanMode.thermostatFanMode({ value = "circulate" })) } + }, + { + min_api_version = 19 } ) @@ -339,6 +365,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatHeatingSetpoint.heatingSetpoint({ value = 21.5, unit = 'C' })) } + }, + { + min_api_version = 19 } ) @@ -359,6 +388,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatCoolingSetpoint.coolingSetpoint({ value = 68, unit = 'F' })) } + }, + { + min_api_version = 19 } ) @@ -384,6 +416,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.thermostatOperatingState.thermostatOperatingState.heating()) } + }, + { + min_api_version = 19 } ) @@ -409,7 +444,10 @@ test.register_coroutine_test( ThermostatFanMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -434,7 +472,10 @@ test.register_coroutine_test( ThermostatFanMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -459,7 +500,10 @@ test.register_coroutine_test( ThermostatFanMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -484,7 +528,10 @@ test.register_coroutine_test( ThermostatMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -509,7 +556,10 @@ test.register_coroutine_test( ThermostatMode:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -539,7 +589,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -590,7 +643,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -640,7 +696,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -692,7 +751,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-valve/src/test/test_inverse.valve.lua b/drivers/SmartThings/zwave-valve/src/test/test_inverse.valve.lua index 68c563061b..51314225e3 100644 --- a/drivers/SmartThings/zwave-valve/src/test/test_inverse.valve.lua +++ b/drivers/SmartThings/zwave-valve/src/test/test_inverse.valve.lua @@ -47,6 +47,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.closed()) } + }, + { + min_api_version = 19 } ) @@ -65,6 +68,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.open()) } + }, + { + min_api_version = 19 } ) @@ -83,6 +89,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.open()) } + }, + { + min_api_version = 19 } ) @@ -101,6 +110,9 @@ test.register_message_test( direction = "send", message = mock_device:generate_test_message("main", capabilities.valve.valve.closed()) } + }, + { + min_api_version = 19 } ) @@ -131,7 +143,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -161,7 +176,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-valve/src/test/test_zwave_valve.lua b/drivers/SmartThings/zwave-valve/src/test/test_zwave_valve.lua index efa0c42599..add1f0b77d 100644 --- a/drivers/SmartThings/zwave-valve/src/test/test_zwave_valve.lua +++ b/drivers/SmartThings/zwave-valve/src/test/test_zwave_valve.lua @@ -69,6 +69,9 @@ test.register_message_test( direction = "send", message = mock_valve_binary:generate_test_message("main", capabilities.valve.valve.open()) } + }, + { + min_api_version = 19 } ) @@ -85,6 +88,9 @@ test.register_message_test( direction = "send", message = mock_valve_binary:generate_test_message("main", capabilities.valve.valve.closed()) } + }, + { + min_api_version = 19 } ) @@ -114,7 +120,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -144,7 +151,8 @@ test.register_message_test( }, }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -175,7 +183,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -205,7 +216,10 @@ test.register_coroutine_test( Basic:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -235,7 +249,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -265,7 +282,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-virtual-momentary-switch/src/test/test_zwave_virtual_momentary_switch.lua b/drivers/SmartThings/zwave-virtual-momentary-switch/src/test/test_zwave_virtual_momentary_switch.lua index dffe6b2f38..9f46989f3e 100644 --- a/drivers/SmartThings/zwave-virtual-momentary-switch/src/test/test_zwave_virtual_momentary_switch.lua +++ b/drivers/SmartThings/zwave-virtual-momentary-switch/src/test/test_zwave_virtual_momentary_switch.lua @@ -65,6 +65,9 @@ test.register_message_test( direction = "send", message = mock_momentary_switch:generate_test_message("main", capabilities.switch.switch.on()) } + }, + { + min_api_version = 19 } ) @@ -81,6 +84,9 @@ test.register_message_test( direction = "send", message = mock_momentary_switch:generate_test_message("main", capabilities.switch.switch.off()) } + }, + { + min_api_version = 19 } ) @@ -106,7 +112,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -128,7 +135,8 @@ test.register_message_test( } }, { - inner_block_ordering = "relaxed" + inner_block_ordering = "relaxed", + min_api_version = 19 } ) @@ -176,7 +184,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) @@ -223,7 +234,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -250,7 +264,10 @@ test.register_coroutine_test( SwitchBinary:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-window-treatment/src/test/test_fibaro_roller_shutter.lua b/drivers/SmartThings/zwave-window-treatment/src/test/test_fibaro_roller_shutter.lua index c601ba630f..651f6d9281 100644 --- a/drivers/SmartThings/zwave-window-treatment/src/test/test_fibaro_roller_shutter.lua +++ b/drivers/SmartThings/zwave-window-treatment/src/test/test_fibaro_roller_shutter.lua @@ -66,6 +66,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_roller_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) } + }, + { + min_api_version = 19 } ) @@ -89,6 +92,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_roller_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50)) } + }, + { + min_api_version = 19 } ) @@ -112,6 +118,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_roller_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) } + }, + { + min_api_version = 19 } ) @@ -142,6 +151,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_roller_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) } + }, + { + min_api_version = 19 } ) @@ -172,6 +184,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_roller_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50)) } + }, + { + min_api_version = 19 } ) @@ -202,6 +217,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_roller_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) } + }, + { + min_api_version = 19 } ) @@ -233,7 +251,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -264,7 +285,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -283,7 +307,10 @@ test.register_coroutine_test( SwitchMultilevel:StopLevelChange({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -314,7 +341,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -345,7 +375,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -370,6 +403,9 @@ test.register_message_test( direction = "send", message = mock_fibaro_roller_shutter_venetian:generate_test_message("venetianBlind", capabilities.windowShadeLevel.shadeLevel(50)) } + }, + { + min_api_version = 19 } ) @@ -393,7 +429,10 @@ test.register_coroutine_test( test.socket.zwave:__queue_receive({mock_fibaro_roller_shutter.id, Configuration:Report({ parameter_number = 150, configuration_value = 1 }) }) test.wait_for_events() assert(mock_fibaro_roller_shutter:get_field("calibration") == "done", "Calibration should be done") - end + end, + { + min_api_version = 19 + } ) do @@ -415,7 +454,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -438,7 +481,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -461,7 +508,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -484,7 +535,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -507,7 +562,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -530,7 +589,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -553,7 +616,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -576,7 +643,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -599,7 +670,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -622,7 +697,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -645,7 +724,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -668,7 +751,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -691,7 +778,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -714,7 +805,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -737,7 +832,43 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end +test.register_coroutine_test( + "Configuration:Report for OPERATING_MODE=1 should update to roller shutter profile", + function() + test.socket.zwave:__queue_receive({ + mock_fibaro_roller_shutter_venetian.id, + zw_test_utils.zwave_test_build_receive_command( + Configuration:Report({ parameter_number = 151, configuration_value = 1 }) + ) + }) + mock_fibaro_roller_shutter_venetian:expect_metadata_update({ profile = "fibaro-roller-shutter" }) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Configuration:Report for OPERATING_MODE=2 should update to venetian profile", + function() + test.socket.zwave:__queue_receive({ + mock_fibaro_roller_shutter_venetian.id, + zw_test_utils.zwave_test_build_receive_command( + Configuration:Report({ parameter_number = 151, configuration_value = 2 }) + ) + }) + mock_fibaro_roller_shutter_venetian:expect_metadata_update({ profile = "fibaro-roller-shutter-venetian" }) + end, + { + min_api_version = 19 + } +) + test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-window-treatment/src/test/test_qubino_flush_shutter.lua b/drivers/SmartThings/zwave-window-treatment/src/test/test_qubino_flush_shutter.lua index edaffb4214..0449cc759b 100644 --- a/drivers/SmartThings/zwave-window-treatment/src/test/test_qubino_flush_shutter.lua +++ b/drivers/SmartThings/zwave-window-treatment/src/test/test_qubino_flush_shutter.lua @@ -74,6 +74,9 @@ test.register_message_test( direction = "send", message = mock_qubino_flush_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) } + }, + { + min_api_version = 19 } ) @@ -104,6 +107,9 @@ test.register_message_test( direction = "send", message = mock_qubino_flush_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50)) } + }, + { + min_api_version = 19 } ) @@ -134,6 +140,9 @@ test.register_message_test( direction = "send", message = mock_qubino_flush_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) } + }, + { + min_api_version = 19 } ) @@ -164,7 +173,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -194,7 +206,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -213,7 +228,10 @@ test.register_coroutine_test( SwitchMultilevel:StopLevelChange({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -244,7 +262,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -274,7 +295,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -299,6 +323,9 @@ test.register_message_test( direction = "send", message = mock_qubino_flush_shutter_venetian:generate_test_message("venetianBlind", capabilities.windowShadeLevel.shadeLevel(50)) } + }, + { + min_api_version = 19 } ) @@ -329,7 +356,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}, {encap = zw.ENCAP.AUTO, src_channel = 0, dst_channels = {2}}) ) ) - end + end, + { + min_api_version = 19 + } ) do @@ -351,7 +381,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -374,7 +408,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -397,7 +435,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -420,7 +462,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -443,7 +489,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -466,7 +516,11 @@ do }) ) ) - end + end, + { + min_api_version = 19 + } + ) end @@ -507,125 +561,134 @@ test.register_coroutine_test( capabilities.windowShade.supportedWindowShadeCommands({"open", "close", "pause"}, { visibility = { displayed = false }}) ) ) - end + end, + { + min_api_version = 19 + } ) -do - test.register_coroutine_test( - "Mode should be changed to venetian blinds after receiving configuration report with value 1", - function() - test.wait_for_events() - test.socket.zwave:__queue_receive({ - mock_qubino_flush_shutter.id, - Configuration:Report({ - parameter_number = 71, - size = 1, - configuration_value = 1 - }) +test.register_coroutine_test( + "Mode should be changed to venetian blinds after receiving configuration report with value 1", + function() + test.wait_for_events() + test.socket.zwave:__queue_receive({ + mock_qubino_flush_shutter.id, + Configuration:Report({ + parameter_number = 71, + size = 1, + configuration_value = 1 }) - mock_qubino_flush_shutter:expect_metadata_update({ profile = "qubino-flush-shutter-venetian" }) - end - ) -end + }) + mock_qubino_flush_shutter:expect_metadata_update({ profile = "qubino-flush-shutter-venetian" }) + end, + { + min_api_version = 19 + } +) -do - test.register_coroutine_test( - "Mode should be changed to shutter after receiving configuration report with value 0", - function() - test.wait_for_events() - test.socket.zwave:__queue_receive({ - mock_qubino_flush_shutter.id, - Configuration:Report({ - parameter_number = 71, - size = 1, - configuration_value = 0 - }) +test.register_coroutine_test( + "Mode should be changed to shutter after receiving configuration report with value 0", + function() + test.wait_for_events() + test.socket.zwave:__queue_receive({ + mock_qubino_flush_shutter.id, + Configuration:Report({ + parameter_number = 71, + size = 1, + configuration_value = 0 }) - mock_qubino_flush_shutter:expect_metadata_update({ profile = "qubino-flush-shutter" }) - end - ) -end + }) + mock_qubino_flush_shutter:expect_metadata_update({ profile = "qubino-flush-shutter" }) + end, + { + min_api_version = 19 + } +) -do - test.register_coroutine_test( - "SwitchMultilevel:Set() should be correctly interpreted by the driver", - function() - local targetValue = 50 - test.wait_for_events() - test.socket.zwave:__queue_receive({ - mock_qubino_flush_shutter.id, - SwitchMultilevel:Set({ - value = targetValue - }) +test.register_coroutine_test( + "SwitchMultilevel:Set() should be correctly interpreted by the driver", + function() + local targetValue = 50 + test.wait_for_events() + test.socket.zwave:__queue_receive({ + mock_qubino_flush_shutter.id, + SwitchMultilevel:Set({ + value = targetValue }) - local expectedCachedEvent = utils.stringify_table(capabilities.windowShade.windowShade.opening()) - test.wait_for_events() - local actualCachedEvent = utils.stringify_table(mock_qubino_flush_shutter.transient_store.blinds_last_command) - assert(expectedCachedEvent == actualCachedEvent, "driver should cache 'opening' event when targetLevel > currentLevel") - assert(targetValue == mock_qubino_flush_shutter.transient_store.shade_target, "driver should chache correct level value") - end - ) -end + }) + local expectedCachedEvent = utils.stringify_table(capabilities.windowShade.windowShade.opening()) + test.wait_for_events() + local actualCachedEvent = utils.stringify_table(mock_qubino_flush_shutter.transient_store.blinds_last_command) + assert(expectedCachedEvent == actualCachedEvent, "driver should cache 'opening' event when targetLevel > currentLevel") + assert(targetValue == mock_qubino_flush_shutter.transient_store.shade_target, "driver should chache correct level value") + end, + { + min_api_version = 19 + } +) -do - test.register_coroutine_test( - "Meter:Report() with meter_value > 0 should be correctly interpreted by the driver", - function() - local cachedShadesEvent = capabilities.windowShade.windowShade.opening() - local targetValue = 50 - mock_qubino_flush_shutter:set_field("blinds_last_command", cachedShadesEvent) - mock_qubino_flush_shutter:set_field("shade_target", targetValue) - test.wait_for_events() - test.socket.zwave:__queue_receive({ - mock_qubino_flush_shutter.id, - Meter:Report({ - scale = Meter.scale.electric_meter.WATTS, - meter_value = 10 - }) +test.register_coroutine_test( + "Meter:Report() with meter_value > 0 should be correctly interpreted by the driver", + function() + local cachedShadesEvent = capabilities.windowShade.windowShade.opening() + local targetValue = 50 + mock_qubino_flush_shutter:set_field("blinds_last_command", cachedShadesEvent) + mock_qubino_flush_shutter:set_field("shade_target", targetValue) + test.wait_for_events() + test.socket.zwave:__queue_receive({ + mock_qubino_flush_shutter.id, + Meter:Report({ + scale = Meter.scale.electric_meter.WATTS, + meter_value = 10 }) - test.socket.capability:__expect_send( - mock_qubino_flush_shutter:generate_test_message("main", cachedShadesEvent) - ) - test.socket.capability:__expect_send( - mock_qubino_flush_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(targetValue)) - ) - test.socket.capability:__expect_send( - mock_qubino_flush_shutter:generate_test_message("main", capabilities.powerMeter.power({value = 10, unit = "W"})) - ) - end - ) -end + }) + test.socket.capability:__expect_send( + mock_qubino_flush_shutter:generate_test_message("main", cachedShadesEvent) + ) + test.socket.capability:__expect_send( + mock_qubino_flush_shutter:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(targetValue)) + ) + test.socket.capability:__expect_send( + mock_qubino_flush_shutter:generate_test_message("main", capabilities.powerMeter.power({value = 10, unit = "W"})) + ) + end, + { + min_api_version = 19 + } +) -do - test.register_coroutine_test( - "Meter:Report() with meter_value == 0 should be correctly interpreted by the driver", - function() - test.wait_for_events() - test.socket.zwave:__queue_receive({ - mock_qubino_flush_shutter.id, - Meter:Report({ - scale = Meter.scale.electric_meter.WATTS, - meter_value = 0 - }) + +test.register_coroutine_test( + "Meter:Report() with meter_value == 0 should be correctly interpreted by the driver", + function() + test.wait_for_events() + test.socket.zwave:__queue_receive({ + mock_qubino_flush_shutter.id, + Meter:Report({ + scale = Meter.scale.electric_meter.WATTS, + meter_value = 0 }) - test.socket.zwave:__expect_send( - zw_test_utils.zwave_test_build_send_command( - mock_qubino_flush_shutter, - SwitchMultilevel:Get({}) - ) - ) - test.socket.zwave:__expect_send( - zw_test_utils.zwave_test_build_send_command( - mock_qubino_flush_shutter, - Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}) - ) + }) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_qubino_flush_shutter, + SwitchMultilevel:Get({}) ) - test.socket.capability:__expect_send( - mock_qubino_flush_shutter:generate_test_message("main", capabilities.powerMeter.power({value = 0, unit = "W"})) + ) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_qubino_flush_shutter, + Meter:Get({scale = Meter.scale.electric_meter.KILOWATT_HOURS}) ) - end - ) -end + ) + test.socket.capability:__expect_send( + mock_qubino_flush_shutter:generate_test_message("main", capabilities.powerMeter.power({value = 0, unit = "W"})) + ) + end, + { + min_api_version = 19 + } +) test.register_message_test( "Energy meter reports should be generating events", @@ -648,7 +711,71 @@ test.register_message_test( direction = "send", message = mock_qubino_flush_shutter:generate_test_message("main", capabilities.energyMeter.energy({value = 50, unit = "kWh"})) } + }, + { + min_api_version = 19 } ) +test.register_coroutine_test( + "SwitchMultilevel:Set with lower target than current should cache closing command and fire Meter:Get after 4s", + function() + -- Pre-set state so currentLevel (80) > targetLevel (10) + mock_qubino_flush_shutter_venetian:update_state_cache_entry( + "main", capabilities.windowShadeLevel.ID, "shadeLevel", { value = 80 } + ) + test.timer.__create_and_queue_test_time_advance_timer(4, "oneshot") + test.socket.zwave:__queue_receive({ + mock_qubino_flush_shutter_venetian.id, + SwitchMultilevel:Set({ value = 10 }) + }) + test.wait_for_events() + test.mock_time.advance_time(4) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_qubino_flush_shutter_venetian, + Meter:Get({ scale = Meter.scale.electric_meter.WATTS }) + ) + ) + end, + { + min_api_version = 19 + } +) + +do + local new_param_value = 1 + test.register_coroutine_test( + "infoChanged on venetian qubino should send Configuration:Set then Configuration:Get after 1s", + function() + test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") + local device_data = utils.deep_copy(mock_qubino_flush_shutter_venetian.raw_st_data) + device_data.preferences["operatingModes"] = new_param_value + local device_data_json = dkjson.encode(device_data) + test.socket.device_lifecycle:__queue_receive({ mock_qubino_flush_shutter_venetian.id, "infoChanged", device_data_json }) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_qubino_flush_shutter_venetian, + Configuration:Set({ + parameter_number = 71, + configuration_value = new_param_value, + size = 1 + }) + ) + ) + test.mock_time.advance_time(1) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_qubino_flush_shutter_venetian, + Configuration:Get({ parameter_number = 71 }) + ) + ) + end, + { + min_api_version = 19 + } + + ) +end + test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_aeotec_nano_shutter.lua b/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_aeotec_nano_shutter.lua index 089fc29bac..5337d9d22b 100644 --- a/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_aeotec_nano_shutter.lua +++ b/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_aeotec_nano_shutter.lua @@ -46,7 +46,10 @@ test.register_coroutine_test( Basic:Set({ value = 0x00 }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -64,7 +67,10 @@ test.register_coroutine_test( Basic:Set({ value = 0xFF }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -94,7 +100,10 @@ test.register_coroutine_test( Basic:Set({ value = 0x00 }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -130,7 +139,10 @@ test.register_coroutine_test( Basic:Set({ value = 0xFF }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -156,7 +168,10 @@ test.register_coroutine_test( Basic:Set({ value = 0xFF }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -182,7 +197,10 @@ test.register_coroutine_test( Basic:Set({ value = 0x00 }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -220,7 +238,10 @@ test.register_coroutine_test( Basic:Set({ value = 0xFF }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -264,7 +285,10 @@ test.register_coroutine_test( Basic:Set({ value = 0x00 }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -275,7 +299,10 @@ test.register_coroutine_test( test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command(mock_window_button, Configuration:Set({parameter_number = 80, size = 1, configuration_value = 1}))) test.socket.zwave:__expect_send(zw_test_utils.zwave_test_build_send_command(mock_window_button, Configuration:Set({parameter_number = 85, size = 1, configuration_value = 1}))) mock_window_button:expect_metadata_update({ provisioning_state = "PROVISIONED" }) - end + end, + { + min_api_version = 19 + } ) test.register_message_test( @@ -305,6 +332,9 @@ test.register_message_test( Basic:Get({}) ) }, + }, + { + min_api_version = 19 } ) @@ -317,7 +347,10 @@ test.register_coroutine_test( capabilities.statelessCurtainPowerButton.availableCurtainPowerButtons({"open", "close", "pause"}, {visibility = {displayed = false}})) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -334,7 +367,10 @@ test.register_coroutine_test( mock_window_button, Configuration:Set({parameter_number = 35, size = 1, configuration_value = 100}) )) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_iblinds_window_treatment.lua b/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_iblinds_window_treatment.lua index e2134b1163..909dcda0c6 100644 --- a/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_iblinds_window_treatment.lua +++ b/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_iblinds_window_treatment.lua @@ -75,7 +75,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -102,7 +105,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -139,7 +145,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -166,7 +175,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -203,7 +215,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -230,7 +245,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -269,7 +287,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -296,7 +317,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -324,7 +348,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -365,7 +392,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -392,7 +422,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -433,7 +466,10 @@ test.register_coroutine_test( }) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -472,7 +508,64 @@ test.register_coroutine_test( mock_blind_v3, Configuration:Set({parameter_number = 6, size = 1, configuration_value = 50}) )) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting window shade level to 0 on iblinds v1 should emit windowShade.closed", + function() + test.socket.capability:__queue_receive( + { + mock_blind.id, + { capability = "windowShadeLevel", command = "setShadeLevel", args = { 0 } } + } + ) + test.socket.capability:__expect_send( + mock_blind:generate_test_message("main", capabilities.windowShade.windowShade.closed()) + ) + test.socket.capability:__expect_send( + mock_blind:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) + ) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_blind, + SwitchMultilevel:Set({ value = 0 }) + ) + ) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting window shade level to 0 on iblinds v3 should emit windowShade.closed", + function() + test.socket.capability:__queue_receive( + { + mock_blind_v3.id, + { capability = "windowShadeLevel", command = "setShadeLevel", args = { 0 } } + } + ) + test.socket.capability:__expect_send( + mock_blind_v3:generate_test_message("main", capabilities.windowShade.windowShade.closed()) + ) + test.socket.capability:__expect_send( + mock_blind_v3:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) + ) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_blind_v3, + SwitchMultilevel:Set({ value = 0 }) + ) + ) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_springs_window_treatment.lua b/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_springs_window_treatment.lua index 843b26e407..86f847fd45 100644 --- a/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_springs_window_treatment.lua +++ b/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_springs_window_treatment.lua @@ -63,7 +63,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_window_treatment.lua b/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_window_treatment.lua index fa6fd809e7..af86878d95 100644 --- a/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_window_treatment.lua +++ b/drivers/SmartThings/zwave-window-treatment/src/test/test_zwave_window_treatment.lua @@ -79,6 +79,9 @@ test.register_message_test( direction = "send", message = mock_window_shade_basic:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) } + }, + { + min_api_version = 19 } ) @@ -102,6 +105,9 @@ test.register_message_test( direction = "send", message = mock_window_shade_basic:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50)) } + }, + { + min_api_version = 19 } ) @@ -125,6 +131,9 @@ test.register_message_test( direction = "send", message = mock_window_shade_basic:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) } + }, + { + min_api_version = 19 } ) @@ -155,6 +164,9 @@ test.register_message_test( direction = "send", message = mock_window_shade_switch_multilevel:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0)) } + }, + { + min_api_version = 19 } ) @@ -185,6 +197,9 @@ test.register_message_test( direction = "send", message = mock_window_shade_switch_multilevel:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(50)) } + }, + { + min_api_version = 19 } ) @@ -215,6 +230,9 @@ test.register_message_test( direction = "send", message = mock_window_shade_switch_multilevel:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100)) } + }, + { + min_api_version = 19 } ) @@ -246,7 +264,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -277,7 +298,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -296,7 +320,10 @@ test.register_coroutine_test( SwitchMultilevel:StopLevelChange({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -327,7 +354,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -358,7 +388,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -384,7 +417,10 @@ test.register_coroutine_test( ) test.socket.capability:__expect_send(mock_window_shade_switch_multilevel:generate_test_message("main", capabilities.windowShade.windowShade.open())) test.socket.capability:__expect_send(mock_window_shade_switch_multilevel:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(100))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -410,7 +446,10 @@ test.register_coroutine_test( ) test.socket.capability:__expect_send(mock_window_shade_switch_multilevel:generate_test_message("main", capabilities.windowShade.windowShade.closed())) test.socket.capability:__expect_send(mock_window_shade_switch_multilevel:generate_test_message("main", capabilities.windowShadeLevel.shadeLevel(0))) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -449,7 +488,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) @@ -489,7 +531,10 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } ) test.register_coroutine_test( @@ -528,7 +573,55 @@ test.register_coroutine_test( SwitchMultilevel:Get({}) ) ) - end + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Setting window shade preset on basic-only device should generate Basic:Set and Basic:Get", + function() + test.timer.__create_and_queue_test_time_advance_timer(5, "oneshot") + test.socket.capability:__queue_receive( + { + mock_window_shade_basic.id, + { capability = "windowShadePreset", component = "main", command = "presetPosition", args = {} } + } + ) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_window_shade_basic, + Basic:Set({ value = 50 }) + ) + ) + test.wait_for_events() + test.mock_time.advance_time(5) + test.socket.zwave:__expect_send( + zw_test_utils.zwave_test_build_send_command( + mock_window_shade_basic, + Basic:Get({}) + ) + ) + end, + { + min_api_version = 19 + } +) + +test.register_coroutine_test( + "Adding a window treatment device should emit supportedWindowShadeCommands", + function() + test.socket.device_lifecycle():__queue_receive({ mock_window_shade_basic.id, "added" }) + test.socket.capability:__expect_send( + mock_window_shade_basic:generate_test_message("main", capabilities.windowShade.supportedWindowShadeCommands( + {"open", "close", "pause"}, { visibility = { displayed = false } } + )) + ) + end, + { + min_api_version = 19 + } ) test.run_registered_tests() diff --git a/tools/pre-commit b/tools/pre-commit index c9bc4d4d4f..41a9406bf5 100755 --- a/tools/pre-commit +++ b/tools/pre-commit @@ -28,7 +28,7 @@ for file in $files; do # Check if file is not empty, is a SmartThings driver and has the copyright header if [ -s "$file" ] && [[ "$file" =~ "drivers/SmartThings" ]] \ - && [[ ! $(grep $file -P -e "-{2,} Copyright \d{4}(?:-\d{4})? SmartThings") ]]; then + && [[ ! $(grep $file --text -P -e "-{2,} Copyright (?:© )?\d{4}(?:-\d{4})? SmartThings") ]]; then echo "$file: SmartThings Copyright missing from file" fail=1 fi diff --git a/tools/run_driver_tests.py b/tools/run_driver_tests.py index e3e58f2154..e686a0f4b7 100755 --- a/tools/run_driver_tests.py +++ b/tools/run_driver_tests.py @@ -117,10 +117,10 @@ def run_tests(verbosity_level, filter, junit, coverage_files, html): test_status = "" test_logs = "" test_done = False - if re.match("^\s*$", line) is None: + if re.match(r"^\s*$", line) is None: last_line = line - m = re.match("Passed (\d+) of (\d+) tests", last_line) + m = re.match(r"Passed (\d+) of (\d+) tests", last_line) if m is None: failure_files[test_file].append("\n ".join(a.stderr.decode().split("\n"))) test_case = junit_xml.TestCase(test_suite.name)