Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rolling up beta to production #1286

Merged
merged 7 commits into from
Mar 26, 2024
Merged
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
7 changes: 7 additions & 0 deletions drivers/SmartThings/matter-switch/fingerprints.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
matterManufacturer:
#ThirdReality
- id: "ThirdReality/WiFi"
deviceLabel: THIRDREALITY Night Light
vendorId: 0x1407
productId: 0x1088
deviceProfileName: light-color-level-illuminance-motion-1000K-15000K

#Eve
- id: "Eve/Energy/US"
deviceLabel: Eve Energy
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: light-color-level-illuminance-motion-1000K-15000K
components:
- id: main
capabilities:
- id: switch
version: 1
- id: switchLevel
version: 1
- id: colorTemperature
version: 1
config:
values:
- key: "colorTemperature.value"
range: [ 1000, 15000 ]
- id: colorControl
version: 1
- id: motionSensor
version: 1
- id: illuminanceMeasurement
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
categories:
- name: Light

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: light-color-level-illuminance-motion
components:
- id: main
capabilities:
- id: switch
version: 1
- id: switchLevel
version: 1
- id: colorTemperature
version: 1
- id: colorControl
version: 1
- id: motionSensor
version: 1
- id: illuminanceMeasurement
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
categories:
- name: Light

26 changes: 25 additions & 1 deletion drivers/SmartThings/matter-switch/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,16 @@ local function color_cap_attr_handler(driver, device, ib, response)
end
end


local function illuminance_attr_handler(driver, device, ib, response)
local lux = math.floor(10 ^ ((ib.data.value - 1) / 10000))
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.illuminanceMeasurement.illuminance(lux))
end

local function occupancy_attr_handler(driver, device, ib, response)
device:emit_event(ib.data.value == 0x01 and capabilities.motionSensor.motion.active() or capabilities.motionSensor.motion.inactive())
end

local function info_changed(driver, device, event, args)
if device.profile.id ~= args.old_st_store.profile.id then
device:subscribe()
Expand Down Expand Up @@ -374,6 +384,12 @@ local matter_driver_template = {
[clusters.ColorControl.attributes.CurrentX.ID] = x_attr_handler,
[clusters.ColorControl.attributes.CurrentY.ID] = y_attr_handler,
[clusters.ColorControl.attributes.ColorCapabilities.ID] = color_cap_attr_handler,
},
[clusters.IlluminanceMeasurement.ID] = {
[clusters.IlluminanceMeasurement.attributes.MeasuredValue.ID] = illuminance_attr_handler
},
[clusters.OccupancySensing.ID] = {
[clusters.OccupancySensing.attributes.Occupancy.ID] = occupancy_attr_handler,
}
},
fallback = matter_handler,
Expand All @@ -394,6 +410,12 @@ local matter_driver_template = {
[capabilities.colorTemperature.ID] = {
clusters.ColorControl.attributes.ColorTemperatureMireds,
},
[capabilities.illuminanceMeasurement.ID] = {
clusters.IlluminanceMeasurement.attributes.MeasuredValue
},
[capabilities.motionSensor.ID] = {
clusters.OccupancySensing.attributes.Occupancy
}
},
capability_handlers = {
[capabilities.switch.ID] = {
Expand All @@ -420,9 +442,11 @@ local matter_driver_template = {
capabilities.switchLevel,
capabilities.colorControl,
capabilities.colorTemperature,
capabilities.motionSensor,
capabilities.illuminanceMeasurement
},
sub_drivers = {
require("eve-energy")
require("eve-energy"),
}
}

Expand Down
Loading
Loading