Skip to content
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
10 changes: 5 additions & 5 deletions drivers/SmartThings/zigbee-switch/src/inovelli-vzm31-sn/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ local function info_changed(driver, device, event, args)
local preferences = preference_map
if args.old_st_store.preferences["notificationChild"] ~= device.preferences.notificationChild and args.old_st_store.preferences["notificationChild"] == false and device.preferences.notificationChild == true then
if not device:get_child_by_parent_assigned_key('notification') then
add_child(driver,device,'rgbw-bulb-2700K-6500K','notificaiton')
add_child(driver,device,'rgbw-bulb-2700K-6500K','notification')
end
end
for id, value in pairs(device.preferences) do
Expand Down Expand Up @@ -229,10 +229,10 @@ local device_init = function(self, device)
end
device:send(cluster_base.read_attribute(device, data_types.ClusterId(0x0000), 0x4000))
else
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.colorControl.NAME, capabilities.colorControl.hue.NAME, capabilities.colorControl.hue(1))
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.colorControl.NAME, capabilities.colorControl.saturation.NAME, capabilities.colorControl.saturation(1))
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.colorTemperature.NAME, capabilities.colorTemperature.colorTemperature.NAME, capabilities.colorTemperature.colorTemperature(6500))
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.switchLevel.NAME, capabilities.switchLevel.level.NAME, capabilities.switchLevel.level(100))
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.colorControl, capabilities.colorControl.hue.NAME, capabilities.colorControl.hue(1))
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.colorControl, capabilities.colorControl.saturation.NAME, capabilities.colorControl.saturation(1))
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.colorTemperature, capabilities.colorTemperature.colorTemperature.NAME, capabilities.colorTemperature.colorTemperature(6500))
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.switchLevel, capabilities.switchLevel.level.NAME, capabilities.switchLevel.level(100))
switch_utils.emit_event_if_latest_state_missing(device, "main", capabilities.switch, capabilities.switch.switch.NAME, capabilities.switch.switch("off"))
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ local PRIVATE_MODE = "PRIVATE_MODE"

local mock_device = test.mock_device.build_test_zigbee_device(
{
label = "Aqara Smart Wall Switch H1 EU (No Neutral, Double Rocker) 1",
profile = t_utils.get_profile_definition("aqara-switch-no-power.yml"),
fingerprinted_endpoint_id = 0x01,
zigbee_endpoints = {
[1] = {
id = 1,
manufacturer = "LUMI",
model = "lumi.switch.l2aeu1",
server_clusters = { 0x0006 }
}
}
}
)

