Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occupancy Sensing cluster Python test scripts #34572

Merged
merged 89 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
c7f753b
Occupancy Sensing cluster Python test scripts
jaehs6sam Jul 29, 2024
5e4ca22
Update TC_OCC_2_1.py
jaehs6sam Jul 29, 2024
092e864
Update TC_OCC_2_2.py
jaehs6sam Jul 29, 2024
5eeadf7
Update TC_OCC_2_3.py
jaehs6sam Jul 29, 2024
1d67a63
Update TC_OCC_3_1.py
jaehs6sam Jul 29, 2024
efacda8
Update TC_OCC_3_2.py
jaehs6sam Jul 29, 2024
423e963
Update TC_OCC_2_1.py
jaehs6sam Jul 29, 2024
889f2f4
Update TC_OCC_2_2.py
jaehs6sam Jul 30, 2024
b60b5f0
Update TC_OCC_2_3.py
jaehs6sam Jul 30, 2024
2f2129e
Update TC_OCC_3_1.py
jaehs6sam Jul 30, 2024
bb65bb6
Update TC_OCC_3_2.py
jaehs6sam Jul 30, 2024
4de391e
Update TC_OCC_2_1.py
jaehs6sam Jul 30, 2024
da31772
Update TC_OCC_3_1.py
jaehs6sam Jul 30, 2024
a1ce53b
Update TC_OCC_2_1.py
jaehs6sam Jul 30, 2024
f8df6a6
Update TC_OCC_2_2.py
jaehs6sam Jul 30, 2024
8267b3a
Update TC_OCC_2_3.py
jaehs6sam Jul 30, 2024
997aa86
Update TC_OCC_3_2.py
jaehs6sam Jul 30, 2024
37be841
Update TC_OCC_3_2.py
jaehs6sam Jul 30, 2024
293b97e
Update TC_OCC_3_2.py
jaehs6sam Jul 30, 2024
2cf4c4c
Update TC_OCC_3_2.py
jaehs6sam Jul 30, 2024
346aaaf
Update TC_OCC_3_1.py
jaehs6sam Jul 30, 2024
b848995
Update TC_OCC_2_3.py
jaehs6sam Jul 30, 2024
9761d9a
Update TC_OCC_2_2.py
jaehs6sam Jul 30, 2024
86beae4
Update TC_OCC_2_1.py
jaehs6sam Jul 30, 2024
e134ba8
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
748c528
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
d8ebf5e
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
1d170a3
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
6804084
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
872111e
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
ffedcbd
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
8df35a5
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
84cc83f
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
1466f18
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
4b20125
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
fea321b
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
5494598
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
6a21c0b
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
ae7dbd4
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
5dac75d
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
b194b33
Update src/python_testing/TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
3e86880
Update TC_OCC_2_2.py
jaehs6sam Jul 31, 2024
65fb1d5
Update TC_OCC_3_1.py
jaehs6sam Jul 31, 2024
a9c1584
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
7a8a763
Update TC_OCC_3_1.py
jaehs6sam Jul 31, 2024
7245727
Update TC_OCC_3_2.py
jaehs6sam Jul 31, 2024
e64eed1
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
38fa992
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
05110cb
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
e3d9184
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
264c803
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
a1a20fd
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
1319d79
Update TC_OCC_2_2.py
jaehs6sam Jul 31, 2024
386a31f
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
73d642e
Update TC_OCC_2_2.py
jaehs6sam Jul 31, 2024
8b430ef
Update TC_OCC_2_3.py
jaehs6sam Jul 31, 2024
99775f2
Update TC_OCC_3_1.py
jaehs6sam Jul 31, 2024
214f326
Update TC_OCC_3_2.py
jaehs6sam Jul 31, 2024
c299926
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
009761b
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
d797b80
Update TC_OCC_2_1.py
jaehs6sam Jul 31, 2024
e9af202
Merge branch 'master' into TC_OCC_1_4_PythonTestScript
andy31415 Jul 31, 2024
25382a4
Restyle
andy31415 Jul 31, 2024
9ec09b4
Update TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
2188852
Update TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
2c25e66
Update TC_OCC_3_1.py
jaehs6sam Aug 1, 2024
79710ce
Update src/python_testing/TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
9f68ef6
Update src/python_testing/TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
30f86dd
Update TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
f6f1aa8
Update TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
ed0c165
Update TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
f438096
Update TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
775105b
Update TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
3db7f02
Update TC_OCC_2_2.py
jaehs6sam Aug 1, 2024
bede88a
Merge branch 'master' into TC_OCC_1_4_PythonTestScript
andreilitvin Aug 1, 2024
87b3f4d
Restyle
andreilitvin Aug 1, 2024
8a888d6
Proposal for TC_OCC bitmap compares
andreilitvin Aug 1, 2024
01160c4
Fix typo
andreilitvin Aug 1, 2024
d7906c5
Fix map
andreilitvin Aug 1, 2024
683e474
Update TC_OCC_3_2.py
jaehs6sam Aug 1, 2024
bc92bf5
Update TC_OCC_3_2.py
jaehs6sam Aug 1, 2024
582bdb7
Restyle
andreilitvin Aug 1, 2024
1215ecb
Typo fixes and enable some tests in CI
andreilitvin Aug 1, 2024
506d08e
Fix OCC_2_1 to run in CI
andreilitvin Aug 1, 2024
2a1f0f0
Fix all clusters for TC_OCC_2_2 and some logging
andreilitvin Aug 1, 2024
338d2f9
make all TC_OCC_2_* pass
andreilitvin Aug 1, 2024
4466463
Restyle
andreilitvin Aug 1, 2024
f733468
Enable tests in ci
andreilitvin Aug 1, 2024
ceb7013
Merge branch 'master' into TC_OCC_1_4_PythonTestScript
andy31415 Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
265 changes: 265 additions & 0 deletions src/python_testing/TC_OCC_2_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
#
# Copyright (c) 2024 Project CHIP Authors
# All rights reserved.
#
# 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.
#
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
# There are CI issues to be followed up for the test cases below that implements manually controlling sensor device for
# the occupancy state ON/OFF change.
# [TC-OCC-3.1] test procedure step 4
# [TC-OCC-3.2] test precedure step 3a, 3c

