Skip to content

Commit

Permalink
Matter fix bug when saving Force Static endpoints (#19071)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Jul 8, 2023
1 parent 2ecb697 commit a0c4d91
Show file tree
Hide file tree
Showing 5 changed files with 618 additions and 601 deletions.
2 changes: 2 additions & 0 deletions lib/libesp32/berry_matter/src/embedded/Matter_IM.be
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ class Matter_IM
# returns `true` if processed, `false` if silently ignored,
# or raises an exception
def process_invoke_request(msg, val)
# import debug
# structure is `ReadRequestMessage` 10.6.2 p.558
# tasmota.log("MTR: IM:invoke_request processing start", 4)
var ctx = matter.Path()
Expand All @@ -403,6 +404,7 @@ class Matter_IM
var res = self.device.invoke_request(msg.session, q.command_fields, ctx)
var params_log = (ctx.log != nil) ? "(" + str(ctx.log) + ") " : ""
tasmota.log(format("MTR: >Command (%6i) %s %s %s", msg.session.local_session_id, ctx_str, cmd_name ? cmd_name : "", params_log), ctx.endpoint != 0 ? 2 : 3 #- don't log for endpoint 0 -# )
# tasmota.log("MTR: Perf/Command = " + str(debug.counters()), 4)
ctx.log = nil
var a1 = matter.InvokeResponseIB()
if res == true || ctx.status == matter.SUCCESS # special case, just respond ok
Expand Down
2 changes: 2 additions & 0 deletions lib/libesp32/berry_matter/src/embedded/Matter_IM_Message.be
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ class Matter_IM_Message
def send_im(responder)
# tasmota.log(format("MTR: IM_Message send_im exch=%i ready=%i", self.resp.exchange_id, self.ready ? 1 : 0), 3)
if !self.ready return false end
# import debug
var resp = self.resp
resp.encode_frame(self.data.to_TLV().tlv2raw()) # payload in cleartext
resp.encrypt()
tasmota.log(format("MTR: <snd (%6i) id=%i exch=%i rack=%s", resp.session.local_session_id, resp.message_counter, resp.exchange_id, resp.ack_message_counter), 4)
# tasmota.log("MTR: Perf/Send = " + str(debug.counters()), 4)
responder.send_response_frame(resp)
self.last_counter = resp.message_counter
self.finish = true # by default we remove the packet after it is sent
Expand Down
2 changes: 2 additions & 0 deletions lib/libesp32/berry_matter/src/embedded/Matter_UDPServer.be
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class Matter_UDPServer
# avoid any starvation.
# Then resend queued outgoing packets.
def loop()
# import debug
var packet_read = 0
if self.udp_socket == nil return end
var packet = self.udp_socket.read()
Expand All @@ -129,6 +130,7 @@ class Matter_UDPServer
var from_addr = self.udp_socket.remote_ip
var from_port = self.udp_socket.remote_port
tasmota.log(format("MTR: UDP received from [%s]:%i", from_addr, from_port), 4)
# tasmota.log("MTR: Perf/UDP_received = " + str(debug.counters()), 4)
if self.dispatch_cb
self.dispatch_cb(packet, from_addr, from_port)
end
Expand Down
6 changes: 5 additions & 1 deletion lib/libesp32/berry_matter/src/embedded/Matter_UI.be
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,11 @@ class Matter_UI
elif webserver.has_arg("save")
var matter_enabled_requested = webserver.has_arg("menable")
var matter_commissioning_requested = webserver.has_arg("comm")
self.device.disable_bridge_mode = webserver.arg("nobridge") == 'on'
var matter_disable_bridge_mode_requested = (webserver.arg("nobridge") == 'on')
if self.device.disable_bridge_mode != matter_disable_bridge_mode_requested
self.device.disable_bridge_mode = matter_disable_bridge_mode_requested
self.device.save_param()
end

if matter_enabled_requested != self.matter_enabled()
if matter_enabled_requested
Expand Down
Loading

0 comments on commit a0c4d91

Please sign in to comment.