Skip to content

Commit

Permalink
Merge pull request #1202 from SmartThingsCommunity/bugfix/matter-butt…
Browse files Browse the repository at this point in the history
…on-battery-check

Matter Button: specifically check for battery in power source
  • Loading branch information
ctowns authored Feb 2, 2024
2 parents df71c0a + a58f397 commit 6a6060d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion drivers/SmartThings/matter-button/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ local function device_added(driver, device)

local battery_support = false
if device.manufacturer_info.vendor_id ~= HUE_MANUFACTURER_ID and
#device:get_endpoints(clusters.PowerSource.ID) > 0 then
#device:get_endpoints(clusters.PowerSource.ID, {feature_bitmap = clusters.PowerSource.types.PowerSourceFeature.BATTERY}) > 0 then
battery_support = true
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local mock_device = test.mock_device.build_test_matter_device(
feature_map = clusters.Switch.types.SwitchFeature.MOMENTARY_SWITCH,
cluster_type = "SERVER"
},
{cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER"}
{cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER", feature_map = clusters.PowerSource.types.PowerSourceFeature.BATTERY}
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local mock_device = test.mock_device.build_test_matter_device(
feature_map = clusters.Switch.types.SwitchFeature.MOMENTARY_SWITCH,
cluster_type = "SERVER"
},
{cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER"}
{cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER", feature_map = clusters.PowerSource.types.PowerSourceFeature.BATTERY}
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local mock_device = test.mock_device.build_test_matter_device(
feature_map = clusters.Switch.types.SwitchFeature.MOMENTARY_SWITCH,
cluster_type = "SERVER"
},
{cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER"}
{cluster_id = clusters.PowerSource.ID, cluster_type = "SERVER", feature_map = clusters.PowerSource.types.PowerSourceFeature.BATTERY}
},
},
{
Expand Down

0 comments on commit 6a6060d

Please sign in to comment.