Skip to content

Conversation

hcarter-775
Copy link
Contributor

@hcarter-775 hcarter-775 commented Oct 14, 2025

Description of Change

We store data related to the device software version (saved from the BasicInformation cluster's softwareVersion attribute) on the driver st_store. This leverages that version to attempt a re-profiling if this is ever updated. The same data is what is leveraged by the hub to re-interview a device on a device update as well.

I also took the opportunity to remove the initialize_switch_and_buttons helper function in match_profile. This seemed like an extra layer of complexity that was no longer required at this point. Can revert if wanted but it changes no functionality so I see it as a nice change.

Summary of Completed Tests

Copy link

Copy link

github-actions bot commented Oct 14, 2025

Test Results

   71 files  ±0    455 suites  ±0   0s ⏱️ ±0s
2 354 tests ±0  2 354 ✅ ±0  0 💤 ±0  0 ❌ ±0 
3 977 runs  ±0  3 977 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 199f355. ± Comparison against base commit 07532ad.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Oct 14, 2025

File Coverage
All files 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/aqara_cube/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/generic_handlers/capability_handlers.lua 88%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/generic_handlers/attribute_handlers.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/generic_handlers/event_handlers.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/device_configuration.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/switch_utils.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/switch_fields.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/utils/embedded_cluster_utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/eve_energy/init.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 96%
/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 199f355

SwitchFields.DIMMABLE_LIGHT_ID = 0x0101
SwitchFields.COLOR_TEMPERATURE_LIGHT_ID = 0x010C
SwitchFields.EXTENDED_COLOR_LIGHT_ID = 0x010D
SwitchFields.ON_OFF_PLUG_IN_UNIT_ID = 0x010A
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be reverted, but I changed the device type fields to more closely match the spec-defined device types (ON_OFF_PLUG -> ON_OFF_PLUG_IN_UNIT) and I cut the DEVICE_TYPE out of the ones that had it, since it's kinda self-explanatory. If we think it's not, I might move them into their own file with a DeviceType header or something.

Comment on lines +202 to +213
local main_endpoint = switch_utils.find_default_endpoint(device)
local profile_name = nil

local server_onoff_eps = device:get_endpoints(clusters.OnOff.ID, { cluster_type = "SERVER" })
if #server_onoff_eps > 0 then
SwitchDeviceConfiguration.create_child_switch_devices(driver, device, server_onoff_eps, main_endpoint)
-- workaround: finds a profile for devices of the Light Switch device type set that break spec and implement OnOff as 'server' instead of 'client'.
-- note: since the Light Switch device set isn't supported, these devices join as a matter-thing.
if switch_utils.detect_matter_thing(device) then
profile_name = SwitchDeviceConfiguration.match_light_switch_device_profile(device, main_endpoint)
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may look like a change in functionality but it is not.

When removing the initialize_buttons_and_switches helper function, it became clear there was some formatting that no longer made a lot of sense. Aka, the semi-arbitrary profile_found = true statements and the

  if profile_found then
    return
  end

statement based around those declarations that had been in place since more logic was hidden by the helper function.

So what I did was remove that profile_found logic, and now have match_light_switch_device_profile use the same try_metadata_update as everything else (at the bottom of match_profile), only returning the profile name instead of doing an actual update.

I would have done the same for the button logic, but it gets a little messy due to the electrical energy stuff. This will be fixed though in the powerTopology PR, so we can streamline that too. I think having one point of contact with try_metadata_update is clearer, catches more edge cases by default, and is easier to maintain, which is why I'm moving the logic in that direction.

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.

1 participant