local mock_base_device = test.mock_device.build_test_zigbee_device(
{
label = "Aqara Smart Wall Switch H1 EU (No Neutral, Double Rocker) 1",
profile = t_utils.get_profile_definition("aqara-switch-no-power.yml"),
fingerprinted_endpoint_id = 0x01,
zigbee_endpoints = {
Expand All @@ -62,6 +79,7 @@ zigbee_test_utils.prepare_zigbee_env_info()

local function test_init()
test.mock_device.add_test_device(mock_device)
test.mock_device.add_test_device(mock_base_device)
test.mock_device.add_test_device(mock_child)
end

Expand Down Expand Up @@ -114,6 +132,30 @@ test.register_coroutine_test(
end
)

test.register_coroutine_test(
"Lifecycle - added test",
function()
-- The initial switch event should be send during the device's first time onboarding
test.socket.zigbee:__set_channel_ordering("relaxed")
test.socket.device_lifecycle:__queue_receive({ mock_base_device.id, "added" })
mock_base_device:expect_device_create({
type = "EDGE_CHILD",
label = "Aqara Smart Wall Switch H1 EU (No Neutral, Double Rocker) 2",
profile = "aqara-switch-child",
parent_device_id = mock_base_device.id,
parent_assigned_child_key = "02"
})
test.socket.capability:__expect_send(mock_base_device:generate_test_message("main", capabilities.button.numberOfButtons({ value = 2 },
{ visibility = { displayed = false } })))
test.socket.zigbee:__expect_send({ mock_base_device.id,
cluster_base.write_manufacturer_specific_attribute(mock_base_device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE,
data_types.Uint8, 1) })
test.socket.capability:__expect_send(mock_base_device:generate_test_message("main", capabilities.button.supportedButtonValues({ "pushed" },
{ visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_base_device:generate_test_message("main", capabilities.button.button.pushed({ state_change = false })))
end
)

test.register_coroutine_test(
"Refresh device",
function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

local test = require "integration_test"
local clusters = require "st.zigbee.zcl.clusters"
local ElectricalMeasurementCluster = clusters.ElectricalMeasurement
local OnOffCluster = clusters.OnOff
local LevelCluster = clusters.Level
local SimpleMeteringCluster = clusters.SimpleMetering
local capabilities = require "st.capabilities"
local t_utils = require "integration_test.utils"
local zigbee_test_utils = require "integration_test.zigbee_test_utils"

local mock_device = test.mock_device.build_test_zigbee_device({
profile = t_utils.get_profile_definition("switch-dimmer-power-energy.yml"),
Expand All @@ -27,19 +29,119 @@ local mock_device = test.mock_device.build_test_zigbee_device({
id = 1,
manufacturer = "Jasco Products",
model = "43082",
server_clusters = { 0x0000, 0x0003, 0x0004, 0x0005, 0x0006, 0x0008, 0x0702, 0x0B05 },
server_clusters = { 0x0000, 0x0003, 0x0004, 0x0005, 0x0006, 0x0008, 0x0702, 0x0B04 },
client_clusters = { 0x000A, 0x0019 }
}
}
})

zigbee_test_utils.prepare_zigbee_env_info()

local function test_init()
mock_device:set_field("_configuration_version", 1, {persist = true})
test.mock_device.add_test_device(mock_device)
end

test.set_test_init_function(test_init)

test.register_coroutine_test(
"lifecycle configure event should configure device",
function ()
test.socket.zigbee:__set_channel_ordering("relaxed")
test.socket.device_lifecycle:__queue_receive({mock_device.id, "doConfigure"})
test.socket.zigbee:__expect_send({
mock_device.id,
zigbee_test_utils.build_bind_request(mock_device,
zigbee_test_utils.mock_hub_eui,
ElectricalMeasurementCluster.ID)
})
test.socket.zigbee:__expect_send({
mock_device.id,
zigbee_test_utils.build_bind_request(mock_device,
zigbee_test_utils.mock_hub_eui,
OnOffCluster.ID)
})
test.socket.zigbee:__expect_send({
mock_device.id,
zigbee_test_utils.build_bind_request(mock_device,
zigbee_test_utils.mock_hub_eui,
LevelCluster.ID)
})
test.socket.zigbee:__expect_send({
mock_device.id,
zigbee_test_utils.build_bind_request(mock_device,
zigbee_test_utils.mock_hub_eui,
SimpleMeteringCluster.ID)
})
test.socket.zigbee:__expect_send({
mock_device.id,
ElectricalMeasurementCluster.attributes.ActivePower:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
ElectricalMeasurementCluster.attributes.ACPowerMultiplier:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
ElectricalMeasurementCluster.attributes.ACPowerDivisor:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
OnOffCluster.attributes.OnOff:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
LevelCluster.attributes.CurrentLevel:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
SimpleMeteringCluster.attributes.InstantaneousDemand:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
SimpleMeteringCluster.attributes.CurrentSummationDelivered:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
SimpleMeteringCluster.attributes.Multiplier:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
SimpleMeteringCluster.attributes.Divisor:read(mock_device)
})
test.socket.zigbee:__expect_send({
mock_device.id,
ElectricalMeasurementCluster.attributes.ACPowerMultiplier:configure_reporting(mock_device, 1, 43200, 1)
})
test.socket.zigbee:__expect_send({
mock_device.id,
ElectricalMeasurementCluster.attributes.ACPowerDivisor:configure_reporting(mock_device, 1, 43200, 1)
})
test.socket.zigbee:__expect_send({
mock_device.id,
ElectricalMeasurementCluster.attributes.ActivePower:configure_reporting(mock_device, 5, 3600, 5)
})
test.socket.zigbee:__expect_send({
mock_device.id,
OnOffCluster.attributes.OnOff:configure_reporting(mock_device, 0, 300)
})
test.socket.zigbee:__expect_send({
mock_device.id,
LevelCluster.attributes.CurrentLevel:configure_reporting(mock_device, 1, 3600, 1)
})
test.socket.zigbee:__expect_send({
mock_device.id,
SimpleMeteringCluster.attributes.InstantaneousDemand:configure_reporting(mock_device, 5, 3600, 5)
})
test.socket.zigbee:__expect_send({
mock_device.id,
SimpleMeteringCluster.attributes.CurrentSummationDelivered:configure_reporting(mock_device, 5, 3600, 1)
})

mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" })
end
)

test.register_message_test(
"Capability command On should be handled",
{
Expand Down
Loading
Loading