import logging

import chip.clusters as Clusters
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts


class TC_OCC_2_1(MatterBaseTest):
async def read_occ_attribute_expect_success(self, endpoint, attribute):
cluster = Clusters.Objects.OccupancySensing
return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute)

def desc_TC_OCC_2_1(self) -> str:
return "[TC-OCC-2.1] Attributes with DUT as Server"

def steps_TC_OCC_2_1(self) -> list[TestStep]:
steps = [
TestStep(1, "Commissioning, already done", is_commissioning=True),
TestStep(2, "Read Occupancy attribute."),
TestStep(3, "Read OccupancySensorType attribute."),
TestStep(4, "Read OccupancySensorTypeBitmap attribute."),
TestStep(5, "Read HoldTimeLimits attribute, if supported"),
TestStep(6, "Read HoldTime attribute, if supported"),
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
TestStep(7, "Read PIROccupiedToUnoccupiedDelay attribute, if supported"),
TestStep(8, "Read PIRUnoccupiedToOccupiedDelay attribute, if supported"),
TestStep(9, "Read PIRUnoccupiedToOccupiedThreshold attribute, if supported"),
TestStep(10, "Read UltrasonicOccupiedToUnoccupiedDelay attribute, if supported"),
TestStep(11, "Read UltrasonicUnoccupiedToOccupiedDelay attribute, if supported"),
TestStep(12, "Read UltrasonicUnoccupiedToOccupiedThreshold attribute, if supported"),
TestStep(13, "Read PhysicalContactOccupiedToUnoccupiedDelay attribute, if supported"),
TestStep(14, "Read PhysicalContactUnoccupiedToOccupiedDelay attribute, if supported"),
TestStep(15, "Read PhysicalContactUnoccupiedToOccupiedThreshold attribute, if supported")
]
return steps

