Skip to content

Matter Switch: Remove ghost events, re-provision after driver switch#2978

Merged
hcarter-775 merged 1 commit into
mainfrom
provision-driver-switch
May 19, 2026
Merged

Matter Switch: Remove ghost events, re-provision after driver switch#2978
hcarter-775 merged 1 commit into
mainfrom
provision-driver-switch

Conversation

@hcarter-775
Copy link
Copy Markdown
Contributor

@hcarter-775 hcarter-775 commented May 18, 2026

Description of Change

Remove pushed event during configuration. This is not a required operation, and generates events not pre-conditioned by a device event.

Set device provisioning state back to PROVISIONED after a driverSwitched event to block repeated events.

Summary of Completed Tests

Tests updated. Driver switch tested with button device switched. Fresh button onboarding tested.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Channel deleted.

@github-actions
Copy link
Copy Markdown

Test Results

   72 files    510 suites   0s ⏱️
2 858 tests 2 858 ✅ 0 💤 0 ❌
4 728 runs  4 728 ✅ 0 💤 0 ❌

Results for commit 5b1d6bd.

@github-actions
Copy link
Copy Markdown

File Coverage
All files 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/ikea_scroll/init.lua 87%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/capability_handlers.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/event_handlers.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua 80%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/utils.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/device_configuration.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/embedded_cluster_utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/utils.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/aqara_cube/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/capability_handlers.lua 82%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/attribute_handlers.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/eve_energy/init.lua 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/ikea_scroll/scroll_handlers/event_handlers.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/third_reality_mk1/init.lua 95%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 5b1d6bd

@cjswedes
Copy link
Copy Markdown
Contributor

Remove pushed event during configuration. This is not a required operation, and generates events not pre-conditioned by a device event.

I am not 100% sure about this, but I thought we did this to make sure there was an event for the capability to allow the app to see the device as online (not greyed out in the app). Did you test onboarding a button without it?

@mocelet
Copy link
Copy Markdown

mocelet commented May 19, 2026

Set device provisioning state back to PROVISIONED after a driverSwitched event to block repeated events

May I ask what does it block exactly?

Could not find much documentation about the provisioning states and, in fact, just realized many of my Matter devices have a provisioning state of NONFUNCTIONAL (probably due to driver changes) but they are working perfectly fine, no warnings or anything. An old post at the Community stated that it had no effect.

@hcarter-775
Copy link
Copy Markdown
Contributor Author

I am not 100% sure about this, but I thought we did this to make sure there was an event for the capability to allow the app to see the device as online (not greyed out in the app). Did you test onboarding a button without it?

@cjswedes Yes, I have tested onboarding a button without it and there is no difference in the UI elements with or without the extra event. I agree that there might have been some client reason for this event in the past, but it is no longer required.

@hcarter-775
Copy link
Copy Markdown
Contributor Author

May I ask what does it block exactly?

Could not find much documentation about the provisioning states and, in fact, just realized many of my Matter devices have a provisioning state of NONFUNCTIONAL (probably due to driver changes) but they are working perfectly fine, no warnings or anything. An old post at the Community stated that it had no effect.

@mocelet Without this change, devices switched into this driver will get the DRIVER_SWITCH provisioning state and will not lose it, meaning that the driverSwitched event will be queued on each startup. The default handling of driverSwitched will switch a device into either PROVISIONED or NONFUNCTIONAL and neither really has any significant difference today besides developer use. However, for reference if desired, a TYPED state will queue doConfigure and DRIVER_SWITCH will queue driverSwitched ad nauseam on startup.

@mocelet
Copy link
Copy Markdown

mocelet commented May 19, 2026

Perfect, thanks as always @hcarter-775 for the insights!

@hcarter-775 hcarter-775 merged commit 8b1cecd into main May 19, 2026
13 of 16 checks passed
@hcarter-775 hcarter-775 deleted the provision-driver-switch branch May 19, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants