mirror of
https://github.com/arendst/Tasmota.git
synced 2026-10-26 22:11:22 +00:00
Fix Matter MQTT subscription when Matter is disabled (#25140)
This commit is contained in:
1 parent
ad60406a38
commit
1bb26b29c4
3 files changed
+12
-5
No files matched your search
@@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
|
||||
### Fixed
|
||||
- Unauthenticated UFS writes on web password enabled systems
|
||||
- Display dsi dma2d psram buffers (#24949)
|
||||
- Matter MQTT subscription when Matter is disabled
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
@@ -1069,7 +1069,9 @@ class Matter_UI
|
||||
|
||||
if !webserver.check_privileged_access() return nil end
|
||||
|
||||
self.device.ensure_discovery() # lazy subscribe to tasmota/discovery/# on first visit
|
||||
if self.matter_enabled
|
||||
self.device.ensure_discovery() # lazy subscribe to tasmota/discovery/# on first visit
|
||||
end
|
||||
|
||||
webserver.content_start("Matter") #- title of the web page -#
|
||||
webserver.content_send_style() #- send standard Tasmota styles -#
|
||||
@@ -1523,7 +1525,8 @@ class Matter_UI
|
||||
var matter_commissioning_requested = webserver.has_arg("comm")
|
||||
var matter_disable_bridge_mode_requested = (webserver.arg("nobridge") == 'on')
|
||||
var matter_disable_bridge_mode_current = self.device.disable_bridge_mode
|
||||
var matter_bridge_mode_changed = matter_disable_bridge_mode_current != matter_disable_bridge_mode_requested
|
||||
# when Matter is disabled, `device.disable_bridge_mode` is `nil` and the checkbox is not displayed
|
||||
var matter_bridge_mode_changed = self.matter_enabled && (matter_disable_bridge_mode_current != matter_disable_bridge_mode_requested)
|
||||
if matter_bridge_mode_changed
|
||||
# Persist the next-boot topology while keeping the live topology coherent
|
||||
# until the restart below rebuilds all fixed Descriptor metadata.
|
||||
@@ -1544,7 +1547,7 @@ class Matter_UI
|
||||
#- and force restart -#
|
||||
webserver.redirect("/?rst=")
|
||||
else
|
||||
if matter_commissioning_requested != (self.device.commissioning.commissioning_open != nil)
|
||||
if self.matter_enabled && matter_commissioning_requested != (self.device.commissioning.commissioning_open != nil)
|
||||
if matter_commissioning_requested
|
||||
self.device.commissioning.start_root_basic_commissioning()
|
||||
else
|
||||
|
||||
@@ -927,7 +927,8 @@ class Matter_Device
|
||||
# Lazy subscription to tasmota/discovery/# — only on first config page visit
|
||||
#####################################################################
|
||||
def ensure_discovery()
|
||||
if !self.discovery_subscribed
|
||||
# when Matter is disabled, init() returns early and `discovery_subscribed` is `nil`
|
||||
if self.discovery_subscribed == false
|
||||
self.subscribe_discovery()
|
||||
self.discovery_subscribed = true
|
||||
end
|
||||
@@ -942,10 +943,12 @@ class Matter_Device
|
||||
# Parse discovery messages, store by topic
|
||||
def handle_global_discovery(mqtt_topic, data)
|
||||
if data == nil return end
|
||||
# discovery tables are not initialized when Matter is disabled
|
||||
if self.discovered_devices == nil || self.discovered_sensors == nil return end
|
||||
import json
|
||||
import string
|
||||
var j = type(data) == 'string' ? json.load(data) : data
|
||||
if j == nil return end
|
||||
if !isinstance(j, map) return end # also rejects `nil` and non-object JSON
|
||||
|
||||
# tasmota/discovery/<MAC>/config or tasmota/discovery/<MAC>/sensors
|
||||
var discovery_prefix_len = size("tasmota/discovery/")
|
||||
|
||||
Reference in new issue
Block a user