File tree 2 files changed +11
-1
lines changed
matter_server/common/helpers
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,13 @@ def parse_value(
221
221
# as it is not super important we ignore it (for now)
222
222
return b""
223
223
224
+ # handle NOCStruct.noc which is typed/specified as bytes but parsed
225
+ # as integer in the tlv parser somehow.
226
+ # https://github.com/home-assistant/core/issues/113279
227
+ # https://github.com/home-assistant/core/issues/116304
228
+ if name == "NOCStruct.noc" and not isinstance (value , bytes ):
229
+ return b""
230
+
224
231
# Matter SDK specific types
225
232
if value_type is uint and (
226
233
isinstance (value , int ) or (isinstance (value , str ) and value .isnumeric ())
Original file line number Diff line number Diff line change 7
7
8
8
import pytest
9
9
10
- from matter_server .common .helpers .util import dataclass_from_dict
10
+ from matter_server .common .helpers .util import dataclass_from_dict , parse_value
11
11
12
12
13
13
class MatterIntEnum (IntEnum ):
@@ -107,3 +107,6 @@ def test_dataclass_from_dict():
107
107
# test extra keys not silently ignored in strict mode
108
108
with pytest .raises (KeyError ):
109
109
dataclass_from_dict (BasicModel , raw2 , strict = True )
110
+ # test NOCStruct.noc edge case
111
+ res = parse_value ("NOCStruct.noc" , 5 , bytes )
112
+ assert res == b""
You can’t perform that action at this time.
0 commit comments