-
Notifications
You must be signed in to change notification settings - Fork 508
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
Conversation
Linxura Zigbee mode include 4 buttons, each button support press, double press, held.
add configuration part for Linxura smart controller driver
Does anything I need to do, before anyone can review this request? |
Remove main button info in device panel. So user could only see four buttons information.
Remove firmwareUpdate on profile.
Add Aura smart button device.
@@ -0,0 +1,129 @@ | |||
-- Copyright 2022 SmartThings |
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.
date should be 2024, I think?
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.
We use 2-space tabs in our drivers. You've got a mix here of 2- and 4-spaces.
local IASZone = (require "st.zigbee.zcl.clusters").IASZone | ||
local constants = require "st.zigbee.constants" | ||
local clusters = require "st.zigbee.zcl.clusters" | ||
local Groups = clusters.Groups |
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.
unused
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.
local capabilities = require "st.capabilities"
local IASZone = (require "st.zigbee.zcl.clusters").IASZone
local log = require "log"
Remain these three lines.
|
||
local capabilities = require "st.capabilities" | ||
local IASZone = (require "st.zigbee.zcl.clusters").IASZone | ||
local constants = require "st.zigbee.constants" |
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.
unused
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.
local capabilities = require "st.capabilities"
local IASZone = (require "st.zigbee.zcl.clusters").IASZone
local log = require "log"
Remain these three lines.
local device_management = require "st.zigbee.device_management" | ||
local zcl_commands = require "st.zigbee.zcl.global_commands" | ||
local zcl_clusters = require "st.zigbee.zcl.clusters" |
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.
unused
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.
The same as comment above.
|
||
if status.value == BUTTON1_HELD or status.value == BUTTON1_PUSHED or status.value == BUTTON1_DOUBLE then | ||
device:emit_component_event(device.profile.components[BUTTON1], event) | ||
device:emit_event(event) |
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.
this will log an error every time since main
has no button
capability
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.
Removed.
device:emit_event(event)
return false | ||
end | ||
|
||
if status.value == BUTTON1_HELD or status.value == BUTTON1_PUSHED or status.value == BUTTON1_DOUBLE then |
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.
I'd just use the //
(integer division) operator to determine the button, e.g.:
if (event) then
button = string.format("button%d", status.value // 6 + 1)
device:emit_component_event(device.profile.components[button], event)
end
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.
Thank you, modified.
elseif mod == 5 then | ||
event = capabilities.button.button.held(additional_fields) | ||
else | ||
return false |
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.
I think you just want a void return
here. Not sure how the runner would interpret a false
value being returned.
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.
Modified.
local mod = status.value % 6
if mod == 1 then
event = capabilities.button.button.pushed(additional_fields)
elseif mod == 3 then
event = capabilities.button.button.double(additional_fields)
elseif mod == 5 then
event = capabilities.button.button.held(additional_fields)
end
Thank you for your suggestion, all modification has been uploaded. |
@xiaodah123 @simon3panda perhaps you forgot to push to your branch? You will also need to re-base your branch to resolve the conflicts. |
Thank you! |
Duplicate profile check: Passed - no duplicate profiles detected. |
Channel deleted. |
local BUTTON1_HELD = 0x0001 | ||
local BUTTON1_PUSHED = 0x0003 | ||
local BUTTON1_DOUBLE = 0x0005 | ||
local BUTTON2_HELD = 0x0007 | ||
local BUTTON2_PUSHED = 0x0009 | ||
local BUTTON2_DOUBLE = 0x000B | ||
local BUTTON3_HELD = 0x000D | ||
local BUTTON3_PUSHED = 0x000F | ||
local BUTTON3_DOUBLE = 0x0011 | ||
local BUTTON4_HELD = 0x00013 | ||
local BUTTON4_PUSHED = 0x00015 | ||
local BUTTON4_DOUBLE = 0x0017 | ||
|
||
local BUTTON1 = "button1" | ||
local BUTTON2 = "button2" | ||
local BUTTON3 = "button3" | ||
local BUTTON4 = "button4" |
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.
these can all be removed now I think
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.
Thanks, removed.
Test Results 65 files 421 suites 0s ⏱️ Results for commit e5ba868. ♻️ This comment has been updated with latest results. |
Minimum allowed coverage is Generated by 🐒 cobertura-action against e5ba868 |
It would be good if you added some tests of your device's specific behavior. A good template would be this test file, which also bases its behavior off the value of the IAS Zone attribute: https://github.com/SmartThingsCommunity/SmartThingsEdgeDrivers/blob/main/drivers/SmartThings/zigbee-motion-sensor/src/test/test_gator_motion.lua |
Tests added and uploaded. By the way is there any way for me to run the tests? |
@simon3panda Yep. Assuming you've set up you dev environment following the instructions here: https://developer.smartthings.com/docs/devices/hub-connected/set-up-dev-env Once you've done that, you can navigate in your terminal to the |
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 })) |
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 file
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 file
Ok, add definition.
Thank you. Tests ran. Tests result are in the attaches. |
Linxura Zigbee mode include 4 buttons, each button support press, double press, held.
Check all that apply
Type of Change
Checklist
Description of Change
New sub-driver for zigbee button, which support four buttons, each support press, double press, held.
Summary of Completed Tests