def pics_TC_OCC_2_1(self) -> list[str]:
pics = [
"OCC.S",
]
return pics

@async_test_body
async def test_TC_OCC_2_1(self):

endpoint = self.user_params.get("endpoint", 1)

self.step(1)
attributes = Clusters.OccupancySensing.Attributes
attribute_list = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.AttributeList)

self.step(2)
asserts.assert_in(attributes.Occupancy.attribute_id, attribute_list, "Occupancy attribute is mandatory")
occupancy_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.Occupancy)
asserts.assert_less_equal(occupancy_dut, 0b00000001, "Occupancy attribute is not in valid range")

self.step(3)
asserts.assert_in(attributes.OccupancySensorType.attribute_id, attribute_list,
"OccupancySensorType attribute is a mandatory attribute.")

occupancy_sensor_type_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorType)
asserts.assert_less(occupancy_sensor_type_dut, Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kUnknownEnumValue,
"OccupancySensorType is not in valid range")
asserts.assert_in(occupancy_sensor_type_dut, {Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPIR,
Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic,
Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPIRAndUltrasonic,
Clusters.Objects.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact}, "OccupancySensorType is not in valid range")
self.step(4)
asserts.assert_in(attributes.OccupancySensorTypeBitmap.attribute_id, attribute_list,
"OccupancySensorTypeBitmap attribute is a mandatory attribute.")

occupancy_sensor_type_bitmap_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.OccupancySensorTypeBitmap)
asserts.assert_less_equal(occupancy_sensor_type_bitmap_dut, 0b00000111,
"OccupancySensorTypeBitmap attribute is not in valid range")

self.step(5)
if attributes.HoldTimeLimits.attribute_id in attribute_list:
asserts.assert_in(attributes.HoldTime.attribute_id, attribute_list, "HoldTime attribute conformance failed.")
hold_time_limits_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTimeLimits)
asserts.assert_less_equal(hold_time_limits_dut.HoldTimeMin, hold_time_limits_dut.HoldTimeMax,
"HoldTimeMin is not in valid range")
asserts.assert_greater_equal(hold_time_limits_dut.HoldTimeMin, 0, "HoldTimeMin is not in valid range")
asserts.assert_less_equal(hold_time_limits_dut.HoldTimeMax, 0xFFFE, "HoldTimeMin is not in valid range")
asserts.assert_greater_equal(hold_time_limits_dut.HoldTimeMax,
hold_time_limits_dut.HoldTimeMin, "HoldTimeMin is not in valid range")
asserts.assert_less_equal(hold_time_limits_dut.HoldTimeDefault,
hold_time_limits_dut.HoldTimeMax, "HoldTimeMin is not in valid range")
asserts.assert_greater_equal(hold_time_limits_dut.HoldTimeDefault,
hold_time_limits_dut.HoldTimeMin, "HoldTimeMin is not in valid range")
else:
logging.info("HoldTimeLimits not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(6)
if attributes.HoldTime.attribute_id in attribute_list:
hold_time_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTime)
hold_time_limits_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.HoldTimeLimits)

