Skip to content

Commit

Permalink
Merge branch 'main' into new-device-zemismart-ZM606-6
Browse files Browse the repository at this point in the history
  • Loading branch information
lelandblue authored May 29, 2024
2 parents 1870473 + d926e86 commit 2ad0738
Show file tree
Hide file tree
Showing 223 changed files with 11,029 additions and 674 deletions.
32 changes: 20 additions & 12 deletions drivers/Aqara/aqara-feeder/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ local PRIVATE_CLUSTER_ID = 0xFCC0
local PRIVATE_ATTR_ID = 0xFFF1
local MFG_CODE = 0x115F

local callback_timer = function(driver, device, cmd)
local function reload_portion(device)
local lastPortion = device:get_latest_state("main", capabilities.feederPortion.ID,
capabilities.feederPortion.feedPortion.NAME) or 0
device:emit_event(capabilities.feederPortion.feedPortion({ value = lastPortion, unit = "servings" }))
end
local callback_feed = function(device)
return function()
device:emit_event(capabilities.feederOperatingState.feederOperatingState("idle"))
end
Expand Down Expand Up @@ -64,10 +69,7 @@ end
-- [[ capability_handlers ]]
local function do_refresh(driver, device)
-- refresh
local lastPortion = device:get_latest_state("main", capabilities.feederPortion.ID,
capabilities.feederPortion.feedPortion.NAME) or 0
device:emit_event(capabilities.feederPortion.feedPortion({ value = lastPortion, unit = "servings" },
{ state_change = true }))
reload_portion(device)
do_payload(device, 8, 0, 2001, OP_REPORT, 1, 0)
device:emit_event(capabilities.feederOperatingState.feederOperatingState("idle"))
end
Expand Down Expand Up @@ -104,23 +106,25 @@ local function petFeeder_handler(driver, device, value, zb_rx)
elseif funcID == "14.92.85" then
-- feed portion
device:emit_event(capabilities.feederPortion.feedPortion({ value = conv_data(param), unit = "servings" }))
elseif funcID == "13.104.85" then
local feed_source = device:get_field(FEED_SOURCE)
elseif funcID == "13.104.85" and conv_data(param) ~= 0 then
local feed_source = device:get_field(FEED_SOURCE) or 0
if feed_source == 0 then
device:emit_event(capabilities.feederOperatingState.feederOperatingState("feeding"))
end
device:set_field(FEED_SOURCE, 0, { persist = true })
delete_timer(device)
device:set_field(FEED_TIMER, device.thread:call_with_delay(FEED_TIME, callback_timer(driver, device)))
device:set_field(FEED_TIMER, device.thread:call_with_delay(FEED_TIME, callback_feed(device)))
elseif funcID == "13.11.85" then
-- error
delete_timer(device)
local evt = "idle"
if conv_data(param) == 1 then evt = "error" end
device:emit_event(capabilities.feederOperatingState.feederOperatingState(evt))
end
end

-- [[ lifecycle_handlers ]]
local function device_added(driver, device)
-- private protocol enable
device:send(cluster_base.write_manufacturer_specific_attribute(device,
PRIVATE_CLUSTER_ID, 0x0009, MFG_CODE, data_types.Uint8, 1))
-- init
do_payload(device, 4, 24, 85, OP_WRITE, 1, 0)
device:emit_event(capabilities.feederOperatingState.feederOperatingState("idle"))
device:emit_event(capabilities.feederPortion.feedPortion({ value = 1, unit = "servings" }))
Expand All @@ -143,6 +147,10 @@ local function device_info_changed(driver, device, event, args)
end

local function device_configure(driver, device)
-- private protocol enable
device:send(cluster_base.write_manufacturer_specific_attribute(device,
PRIVATE_CLUSTER_ID, 0x0009, MFG_CODE, data_types.Uint8, 1))
do_payload(device, 4, 24, 85, OP_WRITE, 1, 0)
end

