-
Notifications
You must be signed in to change notification settings - Fork 498
Add Linxura Smart Controller Zigbee mode integrate with SmartThings hub #1829
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fa1731d
Add Linxura Smart Controller Zigbee mode integrate with SmartThings hub
simon3panda 2c3b445
Update init.lua
simon3panda 83164e1
Modify fingerprint.
simon3panda 855522f
Update fingerprints.yml
simon3panda 5a22b33
Update four-buttons-without-main-button.yml
simon3panda 94b8851
Add Aura smart button device.
simon3panda 8afe8bb
Modify Linxura Aura Smart Button configuration
simon3panda e668683
Update fingerprints.yml
simon3panda 2a9c076
Update init.lua
simon3panda f420544
Merge branch 'main' into Linxura_test
simon3panda 2aafa60
Merge branch 'SmartThingsCommunity:main' into Linxura_test
simon3panda 545e9b3
Update init.lua
simon3panda aedae38
add test files for Linxura Smart Controller and Aura Smart Button
simon3panda e5ba868
add button_attr
simon3panda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
drivers/SmartThings/zigbee-button/profiles/four-buttons-without-main-button.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: four-buttons-without-main-button | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: RemoteController | ||
- id: button1 | ||
capabilities: | ||
- id: button | ||
version: 1 | ||
categories: | ||
- name: RemoteController | ||
- id: button2 | ||
capabilities: | ||
- id: button | ||
version: 1 | ||
categories: | ||
- name: RemoteController | ||
- id: button3 | ||
capabilities: | ||
- id: button | ||
version: 1 | ||
categories: | ||
- name: RemoteController | ||
- id: button4 | ||
capabilities: | ||
- id: button | ||
version: 1 | ||
categories: | ||
- name: RemoteController |
124 changes: 124 additions & 0 deletions
124
drivers/SmartThings/zigbee-button/src/test/test_linxura_aura_smart_button.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
-- Copyright 2024 SmartThings | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
|
||
-- Mock out globals | ||
local test = require "integration_test" | ||
local clusters = require "st.zigbee.zcl.clusters" | ||
local IASZone = clusters.IASZone | ||
local capabilities = require "st.capabilities" | ||
local zigbee_test_utils = require "integration_test.zigbee_test_utils" | ||
local t_utils = require "integration_test.utils" | ||
|
||
local ZoneStatusAttribute = IASZone.attributes.ZoneStatus | ||
local button_attr = capabilities.button.button | ||
|
||
local mock_device = test.mock_device.build_test_zigbee_device( | ||
{ | ||
profile = t_utils.get_profile_definition("four-buttons-without-main-button.yml"), | ||
zigbee_endpoints = { | ||
[1] = { | ||
id = 1, | ||
manufacturer = "Linxura", | ||
model = "Aura Smart Button", | ||
server_clusters = {0x0500, 0x0000} | ||
} | ||
} | ||
} | ||
) | ||
|
||
zigbee_test_utils.prepare_zigbee_env_info() | ||
local function test_init() | ||
test.mock_device.add_test_device(mock_device) | ||
zigbee_test_utils.init_noop_health_check_timer() | ||
end | ||
|
||
test.set_test_init_function(test_init) | ||
|
||
test.register_coroutine_test( | ||
"added lifecycle event", | ||
function() | ||
test.socket.capability:__set_channel_ordering("relaxed") | ||
for button_name, _ in pairs(mock_device.profile.components) do | ||
if button_name ~= "main" then | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message( | ||
button_name, | ||
capabilities.button.supportedButtonValues({ "pushed", "held", "double" }, { visibility = { displayed = false } }) | ||
) | ||
) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message( | ||
button_name, | ||
capabilities.button.numberOfButtons({ value = 1 }, { visibility = { displayed = false } }) | ||
) | ||
) | ||
end | ||
end | ||
|
||
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) | ||
test.wait_for_events() | ||
end | ||
) | ||
|
||
test.register_coroutine_test( | ||
"Test cases for Buttons Pushed", | ||
function() | ||
for var = 0, 3 do | ||
test.socket.zigbee:__queue_receive({ | ||
mock_device.id, | ||
ZoneStatusAttribute:build_test_attr_report(mock_device, 1 + var * 6) | ||
}) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message(string.format("button%d", var + 1), button_attr.pushed({ state_change = true })) | ||
) | ||
test.wait_for_events() | ||
end | ||
end | ||
) | ||
|
||
test.register_coroutine_test( | ||
"Test cases for Buttons Double", | ||
function() | ||
for var = 0, 3 do | ||
test.socket.zigbee:__queue_receive({ | ||
mock_device.id, | ||
ZoneStatusAttribute:build_test_attr_report(mock_device, 3 + var * 6) | ||
}) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message(string.format("button%d", var + 1), button_attr.double({ state_change = true })) | ||
) | ||
test.wait_for_events() | ||
end | ||
end | ||
) | ||
|
||
|
||
test.register_coroutine_test( | ||
"Test cases for Buttons Held", | ||
function() | ||
for var = 0, 3 do | ||
test.socket.zigbee:__queue_receive({ | ||
mock_device.id, | ||
ZoneStatusAttribute:build_test_attr_report(mock_device, 5 + var * 6) | ||
}) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message(string.format("button%d", var + 1), button_attr.held({ state_change = true })) | ||
) | ||
test.wait_for_events() | ||
end | ||
end | ||
) | ||
|
||
|
||
test.run_registered_tests() |
124 changes: 124 additions & 0 deletions
124
drivers/SmartThings/zigbee-button/src/test/test_linxura_smart_controller_4x_button.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
-- Copyright 2024 SmartThings | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
|
||
-- Mock out globals | ||
local test = require "integration_test" | ||
local clusters = require "st.zigbee.zcl.clusters" | ||
local IASZone = clusters.IASZone | ||
local capabilities = require "st.capabilities" | ||
local zigbee_test_utils = require "integration_test.zigbee_test_utils" | ||
local t_utils = require "integration_test.utils" | ||
|
||
local ZoneStatusAttribute = IASZone.attributes.ZoneStatus | ||
local button_attr = capabilities.button.button | ||
|
||
local mock_device = test.mock_device.build_test_zigbee_device( | ||
{ | ||
profile = t_utils.get_profile_definition("four-buttons-without-main-button.yml"), | ||
zigbee_endpoints = { | ||
[1] = { | ||
id = 1, | ||
manufacturer = "Linxura", | ||
model = "Smart Controller", | ||
server_clusters = {0x0500, 0x0000} | ||
} | ||
} | ||
} | ||
) | ||
|
||
zigbee_test_utils.prepare_zigbee_env_info() | ||
local function test_init() | ||
test.mock_device.add_test_device(mock_device) | ||
zigbee_test_utils.init_noop_health_check_timer() | ||
end | ||
|
||
test.set_test_init_function(test_init) | ||
|
||
test.register_coroutine_test( | ||
"added lifecycle event", | ||
function() | ||
test.socket.capability:__set_channel_ordering("relaxed") | ||
for button_name, _ in pairs(mock_device.profile.components) do | ||
if button_name ~= "main" then | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message( | ||
button_name, | ||
capabilities.button.supportedButtonValues({ "pushed", "held", "double" }, { visibility = { displayed = false } }) | ||
) | ||
) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message( | ||
button_name, | ||
capabilities.button.numberOfButtons({ value = 1 }, { visibility = { displayed = false } }) | ||
) | ||
) | ||
end | ||
end | ||
|
||
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) | ||
test.wait_for_events() | ||
end | ||
) | ||
|
||
test.register_coroutine_test( | ||
"Test cases for Buttons Pushed", | ||
function() | ||
for var = 0, 3 do | ||
test.socket.zigbee:__queue_receive({ | ||
mock_device.id, | ||
ZoneStatusAttribute:build_test_attr_report(mock_device, 1 + var * 6) | ||
}) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message(string.format("button%d", var + 1), button_attr.pushed({ state_change = true })) | ||
) | ||
test.wait_for_events() | ||
end | ||
end | ||
) | ||
|
||
test.register_coroutine_test( | ||
"Test cases for Buttons Double", | ||
function() | ||
for var = 0, 3 do | ||
test.socket.zigbee:__queue_receive({ | ||
mock_device.id, | ||
ZoneStatusAttribute:build_test_attr_report(mock_device, 3 + var * 6) | ||
}) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message(string.format("button%d", var + 1), button_attr.double({ state_change = true })) | ||
) | ||
test.wait_for_events() | ||
end | ||
end | ||
) | ||
|
||
|
||
test.register_coroutine_test( | ||
"Test cases for Buttons Held", | ||
function() | ||
for var = 0, 3 do | ||
test.socket.zigbee:__queue_receive({ | ||
mock_device.id, | ||
ZoneStatusAttribute:build_test_attr_report(mock_device, 5 + var * 6) | ||
}) | ||
test.socket.capability:__expect_send( | ||
mock_device:generate_test_message(string.format("button%d", var + 1), button_attr.held({ state_change = true })) | ||
) | ||
test.wait_for_events() | ||
end | ||
end | ||
) | ||
|
||
|
||
test.run_registered_tests() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
button_attr
is undefined in the test fileThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, add definition.