-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-preferences
- Loading branch information
Showing
332 changed files
with
19,921 additions
and
1,868 deletions.
There are no files selected for viewing
This file contains 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,22 @@ | ||
name: Mirror repo | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- beta | ||
- production | ||
|
||
jobs: | ||
to_ecode: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: pixta-dev/repository-mirroring-action@v1 | ||
with: | ||
target_repo_url: | ||
[email protected]:iot/EdgeDriversMirror.git | ||
ssh_private_key: | ||
${{ secrets.ECODE_SSH_PRIVATE_KEY }} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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,29 @@ | ||
id: stse.cubeAction | ||
version: 1 | ||
status: proposed | ||
name: Cube Action | ||
ephemeral: false | ||
attributes: | ||
cubeAction: | ||
schema: | ||
type: object | ||
properties: | ||
value: | ||
title: ActionType | ||
type: string | ||
enum: | ||
- noAction | ||
- shake | ||
- rotate | ||
- pickUpAndHold | ||
- flipToSide1 | ||
- flipToSide2 | ||
- flipToSide3 | ||
- flipToSide4 | ||
- flipToSide5 | ||
- flipToSide6 | ||
additionalProperties: false | ||
required: | ||
- value | ||
enumCommands: [] | ||
commands: {} |
This file contains 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,25 @@ | ||
id: stse.cubeFace | ||
version: 1 | ||
status: proposed | ||
name: Cube Face | ||
ephemeral: false | ||
attributes: | ||
cubeFace: | ||
schema: | ||
type: object | ||
properties: | ||
value: | ||
title: CubeFace | ||
type: string | ||
enum: | ||
- face1Up | ||
- face2Up | ||
- face3Up | ||
- face4Up | ||
- face5Up | ||
- face6Up | ||
additionalProperties: false | ||
required: | ||
- value | ||
enumCommands: [] | ||
commands: {} |
This file contains 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,6 @@ | ||
name: 'Aqara Cube' | ||
packageKey: 'aqara-cube' | ||
permissions: | ||
zigbee: {} | ||
description: "SmartThings driver for Aqara Cube devices" | ||
vendorSupportInformation: "https://www.aqara.com/en/support/" |
This file contains 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,6 @@ | ||
zigbeeManufacturer: | ||
- id: "Lumi/lumi.remote.cagl02" | ||
deviceLabel: Aqara Cube T1 Pro | ||
manufacturer: LUMI | ||
model: lumi.remote.cagl02 | ||
deviceProfileName: cube-t1-pro |
This file contains 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,19 @@ | ||
name: cube-t1-pro | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: stse.cubeAction | ||
version: 1 | ||
- id: stse.cubeFace | ||
version: 1 | ||
- id: battery | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: RemoteController | ||
metadata: | ||
mnmn: SolutionsEngineering | ||
vid: SmartThings-smartthings-Aqara_CubeT1Pro |
This file contains 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,133 @@ | ||
local ZigbeeDriver = require "st.zigbee" | ||
local capabilities = require "st.capabilities" | ||
local data_types = require "st.zigbee.data_types" | ||
local cluster_base = require "st.zigbee.cluster_base" | ||
local battery_defaults = require "st.zigbee.defaults.battery_defaults" | ||
local clusters = require "st.zigbee.zcl.clusters" | ||
local PowerConfiguration = clusters.PowerConfiguration | ||
|
||
local PRI_CLU = 0xFCC0 | ||
local PRI_ATTR = 0x0009 | ||
local MFG_CODE = 0x115F | ||
|
||
local ROTATE_CLU = 0x000C | ||
local EVENT_CLU = 0x0012 | ||
local FACE_ATTR = 0x0149 | ||
local ACTION_ATTR = 0x0055 | ||
local CUBE_MODE = 0x0148 | ||
|
||
local cubeAction = capabilities["stse.cubeAction"] | ||
local cubeFace = capabilities["stse.cubeFace"] | ||
local cubeFaceVal = { "face1Up", "face2Up", "face3Up", "face4Up", "face5Up", "face6Up" } | ||
local cubeFlipToSideVal = { "flipToSide1", "flipToSide2", "flipToSide3", "flipToSide4", "flipToSide5", "flipToSide6" } | ||
|
||
local CUBEACTION_TIMER = "cubeAction_timer" | ||
local CUBEACTION_TIME = 3 | ||
|
||
local callback_timer = function(device) | ||
return function() | ||
device:emit_event(cubeAction.cubeAction("noAction")) | ||
end | ||
end | ||
|
||
local function reset_thread(device) | ||
local timer = device:get_field(CUBEACTION_TIMER) | ||
if timer then | ||
device.thread:cancel_timer(timer) | ||
device:set_field(CUBEACTION_TIMER, nil) | ||
end | ||
device:set_field(CUBEACTION_TIMER, device.thread:call_with_delay(CUBEACTION_TIME, callback_timer(device))) | ||
end | ||
|
||
local function data_handler(driver, device, value, zb_rx) | ||
local val = value.value | ||
if val == 0x0000 then -- Shake | ||
reset_thread(device) | ||
device:emit_event(cubeAction.cubeAction("shake")) | ||
elseif val == 0x0004 then -- hold | ||
reset_thread(device) | ||
device:emit_event(cubeAction.cubeAction("pickUpAndHold")) | ||
elseif val & 0x0400 == 0x0400 then -- Flip to side | ||
local faceNum = val & 0x0007 | ||
reset_thread(device) | ||
device:emit_event(cubeAction.cubeAction(cubeFlipToSideVal[faceNum + 0x1])) | ||
end | ||
end | ||
|
||
local function rotate_handler(driver, device, value, zb_rx) | ||
-- Rotation | ||
reset_thread(device) | ||
device:emit_event(cubeAction.cubeAction("rotate")) | ||
end | ||
|
||
local function face_handler(driver, device, value, zb_rx) | ||
local faceNum = value.value | ||
device:emit_event(cubeFace.cubeFace(cubeFaceVal[faceNum + 1])) | ||
end | ||
|
||
local function do_refresh(driver, device) | ||
-- refresh | ||
device:send(PowerConfiguration.attributes.BatteryVoltage:read(device)) | ||
end | ||
|
||
local function device_init(driver, device) | ||
local power_configuration = { | ||
cluster = PowerConfiguration.ID, | ||
attribute = PowerConfiguration.attributes.BatteryVoltage.ID, | ||
minimum_interval = 30, | ||
maximum_interval = 3600, | ||
data_type = PowerConfiguration.attributes.BatteryVoltage.base_type, | ||
reportable_change = 1 | ||
} | ||
|
||
battery_defaults.build_linear_voltage_init(2.6, 3.0)(driver, device) | ||
|
||
device:add_configured_attribute(power_configuration) | ||
device:add_monitored_attribute(power_configuration) | ||
end | ||
|
||
local function device_added(self, device) | ||
-- Set private attribute | ||
device:send(cluster_base.write_manufacturer_specific_attribute(device, | ||
PRI_CLU, PRI_ATTR, MFG_CODE, data_types.Uint8, 1)) | ||
|
||
device:send(cluster_base.write_manufacturer_specific_attribute(device, | ||
PRI_CLU, CUBE_MODE, MFG_CODE, data_types.Uint8, 1)) | ||
device:emit_event(cubeAction.cubeAction("noAction")) | ||
device:emit_event(cubeFace.cubeFace("face1Up")) | ||
do_refresh(self, device) | ||
end | ||
|
||
-- [[ register ]] | ||
local aqara_cube_t1_pro_handler = { | ||
NAME = "Aqara Cube T1 Pro", | ||
capability_handlers = { | ||
[capabilities.refresh.ID] = { | ||
[capabilities.refresh.commands.refresh.NAME] = do_refresh | ||
} | ||
}, | ||
zigbee_handlers = { | ||
attr = { | ||
[EVENT_CLU] = { | ||
[ACTION_ATTR] = data_handler | ||
}, | ||
[ROTATE_CLU] = { | ||
[ACTION_ATTR] = rotate_handler, | ||
}, | ||
[PRI_CLU] = { | ||
[FACE_ATTR] = face_handler | ||
}, | ||
[PowerConfiguration.ID] = { | ||
[PowerConfiguration.attributes.BatteryVoltage.ID] = battery_defaults.battery_volt_attr_handler | ||
} | ||
} | ||
}, | ||
lifecycle_handlers = { | ||
init = device_init, | ||
added = device_added | ||
} | ||
} | ||
|
||
local aqara_cube_t1_pro_driver = ZigbeeDriver("aqara_cube_t1_pro", aqara_cube_t1_pro_handler) | ||
aqara_cube_t1_pro_driver:run() | ||
|
Oops, something went wrong.