Skip to content

Commit

Permalink
Fix UpdateFabricLabel (arendst#20665)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored and hawa-lc4 committed Feb 12, 2024
1 parent ecdc62b commit 7c14036
Show file tree
Hide file tree
Showing 2 changed files with 335 additions and 309 deletions.
13 changes: 11 additions & 2 deletions lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Root.be
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ class Matter_Plugin_Root : Matter_Plugin
# tasmota.log("MTR: fabric=" + matter.inspect(session._fabric), 3)
# tasmota.log("MTR: ------------------------------------------", 3)
new_fabric.log_new_fabric() # log that we registered a new fabric
new_fabric.assign_fabric_index()
# create NOCResponse
# 0=StatusCode
# 1=FabricIndex (1-254) (opt)
Expand All @@ -569,8 +570,16 @@ class Matter_Plugin_Root : Matter_Plugin
var label = val.findsubval(0) # Label string max 32
session.set_fabric_label(label)
tasmota.log(format("MTR: . Update fabric '%s' label='%s'", session._fabric.get_fabric_id().copy().reverse().tohex(), str(label)), 3)
ctx.status = matter.SUCCESS # OK
return nil # trigger a standalone ack

# create NOCResponse
# 0=StatusCode
# 1=FabricIndex (1-254) (opt)
# 2=DebugText (opt)
var nocr = TLV.Matter_TLV_struct()
nocr.add_TLV(0, TLV.U1, matter.SUCCESS) # Status
nocr.add_TLV(1, TLV.U1, session.get_fabric().get_fabric_index()) # fabric-index
ctx.command = 0x08 # NOCResponse
return nocr

elif command == 0x000A # ---------- RemoveFabric ----------
var index = val.findsubval(0) # FabricIndex
Expand Down
Loading

0 comments on commit 7c14036

Please sign in to comment.