asserts.assert_less_equal(hold_time_dut, hold_time_limits_dut.HoldTimeMax, "HoldTime attribute is out of range")
asserts.assert_greater_equal(hold_time_dut, hold_time_limits_dut.HoldTimeMin, "HoldTime attribute is out of range")
else:
logging.info("HoldTime not supported. The rest of legacy attribute test can be skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.skip_all_remaining_steps(7)
return

self.step(7)
if attributes.PIROccupiedToUnoccupiedDelay.attribute_id in attribute_list:
has_pir_bitmap = (occupancy_sensor_type_bitmap_dut &
Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPir) == 1
has_ultrasonic_bitmap = (occupancy_sensor_type_bitmap_dut &
Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic) == 1
has_phy_bitmap = (occupancy_sensor_type_bitmap_dut &
Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact) == 1
if (has_pir_bitmap == 1) or ((has_pir_bitmap == 0) & (has_ultrasonic_bitmap == 0) & (has_phy_bitmap == 0)):
pir_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIROccupiedToUnoccupiedDelay)
asserts.assert_less_equal(pir_otou_delay_dut, 0xFFFE, "PIROccupiedToUnoccupiedDelay is not in valid range")
asserts.assert_greater_equal(pir_otou_delay_dut, 0, "PIROccupiedToUnoccupiedDelay is not in valid range")
else:
logging.info("PIROccupiedToUnoccupiedDelay conformance failed")
asserts.fail("PIROccupiedToUnoccupiedDelay conformance is incorrect")
else:
logging.info("PIROccupiedToUnoccupiedDelay not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(8)
if attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list:
has_delay = attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list
has_threshold = attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list
asserts.assert_equal(has_delay, has_threshold, "PIRUnoccupiedToOccupiedDelay conformance failure")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
pir_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIRUnoccupiedToOccupiedDelay)
asserts.assert_less_equal(pir_utoo_delay_dut, 0xFFFE, "PIRUnoccupiedToOccupiedDelay is not in valid range")
asserts.assert_greater_equal(pir_utoo_delay_dut, 0, "PIRUnoccupiedToOccupiedDelay is not in valid range")
else:
logging.info("PIRUnoccupiedToOccupiedDelay not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(9)
if attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list:
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
has_delay = attributes.PIRUnoccupiedToOccupiedDelay.attribute_id in attribute_list
has_threshold = attributes.PIRUnoccupiedToOccupiedThreshold.attribute_id in attribute_list
asserts.assert_equal(has_delay, has_threshold, "PIRUnoccupiedToOccupiedThreshold conformance failure")
pir_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PIRUnoccupiedToOccupiedThreshold)
asserts.assert_less_equal(pir_utoo_threshold_dut, 0xFE, "PIRUnoccupiedToOccupiedThreshold is not in valid range")
asserts.assert_greater_equal(pir_utoo_threshold_dut, 0, "PIRUnoccupiedToOccupiedThreshold is not in valid range")
else:
logging.info("PIRUnoccupiedToOccupiedThreshold not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(10)
if attributes.UltrasonicOccupiedToUnoccupiedDelay.attribute_id in attribute_list:
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
has_ultrasonic_bitmap = (occupancy_sensor_type_bitmap_dut &
Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kUltrasonic) != 0
has_ultrasonic_delay = attributes.UltrasonicOccupiedToUnoccupiedDelay.attribute_id in attribute_list
asserts.assert_equal(has_ultrasonic_bitmap, has_ultrasonic_delay, "Bad conformance on Ultrasonic bitmap")

ultrasonic_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicOccupiedToUnoccupiedDelay)
asserts.assert_less_equal(ultrasonic_otou_delay_dut, 0xFFFE,
"UltrasonicOccupiedToUnoccupiedDelay is not in valid range")
asserts.assert_greater_equal(ultrasonic_otou_delay_dut, 0, "UltrasonicOccupiedToUnoccupiedDelay is not in valid range")

