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
Empty file modified drivers/SmartThings/matter-lock/fingerprints.yml
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion drivers/SmartThings/matter-switch/profiles/ikea-scroll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ components:
- name: Button
metadata:
mnmn: SmartThingsEdge
vid: ikea-scroll
vid: ikea-scroll
3 changes: 3 additions & 0 deletions drivers/SmartThings/matter-switch/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function SwitchLifecycleHandlers.device_added(driver, device)
-- was created after the initial subscription report
if device.network_type == device_lib.NETWORK_TYPE_CHILD then
device:send(clusters.OnOff.attributes.OnOff:read(device))
elseif device.network_type == device_lib.NETWORK_TYPE_MATTER then
switch_utils.handle_electrical_sensor_info(device)
end

-- call device init in case init is not called after added due to device caching
Expand All @@ -55,6 +57,7 @@ end

function SwitchLifecycleHandlers.driver_switched(driver, device)
if device.network_type == device_lib.NETWORK_TYPE_MATTER and not switch_utils.detect_bridge(device) then
switch_utils.handle_electrical_sensor_info(device) -- field settings required for proper setup when switching drivers
device_cfg.match_profile(driver, device)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ end
test.register_coroutine_test(
"Profile should not change for devices with aggregator device type (bridges)",
function()
test.socket.device_lifecycle:__queue_receive({ mock_bridge.id, "added" })
test.socket.device_lifecycle:__queue_receive({ mock_bridge.id, "init" })
test.socket.device_lifecycle:__queue_receive({ mock_bridge.id, "doConfigure" })
mock_bridge:expect_metadata_update({ provisioning_state = "PROVISIONED" })
end,
{
test_init = test_init_mock_bridge,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ local function test_init()
})
mock_device:expect_metadata_update({ profile = "fan-modular", optional_component_capabilities = {{"main", {"fanSpeedPercent", "fanMode"}}} })
mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" })

local updated_device_profile = t_utils.get_profile_definition("fan-modular.yml",
{enabled_optional_capabilities = {{"main", {"fanSpeedPercent", "fanMode"}}}}
)
test.socket.device_lifecycle:__queue_receive(mock_device:generate_info_changed({ profile = updated_device_profile }))
test.socket.matter:__expect_send({mock_device.id, subscribe_request})
end

test.set_test_init_function(test_init)
Expand Down
15 changes: 15 additions & 0 deletions drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1293,4 +1293,19 @@ test.register_coroutine_test(
}
)

test.register_coroutine_test(
"Refresh necessary attributes",
function()
test.socket.capability:__queue_receive(
{mock_device.id, {capability = "refresh", component = "main", command = "refresh", args = {}}}
)
local read_request = cluster_subscribe_list[1]:read(mock_device)
for i, attr in ipairs(cluster_subscribe_list) do
if i > 1 then read_request:merge(attr:read(mock_device)) end
end
test.socket.matter:__expect_send({mock_device.id, read_request})
test.wait_for_events()
end
)

test.run_registered_tests()
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,13 @@ test.register_coroutine_test(
}
)

test.register_coroutine_test(
"Test init for device with requiring the switch category as a vendor override",
function()
end,
{ test_init = test_init_switch_vendor_override }
)

test.register_coroutine_test(
"Test init for mounted onoff control parent cluster as server",
function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,35 @@ test.register_coroutine_test(
}
)

test.register_coroutine_test(
"PercentCurrent reports and setPercent commands should be handled correctly after profile change",
function()
test_thermostat_device_type_update_modular_profile(mock_device, expected_metadata,
get_subscribe_request(mock_device, new_cluster_subscribe_list))

test.wait_for_events()

test.socket.matter:__queue_receive({
mock_device.id,
clusters.FanControl.attributes.PercentCurrent:build_test_report_data(mock_device, 2, 10)
})

test.socket.capability:__expect_send(
mock_device:generate_test_message("main", capabilities.fanSpeedPercent.percent(10))
)

test.wait_for_events()

test.socket.capability:__queue_receive({
mock_device.id,
{ capability = "fanSpeedPercent", component = "main", command = "setPercent", args = { 50 } }
})

test.socket.matter:__expect_send({
mock_device.id,
clusters.FanControl.attributes.PercentSetting:write(mock_device, 2, 50)
})
end
)

