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

Matter allow Matter#Initialized rule once the device is configured #18451

Merged
merged 1 commit into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
### Added
- Matter sensors Humidity, Pressure, Illuminance; optimize memory (#18441)
- Command ``SetOption152 0/1`` to select two (default) or one pin bistable relay control (#18386)
- Matter allow `Matter#Initialized` rule once the device is configured

### Breaking Changed

Expand Down
28 changes: 27 additions & 1 deletion lib/libesp32/berry_matter/src/embedded/Matter_Device.be
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class Matter_Device
self._init_basic_commissioning()

tasmota.add_driver(self)

self.register_commands()
end

#############################################################
Expand Down Expand Up @@ -1011,14 +1013,38 @@ class Matter_Device
end
if endpoint > 0x40 break end
end

tasmota.publish_result('{"Matter":{"Initialized":1}}', 'Matter')
end

# get keys of a map in sorted order
static def k2l(m) var l=[] if m==nil return l end for k:m.keys() l.push(k) end
for i:1..size(l)-1 var k = l[i] var j = i while (j > 0) && (l[j-1] > k) l[j] = l[j-1] j -= 1 end l[j] = k end return l
end

#####################################################################
# Commands `Mtr___`
#####################################################################
#
def register_commands()
tasmota.add_cmd("MtrJoin", /cmd_found, idx, payload, payload_json -> self.MtrJoin(cmd_found, idx, payload, payload_json))
end

#####################################################################
# `MtrJoin`
#
# Open or close commissioning
#
def MtrJoin(cmd_found, idx, payload, payload_json)
var payload_int = int(payload)
if payload_int
self.start_root_basic_commissioning()
else
self.stop_basic_commissioning()
end
tasmota.resp_cmnd_done()
end


end
matter.Device = Matter_Device

Expand Down
Loading