else:
logging.info("UltrasonicOccupiedToUnoccupiedDelay not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(11)
if attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list:
has_delay = attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list
has_threshold = attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list
asserts.assert_equal(has_delay, has_threshold, "UltrasonicUnoccupiedToOccupiedDelay conformance failure")

ultrasonic_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicUnoccupiedToOccupiedDelay)
asserts.assert_less_equal(ultrasonic_utoo_delay_dut, 0xFFFE,
"UltrasonicUnoccupiedToOccupiedDelay is not in valid range")
asserts.assert_greater_equal(ultrasonic_utoo_delay_dut, 0, "UltrasonicUnoccupiedToOccupiedDelay is not in valid range")
else:
logging.info("UltrasonicUnoccupiedToOccupiedDelay not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(12)
if attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list:
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
has_delay = attributes.UltrasonicUnoccupiedToOccupiedDelay.attribute_id in attribute_list
has_threshold = attributes.UltrasonicUnoccupiedToOccupiedThreshold.attribute_id in attribute_list
asserts.assert_equal(has_delay, has_threshold, "UltrasonicUnoccupiedToOccupiedThreshold conformance failure")

ultrasonic_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.UltrasonicUnoccupiedToOccupiedThreshold)
asserts.assert_less_equal(ultrasonic_utoo_threshold_dut, 0xFE,
"UltrasonicUnoccupiedToOccupiedThreshold is not in valid range")
asserts.assert_greater_equal(ultrasonic_utoo_threshold_dut, 0,
"UltrasonicUnoccupiedToOccupiedThreshold is not in valid range")

else:
logging.info("UltrasonicUnoccupiedToOccupiedThreshold not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(13)
if attributes.PhysicalContactOccupiedToUnoccupiedDelay.attribute_id in attribute_list:
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
has_phycon_bitmap = (occupancy_sensor_type_bitmap_dut &
Clusters.OccupancySensing.Enums.OccupancySensorTypeEnum.kPhysicalContact) != 0
has_phycon_delay = attributes.PhysicalContactOccupiedToUnoccupiedDelay.attribute_id in attribute_list
asserts.assert_equal(has_phycon_bitmap, has_phycon_delay, "Bad conformance on PhysicalContact bitmap")
phycontact_otou_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactOccupiedToUnoccupiedDelay)
asserts.assert_less_equal(phycontact_otou_delay_dut, 0xFFFE,
"PhysicalContactOccupiedToUnoccupiedDelay is not in valid range")
asserts.assert_greater_equal(phycontact_otou_delay_dut, 0,
"PhysicalContactOccupiedToUnoccupiedDelay is not in valid range")

else:
logging.info("PhysicalContactOccupiedToUnoccupiedDelay not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(14)
if attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list:
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
has_delay = attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list
has_threshold = attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list
asserts.assert_equal(has_delay, has_threshold, "PhysicalContactUnoccupiedToOccupiedDelay conformance failure")

phycontact_utoo_delay_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactUnoccupiedToOccupiedDelay)
asserts.assert_less_equal(phycontact_utoo_delay_dut, 0xFFFE,
"PhysicalContactUnoccupiedToOccupiedDelay is not in valid range")
asserts.assert_greater_equal(phycontact_utoo_delay_dut, 0,
"PhysicalContactUnoccupiedToOccupiedDelay is not in valid range")

else:
logging.info("PhysicalContactUnoccupiedToOccupiedDelay not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()

self.step(15)
if attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list:
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
has_delay = attributes.PhysicalContactUnoccupiedToOccupiedDelay.attribute_id in attribute_list
has_threshold = attributes.PhysicalContactUnoccupiedToOccupiedThreshold.attribute_id in attribute_list
asserts.assert_equal(has_delay, has_threshold, "PhysicalContactUnoccupiedToOccupiedThreshold conformance failure")

phycontact_utoo_threshold_dut = await self.read_occ_attribute_expect_success(endpoint=endpoint, attribute=attributes.PhysicalContactUnoccupiedToOccupiedThreshold)
asserts.assert_less_equal(phycontact_utoo_threshold_dut, 0xFE,
"PhysicalContactUnoccupiedToOccupiedThreshold is not in valid range")
asserts.assert_greater_equal(phycontact_utoo_threshold_dut, 0,
"PhysicalContactUnoccupiedToOccupiedThreshold is not in valid range")

else:
logging.info("PhysicalContactUnoccupiedToOccupiedThreshold not supported. Test step skipped")
jaehs6sam marked this conversation as resolved.
Show resolved Hide resolved
self.mark_current_step_skipped()


if __name__ == "__main__":
default_matter_test_main()
Loading
Loading