Skip to content
Open
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
22 changes: 22 additions & 0 deletions drivers/SmartThings/matter-switch/profiles/light-level-fan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: light-level-fan
components:
- id: main
capabilities:
- id: switch
version: 1
- id: switchLevel
version: 1
config:
values:
- key: "level.value"
range: [1, 100]
- id: fanMode
version: 1
- id: fanSpeedPercent
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
categories:
- name: Light
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,18 @@ function DeviceConfiguration.match_profile(driver, device)
end

if switch_utils.tbl_contains(server_onoff_ep_ids, default_endpoint_id) then
local fan_control_supported = #device:get_endpoints(clusters.FanControl.ID) > 0
updated_profile = SwitchDeviceConfiguration.assign_profile_for_onoff_ep(device, default_endpoint_id)
local generic_profile = function(s) return string.find(updated_profile or "", s, 1, true) end
if generic_profile("plug-binary") or generic_profile("plug-level") then
if (generic_profile("plug-binary") or generic_profile("light-binary")) and fan_control_supported then
updated_profile = "switch-fan"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this profile exist already? I don't see it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, did some copy pasting from this PR where that guy does exist

elseif generic_profile("light-level") and fan_control_supported then
updated_profile = "light-level-fan"
elseif generic_profile("light-color-level") and fan_control_supported then
updated_profile = "light-color-level-fan"
elseif generic_profile("light-level") and #device:get_endpoints(clusters.OccupancySensing.ID) > 0 then
updated_profile = "light-level-motion"
elseif generic_profile("plug-binary") or generic_profile("plug-level") then
if switch_utils.check_switch_category_vendor_overrides(device) then
updated_profile = string.gsub(updated_profile, "plug", "switch")
else
Expand All @@ -189,10 +198,6 @@ function DeviceConfiguration.match_profile(driver, device)
if #embedded_cluster_utils.get_endpoints(device, clusters.ElectricalEnergyMeasurement.ID) > 0 then electrical_tags = electrical_tags .. "-energy-powerConsumption" end
if electrical_tags ~= "" then updated_profile = string.gsub(updated_profile, "-binary", "") .. electrical_tags end
end
elseif generic_profile("light-color-level") and #device:get_endpoints(clusters.FanControl.ID) > 0 then
updated_profile = "light-color-level-fan"
elseif generic_profile("light-level") and #device:get_endpoints(clusters.OccupancySensing.ID) > 0 then
updated_profile = "light-level-motion"
elseif generic_profile("light-level-colorTemperature") or generic_profile("light-color-level") then
-- ignore attempts to dynamically profile light-level-colorTemperature and light-color-level devices for now, since
-- these may lose fingerprinted Kelvin ranges when dynamically profiled.
Expand Down
Loading