Skip to content

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 14 commits into from
Apr 24, 2025
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
12 changes: 12 additions & 0 deletions drivers/SmartThings/zigbee-button/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,18 @@ zigbeeManufacturer:
manufacturer: Samsung Electronics
model: SAMSUNG-ITM-Z-005
deviceProfileName: SLED-three-buttons
- id: "Linxura Smart Controller"
deviceLabel: Linxura Smart Controller
manufacturer: Linxura
model: Smart Controller
deviceProfileName: four-buttons-without-main-button
isJoinable: true
- id: "Aura Smart button"
deviceLabel: Aura Smart Button
manufacturer: Linxura
model: Aura Smart Button
deviceProfileName: four-buttons-without-main-button
isJoinable: true
# Wall Hero
- id: "WALL HERO/ACL-401SCA4"
deviceLabel: WallHero Remote Control (4-Inch)
Expand Down
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
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 }))
Copy link
Contributor

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 file

Copy link
Contributor Author

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 file

Ok, add definition.

)
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()
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()
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ local ZIGBEE_MULTI_BUTTON_FINGERPRINTS = {
{ mfr = "ROBB smarrt", model = "ROB_200-008-0" },
{ mfr = "WALL HERO", model = "ACL-401SCA4" },
{ mfr = "Samsung Electronics", model = "SAMSUNG-ITM-Z-005" },
{ mfr = "Vimar", model = "RemoteControl_v1.0" }
{ mfr = "Vimar", model = "RemoteControl_v1.0" },
{ mfr = "Linxura", model = "Smart Controller" },
{ mfr = "Linxura", model = "Aura Smart Button" }
}

local function can_handle_zigbee_multi_button(opts, driver, device, ...)
Expand Down Expand Up @@ -90,7 +92,8 @@ local zigbee_multi_button = {
require("zigbee-multi-button.robb"),
require("zigbee-multi-button.wallhero"),
require("zigbee-multi-button.SLED"),
require("zigbee-multi-button.vimar")
require("zigbee-multi-button.vimar"),
require("zigbee-multi-button.linxura")
}
}

Expand Down
Loading
Loading