test.run_registered_tests()
Empty file modified drivers/SmartThings/zigbee-bed/src/test/test_shus_mattress.lua
100755 → 100644
Empty file.
42 changes: 42 additions & 0 deletions drivers/SmartThings/zigbee-button/src/test/test_aqara_button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ local mock_device_h1_single = test.mock_device.build_test_zigbee_device(
}
)

local COMP_LIST = { "button1", "button2", "all" }
local mock_device_e1 = test.mock_device.build_test_zigbee_device(
{
profile = t_utils.get_profile_definition("one-button-batteryLevel.yml"),
Expand Down Expand Up @@ -354,4 +355,45 @@ test.register_coroutine_test(
}
)

test.register_coroutine_test(
"Wireless Remote Switch H1 Mode Change",
function()
local mode = 2
local updates = {
preferences = {
[MODE_CHANGE] = true
}
}
test.socket.device_lifecycle:__queue_receive(mock_device_h1_double_rocker:generate_info_changed(updates))
mock_device_h1_double_rocker:set_field("devicemode", 1, { persist = true })
local attr_report_data = {
{ PRIVATE_ATTRIBUTE_ID_ALIVE, data_types.OctetString.ID, "\x01\x21\xB8\x0B\x03\x28\x19\x04\x21\xA8\x13\x05\x21\x45\x08\x06\x24\x07\x00\x00\x00\x00\x08\x21\x15\x01\x0A\x21\xF5\x65\x0C\x20\x01\x64\x20\x01\x66\x20\x03\x67\x20\x01\x68\x21\xA8\x00" }
}
test.wait_for_events()
test.socket.zigbee:__queue_receive({
mock_device_h1_double_rocker.id,
zigbee_test_utils.build_attribute_report(mock_device_h1_double_rocker, PRIVATE_CLUSTER_ID, attr_report_data,
MFG_CODE)
})
test.socket.zigbee:__expect_send({ mock_device_h1_double_rocker.id, cluster_base
.write_manufacturer_specific_attribute(mock_device_h1_double_rocker, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID_E1,
MFG_CODE, data_types.Uint8, mode) })
test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message("main",
capabilities.button.supportedButtonValues({ "pushed", "held", "double" }, { visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message("main",
capabilities.button.numberOfButtons({ value = 1 })))
test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message("main",
capabilities.button.button.pushed({ state_change = false })))

for i = 1, 3 do
test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message(COMP_LIST[i],
capabilities.button.supportedButtonValues({ "pushed", "held", "double" }, { visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message(COMP_LIST[i],
capabilities.button.numberOfButtons({ value = 1 })))
test.socket.capability:__expect_send(mock_device_h1_double_rocker:generate_test_message(COMP_LIST[i],
capabilities.button.button.pushed({ state_change = false })))
end
end
)

test.run_registered_tests()
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,24 @@ test.register_coroutine_test(
}
)

test.register_coroutine_test(
"ZoneStatusChangeNotification should be handled: clear",
function()
test.timer.__create_and_queue_test_time_advance_timer(6, "oneshot")
test.socket.zigbee:__queue_receive({
mock_device.id,
IASZone.client.commands.ZoneStatusChangeNotification.build_test_rx(mock_device, 0x0000, 0x00)
})

test.mock_time.advance_time(6)
test.socket.capability:__expect_send(
mock_device:generate_test_message("main", capabilities.smokeDetector.smoke.clear())
)

test.wait_for_events()
end
)

test.register_message_test(
"Temperature report should be handled (C) for the temperature cluster",
{
Expand Down
9 changes: 9 additions & 0 deletions drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,18 @@ local function set_level_handler(driver, device, cmd)
device:send(Level.commands.MoveToLevelWithOnOff(device, level, dimming_rate))
end

local function init(self, device)
local value = { minimum = 2700, maximum = 6000 }
if device:get_model() == "lumi.light.cwacn1" then
value.maximum = 6500
end
emit_event_if_latest_state_missing(device, "main", capabilities.colorTemperature, capabilities.colorTemperature.colorTemperatureRange.NAME, capabilities.colorTemperature.colorTemperatureRange(value))
end

local aqara_light_handler = {
NAME = "Aqara Light Handler",
lifecycle_handlers = {
init = init,
added = device_added,
doConfigure = do_configure
},
Expand Down
2 changes: 2 additions & 0 deletions drivers/SmartThings/zigbee-switch/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ local device_init = function(driver, device)
end
end

local lazy_load_if_possible = require "lazy_load_subdriver"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove unused


local zigbee_switch_driver_template = {
supported_capabilities = {
capabilities.switch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ zigbee_test_utils.prepare_zigbee_env_info()

local function test_init()
test.mock_device.add_test_device(mock_device)
test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({ minimum = 2700, maximum = 6000 })))
end

test.set_test_init_function(test_init)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ zigbee_test_utils.prepare_zigbee_env_info()

local function test_init()
test.mock_device.add_test_device(mock_device)
test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({ minimum = 2700, maximum = 6000 })))
end

test.set_test_init_function(test_init)
Expand Down
Empty file modified drivers/SmartThings/zigbee-switch/src/test/test_tuya_multi.lua
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
54 changes: 54 additions & 0 deletions drivers/SmartThings/zwave-sensor/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,60 @@ zwaveManufacturer:
productType: 0x0100
productId: 0x0082
deviceProfileName: shelly-wave-motion
- id: "aeotec/contact/8/eu"
deviceLabel: Aeotec Door Window Sensor 8
manufacturerId: 0x0371
productType: 0x0002
productId: 0x0037
deviceProfileName: aeotec-door-window-sensor-8
- id: "aeotec/contact/8/us"
deviceLabel: Aeotec Door Window Sensor 8
manufacturerId: 0x0371
productType: 0x0102
productId: 0x0037
deviceProfileName: aeotec-door-window-sensor-8
- id: "aeotec/contact/8/au"
deviceLabel: Aeotec Door Window Sensor 8
manufacturerId: 0x0371
productType: 0x0202
productId: 0x0037
deviceProfileName: aeotec-door-window-sensor-8
- id: aeotec/aerq/8/eu
deviceLabel: Aeotec aerQ 8
manufacturerId: 0x0371
productType: 0x0002
productId: 0x0039
deviceProfileName: aeotec-aerq-8
- id: aeotec/aerq/8/us
deviceLabel: Aeotec aerQ 8
manufacturerId: 0x0371
productType: 0x0102
productId: 0x0039
deviceProfileName: aeotec-aerq-8
- id: aeotec/aerq/8/au
deviceLabel: Aeotec aerQ 8
manufacturerId: 0x0371
productType: 0x0202
productId: 0x0039
deviceProfileName: aeotec-aerq-8
- id: "aeotec/water/8/eu"
deviceLabel: Aeotec Water Sensor 8
manufacturerId: 0x0371
productType: 0x0002
productId: 0x0038
deviceProfileName: aeotec-water-sensor-8
- id: "aeotec/water/8/us"
deviceLabel: Aeotec Water Sensor 8
manufacturerId: 0x0371
productType: 0x0102
productId: 0x0038
deviceProfileName: aeotec-water-sensor-8
- id: "aeotec/water/8/au"
deviceLabel: Aeotec Water Sensor 8
manufacturerId: 0x0371
productType: 0x0202
productId: 0x0038
deviceProfileName: aeotec-water-sensor-8
zwaveGeneric:
- id: "GenericSensorAlarm"
deviceLabel: Z-Wave Sensor
Expand Down
Loading
Loading