-- [[ Registration ]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ test.register_coroutine_test(
test.socket.zigbee:__set_channel_ordering("relaxed")
test.socket.capability:__set_channel_ordering("relaxed")
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" })
test.socket.zigbee:__expect_send({ mock_device.id,
cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, 0x0009, MFG_CODE, data_types.Uint8, 1) })
test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device,
PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.OctetString, "\x00\x02\x01\x04\x18\x00\x55\x01\x00") })
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
Expand All @@ -69,7 +67,7 @@ test.register_coroutine_test(
function()
test.socket.capability:__queue_receive({ mock_device.id, { capability = "refresh", component = "main", command = "refresh", args = {} } })
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
capabilities.feederPortion.feedPortion({value=0, unit="servings"}, {state_change=true})))
capabilities.feederPortion.feedPortion({value=0, unit="servings"})))
test.socket.zigbee:__expect_send({ mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device,
PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.OctetString, "\x00\x05\x01\x08\x00\x07\xD1\x01\x00") })
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
Expand Down
133 changes: 133 additions & 0 deletions drivers/Aqara/aqara-lock/capabilities/lockCredentialInfo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
id: stse.lockCredentialInfo
version: 1
status: proposed
name: Lock Credential Info
ephemeral: false
attributes:
credentialInfo:
schema:
type: object
properties:
value:
type: array
items:
title: Credential info
type: object
additionalProperties: false
properties:
credentialId:
type: integer
minimum: 0
credentialType:
type: string
enum:
- keypad
- rfid
- fingerprint
userId:
type: string
maxLength: 255
userLabel:
type: string
maxLength: 255
userType:
type: string
enum:
- unknown
- administrator
- regularUser
- frequentVisitors
- host
required:
- credentialId
- credentialType
- userId
- userLabel
- userType
additionalProperties: false
required:
- value
enumCommands: []
commands:
syncAll:
name: syncAll
arguments:
- name: credentialInfo
optional: false
schema:
title: Credential info
type: array
items:
properties:
credentialId:
type: integer
minimum: 0
credentialType:
type: string
enum:
- keypad
- rfid
- fingerprint
userId:
type: string
maxLength: 255
userLabel:
type: string
maxLength: 255
userType:
type: string
enum:
- unknown
- administrator
- regularUser
- frequentVisitors
- host
upsert:
name: upsert
arguments:
- name: credentialInfo
optional: false
schema:
title: Credential info
type: array
items:
properties:
credentialId:
type: integer
minimum: 0
credentialType:
type: string
enum:
- keypad
- rfid
- fingerprint
userId:
type: string
maxLength: 255
userLabel:
type: string
maxLength: 255
userType:
type: string
enum:
- unknown
- administrator
- regularUser
- frequentVisitors
- host
deleteUser:
name: deleteUser
arguments:
- name: userId
optional: false
schema:
type: integer
minimum: 0
deleteCredential:
name: deleteCredential
arguments:
- name: credentialId
optional: false
schema:
type: integer
minimum: 0
7 changes: 7 additions & 0 deletions drivers/Aqara/aqara-lock/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: 'Aqara Lock'
packageKey: 'aqara-lock'
permissions:
aqara_provisioning: {}
zigbee: {}
description: "SmartThings driver for Aqara Doorlock"
vendorSupportInformation: "https://www.aqara.com/en/support/"
6 changes: 6 additions & 0 deletions drivers/Aqara/aqara-lock/fingerprints.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
zigbeeManufacturer:
- id: "LUMI/aqara.lock.akr011"
deviceLabel: "Aqara Doorlock K100"
manufacturer: Lumi
model: aqara.lock.akr011
deviceProfileName: aqara-lock-battery
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dashboard": {
"states": [],
"actions": [],
"basicPlus": []
},
"id": "stse.lockCredentialInfo",
"version": 1
}

21 changes: 21 additions & 0 deletions drivers/Aqara/aqara-lock/profiles/aqara-lock-battery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: aqara-lock-battery
components:
- id: main
capabilities:
- id: lock
version: 1
- id: battery
version: 1
- id: tamperAlert
version: 1
- id: remoteControlStatus
version: 1
- id: firmwareUpdate
version: 1
- id: stse.lockCredentialInfo
version: 1
categories:
- name: SmartLock
metadata:
mnmn: "SolutionsEngineering"
vid: "SmartThings-smartthings-Aqara_K100"
Loading

0 comments on commit 2ad0738

Please sign in to comment.