Skip to content

Commit 98114d8

Browse files
authored
Merge pull request #2886 from SmartThingsCommunity/colorTempPhysicalMireds-zigbee-switch-test-fixes
Fixing zigbee-switch tests for ColorTempPhysMireds - Added Jenkins testing against the development build of lua-libs
2 parents a23af85 + 8c3a810 commit 98114d8

10 files changed

+1121
-24
lines changed

.github/workflows/jenkins-driver-tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
paths:
55
- 'drivers/**'
66

7+
pull_request_target:
8+
paths:
9+
- 'drivers/**'
10+
711
permissions:
812
statuses: write
913

@@ -12,7 +16,7 @@ jobs:
1216
strategy:
1317
matrix:
1418
version:
15-
[ 59, 60 ]
19+
[ 59, 60, dev]
1620

1721
runs-on: ubuntu-latest
1822
steps:

drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua

Lines changed: 146 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,155 @@ test.register_coroutine_test(
423423
mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" })
424424
end,
425425
{
426-
min_api_version = 17
426+
min_api_version = 17,
427+
max_api_version = 19
427428
}
428429
)
429430

431+
test.register_coroutine_test(
432+
"lifecycle configure event should configure device",
433+
function ()
434+
test.socket.zigbee:__set_channel_ordering("relaxed")
435+
test.socket.device_lifecycle:__queue_receive({mock_device.id, "doConfigure"})
436+
437+
test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) })
438+
test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) })
439+
440+
test.socket.zigbee:__expect_send({
441+
mock_device.id,
442+
OnOff.attributes.OnOff:read(mock_device)
443+
})
444+
test.socket.zigbee:__expect_send({
445+
mock_device.id,
446+
Level.attributes.CurrentLevel:read(mock_device)
447+
})
448+
test.socket.zigbee:__expect_send({
449+
mock_device.id,
450+
ColorControl.attributes.ColorTemperatureMireds:read(mock_device)
451+
})
452+
test.socket.zigbee:__expect_send({
453+
mock_device.id,
454+
ColorControl.attributes.CurrentHue:read(mock_device)
455+
})
456+
test.socket.zigbee:__expect_send({
457+
mock_device.id,
458+
ColorControl.attributes.CurrentSaturation:read(mock_device)
459+
})
460+
test.socket.zigbee:__expect_send({
461+
mock_device.id,
462+
zigbee_test_utils.build_bind_request(mock_device,
463+
zigbee_test_utils.mock_hub_eui,
464+
OnOff.ID)
465+
})
466+
test.socket.zigbee:__expect_send({
467+
mock_device.id,
468+
SimpleMetering.attributes.InstantaneousDemand:read(mock_device)
469+
})
470+
test.socket.zigbee:__expect_send({
471+
mock_device.id,
472+
SimpleMetering.attributes.CurrentSummationDelivered:read(mock_device)
473+
})
474+
test.socket.zigbee:__expect_send({
475+
mock_device.id,
476+
ElectricalMeasurement.attributes.ActivePower:read(mock_device)
477+
})
478+
test.socket.zigbee:__expect_send({
479+
mock_device.id,
480+
OnOff.attributes.OnOff:configure_reporting(mock_device, 0, 300)
481+
})
482+
test.socket.zigbee:__expect_send({
483+
mock_device.id,
484+
zigbee_test_utils.build_bind_request(mock_device,
485+
zigbee_test_utils.mock_hub_eui,
486+
Level.ID)
487+
})
488+
test.socket.zigbee:__expect_send({
489+
mock_device.id,
490+
Level.attributes.CurrentLevel:configure_reporting(mock_device, 1, 3600, 1)
491+
})
492+
test.socket.zigbee:__expect_send({
493+
mock_device.id,
494+
zigbee_test_utils.build_bind_request(mock_device,
495+
zigbee_test_utils.mock_hub_eui,
496+
ColorControl.ID)
497+
})
498+
test.socket.zigbee:__expect_send({
499+
mock_device.id,
500+
ColorControl.attributes.ColorTemperatureMireds:configure_reporting(mock_device, 1, 3600, 0x0010)
501+
})
502+
test.socket.zigbee:__expect_send({
503+
mock_device.id,
504+
ColorControl.attributes.CurrentHue:configure_reporting(mock_device, 1, 3600, 0x0010)
505+
})
506+
test.socket.zigbee:__expect_send({
507+
mock_device.id,
508+
ColorControl.attributes.CurrentSaturation:configure_reporting(mock_device, 1, 3600, 0x0010)
509+
})
510+
test.socket.zigbee:__expect_send({
511+
mock_device.id,
512+
ColorControl.attributes.ColorTempPhysicalMaxMireds:configure_reporting(mock_device, 1, 43200, 1)
513+
})
514+
test.socket.zigbee:__expect_send({
515+
mock_device.id,
516+
ColorControl.attributes.ColorTempPhysicalMinMireds:configure_reporting(mock_device, 1, 43200, 1)
517+
})
518+
test.socket.zigbee:__expect_send({
519+
mock_device.id,
520+
zigbee_test_utils.build_bind_request(mock_device,
521+
zigbee_test_utils.mock_hub_eui,
522+
SimpleMetering.ID)
523+
})
524+
test.socket.zigbee:__expect_send({
525+
mock_device.id,
526+
SimpleMetering.attributes.InstantaneousDemand:configure_reporting(mock_device, 5, 3600, 5)
527+
})
528+
test.socket.zigbee:__expect_send({
529+
mock_device.id,
530+
SimpleMetering.attributes.CurrentSummationDelivered:configure_reporting(mock_device, 5, 3600, 1)
531+
})
532+
test.socket.zigbee:__expect_send({
533+
mock_device.id,
534+
zigbee_test_utils.build_bind_request(mock_device,
535+
zigbee_test_utils.mock_hub_eui,
536+
ElectricalMeasurement.ID)
537+
})
538+
test.socket.zigbee:__expect_send({
539+
mock_device.id,
540+
ElectricalMeasurement.attributes.ActivePower:configure_reporting(mock_device, 5, 3600, 5)
541+
})
542+
test.socket.zigbee:__expect_send({
543+
mock_device.id,
544+
ElectricalMeasurement.attributes.ACPowerMultiplier:configure_reporting(mock_device, 1, 43200, 1)
545+
})
546+
test.socket.zigbee:__expect_send({
547+
mock_device.id,
548+
ElectricalMeasurement.attributes.ACPowerDivisor:configure_reporting(mock_device, 1, 43200, 1)
549+
})
550+
test.socket.zigbee:__expect_send({
551+
mock_device.id,
552+
ElectricalMeasurement.attributes.ACPowerDivisor:read(mock_device)
553+
})
554+
test.socket.zigbee:__expect_send({
555+
mock_device.id,
556+
ElectricalMeasurement.attributes.ACPowerMultiplier:read(mock_device)
557+
})
558+
test.socket.zigbee:__expect_send({
559+
mock_device.id,
560+
SimpleMetering.attributes.Multiplier:read(mock_device)
561+
})
562+
test.socket.zigbee:__expect_send({
563+
mock_device.id,
564+
SimpleMetering.attributes.Divisor:read(mock_device)
565+
})
566+
test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMaxMireds:read(mock_device) })
567+
test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTempPhysicalMinMireds:read(mock_device) })
568+
569+
mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" })
570+
end,
571+
{
572+
min_api_version = 20
573+
}
574+
)
430575
-- test.register_coroutine_test(
431576
-- "health check coroutine",
432577
-- function()

drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,75 @@ test.register_coroutine_test(
109109
mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" })
110110
end,
111111
{
112-
min_api_version = 17
112+
min_api_version = 17,
113+
max_api_version = 19
114+
}
115+
)
116+
117+
test.register_coroutine_test(
118+
"Configure should configure all necessary attributes and refresh device",
119+
function()
120+
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" })
121+
test.socket.zigbee:__set_channel_ordering("relaxed")
122+
123+
test.socket.zigbee:__expect_send(
124+
{
125+
mock_device.id,
126+
ColorControl.commands.MoveToColorTemperature(mock_device, 200, 0)
127+
}
128+
)
129+
130+
test.socket.zigbee:__expect_send({
131+
mock_device.id,
132+
zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, Level.ID)
133+
})
134+
test.socket.zigbee:__expect_send(
135+
{
136+
mock_device.id,
137+
Level.attributes.CurrentLevel:configure_reporting(mock_device, 1, 3600, 1)
138+
}
139+
)
140+
test.socket.zigbee:__expect_send({
141+
mock_device.id,
142+
zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, ColorControl.ID)
143+
})
144+
test.socket.zigbee:__expect_send(
145+
{
146+
mock_device.id,
147+
ColorControl.attributes.ColorTemperatureMireds:configure_reporting(mock_device, 1, 3600, 16)
148+
}
149+
)
150+
test.socket.zigbee:__expect_send({
151+
mock_device.id,
152+
zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, OnOff.ID)
153+
})
154+
test.socket.zigbee:__expect_send(
155+
{
156+
mock_device.id,
157+
OnOff.attributes.OnOff:configure_reporting(mock_device, 0, 300, 1)
158+
}
159+
)
160+
test.socket.zigbee:__expect_send(
161+
{
162+
mock_device.id,
163+
ColorControl.attributes.ColorTempPhysicalMaxMireds:configure_reporting(mock_device, 1, 43200, 1)
164+
}
165+
)
166+
test.socket.zigbee:__expect_send(
167+
{
168+
mock_device.id,
169+
ColorControl.attributes.ColorTempPhysicalMinMireds:configure_reporting(mock_device, 1, 43200, 1)
170+
}
171+
)
172+
173+
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) })
174+
test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) })
175+
test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) })
176+
177+
mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" })
178+
end,
179+
{
180+
min_api_version = 20
113181
}
114182
)
115183

drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,85 @@ test.register_coroutine_test(
106106
OnOff.attributes.OnOff:configure_reporting(mock_device, 0, 300, 1)
107107
}
108108
)
109+
test.socket.zigbee:__expect_send(
110+
{
111+
mock_device.id,
112+
ColorControl.attributes.ColorTempPhysicalMaxMireds:configure_reporting(mock_device, 1, 43200, 1)
113+
}
114+
)
115+
test.socket.zigbee:__expect_send(
116+
{
117+
mock_device.id,
118+
ColorControl.attributes.ColorTempPhysicalMinMireds:configure_reporting(mock_device, 1, 43200, 1)
119+
}
120+
)
109121

110122
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) })
111123
test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) })
112124
test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) })
125+
mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" })
126+
end,
127+
{
128+
min_api_version = 20
129+
}
130+
)
131+
132+
133+
test.register_coroutine_test(
134+
"Configure should configure all necessary attributes and refresh device",
135+
function()
136+
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" })
137+
test.socket.zigbee:__set_channel_ordering("relaxed")
113138

139+
test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnTransitionTime:write(mock_device, 0) })
140+
test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OffTransitionTime:write(mock_device, 0) })
141+
142+
test.socket.zigbee:__expect_send(
143+
{
144+
mock_device.id,
145+
ColorControl.commands.MoveToColorTemperature(mock_device, 200, 0)
146+
}
147+
)
148+
149+
test.socket.zigbee:__expect_send({
150+
mock_device.id,
151+
zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, Level.ID)
152+
})
153+
test.socket.zigbee:__expect_send(
154+
{
155+
mock_device.id,
156+
Level.attributes.CurrentLevel:configure_reporting(mock_device, 1, 3600, 1)
157+
}
158+
)
159+
test.socket.zigbee:__expect_send({
160+
mock_device.id,
161+
zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, ColorControl.ID)
162+
})
163+
test.socket.zigbee:__expect_send(
164+
{
165+
mock_device.id,
166+
ColorControl.attributes.ColorTemperatureMireds:configure_reporting(mock_device, 1, 3600, 16)
167+
}
168+
)
169+
test.socket.zigbee:__expect_send({
170+
mock_device.id,
171+
zigbee_test_utils.build_bind_request(mock_device, zigbee_test_utils.mock_hub_eui, OnOff.ID)
172+
})
173+
test.socket.zigbee:__expect_send(
174+
{
175+
mock_device.id,
176+
OnOff.attributes.OnOff:configure_reporting(mock_device, 0, 300, 1)
177+
}
178+
)
179+
180+
test.socket.zigbee:__expect_send({ mock_device.id, OnOff.attributes.OnOff:read(mock_device) })
181+
test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.CurrentLevel:read(mock_device) })
182+
test.socket.zigbee:__expect_send({ mock_device.id, ColorControl.attributes.ColorTemperatureMireds:read(mock_device) })
114183
mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" })
115184
end,
116185
{
117-
min_api_version = 17
186+
min_api_version = 17,
187+
max_api_version = 19
118188
}
119189
)
120190

0 commit comments

Comments
 (0)