Skip to content

Commit

Permalink
Merge branch 'main' into support-inovelli-vtm31sn
Browse files Browse the repository at this point in the history
  • Loading branch information
nickolas-deboom authored Dec 18, 2024
2 parents cce231f + b2fa5b4 commit 3405324
Show file tree
Hide file tree
Showing 32 changed files with 359 additions and 262 deletions.
65 changes: 39 additions & 26 deletions drivers/Aqara/aqara-lock/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ local function device_init(self, device)
LockAlarm.supportedAlarmValues(SUPPORTED_ALARM_VALUES, { visibility = { displayed = false } })
)
end
device:emit_event(capabilities.lock.supportedUnlockDirections({"fromInside", "fromOutside"}, {visibility = {displayed = false}}))
device:emit_event(capabilities.battery.type("AA"))
device:emit_event(capabilities.battery.quantity(8))
end

local function device_added(self, device)
Expand Down Expand Up @@ -107,23 +110,33 @@ local function event_lock_handler(driver, device, evt_name, evt_value)
end
end

local function event_unlock_handler(driver, device, evt_name, evt_value)
local id, label
if evt_name == METHOD.RF447 then
evt_name = nil
id = nil
label = nil
elseif evt_name == METHOD.BLUETOOTH and evt_value == 2 then
evt_name = nil
id = nil
label = nil
elseif evt_value == 0x80020000 then -- one-time password
id = "OTP_STANDALONE"
label = nil
else
id, label = credential_utils.find_userLabel(driver, device, evt_value)
end
device:emit_event(Lock.lock.unlocked({ data = { method = evt_name, codeId = id, codeName = label } }))
local function event_unlock_indoor_handler(driver, device, evt_name, evt_value)
device:emit_event(Lock.lock.unlocked({ data = { method = evt_name, codeId = nil, codeName = nil, unlockDirection = "fromInside" } }))
device:emit_event(remoteControlStatus.remoteControlEnabled('false', { visibility = { displayed = false } }))
device:emit_event(LockAlarm.alarm.clear({ visibility = { displayed = false }}))
end

local function event_unlock_outdoor_handler(driver, device, evt_name, evt_value)
local id, label = credential_utils.find_userLabel(driver, device, evt_value)
device:emit_event(Lock.lock.unlocked({ data = { method = evt_name, codeId = id, codeName = label, unlockDirection = "fromOutside" } }))
device:emit_event(remoteControlStatus.remoteControlEnabled('false', { visibility = { displayed = false } }))
device:emit_event(LockAlarm.alarm.clear({ visibility = { displayed = false }}))
end

local function event_unlock_rf447_handler(driver, device, evt_name, evt_value)
device:emit_event(Lock.lock.unlocked({ data = { method = evt_name, codeId = nil, codeName = nil, unlockDirection = nil } }))
device:emit_event(remoteControlStatus.remoteControlEnabled('false', { visibility = { displayed = false } }))
device:emit_event(LockAlarm.alarm.clear({ visibility = { displayed = false }}))
end

local function event_unlock_remote_handler(driver, device, evt_name, evt_value)
device:emit_event(Lock.lock.unlocked({ data = { method = evt_name, codeId = nil, codeName = nil, unlockDirection = nil } }))
device:emit_event(remoteControlStatus.remoteControlEnabled('false', { visibility = { displayed = false } }))
device:emit_event(LockAlarm.alarm.clear({ visibility = { displayed = false }}))
end

local function event_unlock_otp_handler(driver, device, evt_name, evt_value)
device:emit_event(Lock.lock.unlocked({ data = { method = evt_name, codeId = "OTP_STANDALONE", codeName = nil, unlockDirection = "fromOutside" } }))
device:emit_event(remoteControlStatus.remoteControlEnabled('false', { visibility = { displayed = false } }))
device:emit_event(LockAlarm.alarm.clear({ visibility = { displayed = false }}))
end
Expand Down Expand Up @@ -163,16 +176,16 @@ end

local resource_id = {
["13.31.85"] = { event_name = METHOD.LOCKED, event_handler = event_lock_handler },
["13.48.85"] = { event_name = METHOD.MANUAL, event_handler = event_unlock_indoor_handler },
["13.51.85"] = { event_name = METHOD.MANUAL, event_handler = event_unlock_indoor_handler },
["13.42.85"] = { event_name = METHOD.FINGERPRINT, event_handler = event_unlock_outdoor_handler },
["13.43.85"] = { event_name = METHOD.KEYPAD, event_handler = event_unlock_outdoor_handler },
["13.44.85"] = { event_name = METHOD.RFID, event_handler = event_unlock_outdoor_handler },
["13.151.85"] = { event_name = METHOD.RF447, event_handler = event_unlock_rf447_handler },
["13.45.85"] = { event_name = METHOD.BLUETOOTH, event_handler = event_unlock_remote_handler },
["13.90.85"] = { event_name = METHOD.COMMAND, event_handler = event_unlock_remote_handler },
["13.46.85"] = { event_name = METHOD.KEYPAD, event_handler = event_unlock_otp_handler },
["13.17.85"] = { event_name = METHOD.NO_USE, event_handler = event_door_handler },
["13.48.85"] = { event_name = METHOD.MANUAL, event_handler = event_unlock_handler },
["13.51.85"] = { event_name = METHOD.MANUAL, event_handler = event_unlock_handler },
["13.42.85"] = { event_name = METHOD.FINGERPRINT, event_handler = event_unlock_handler },
["13.43.85"] = { event_name = METHOD.KEYPAD, event_handler = event_unlock_handler },
["13.44.85"] = { event_name = METHOD.RFID, event_handler = event_unlock_handler },
["13.151.85"] = { event_name = METHOD.RF447, event_handler = event_unlock_handler },
["13.45.85"] = { event_name = METHOD.BLUETOOTH, event_handler = event_unlock_handler },
["13.90.85"] = { event_name = METHOD.COMMAND, event_handler = event_unlock_handler },
["13.46.85"] = { event_name = METHOD.KEYPAD, event_handler = event_unlock_handler },
["13.56.85"] = { event_name = METHOD.NO_USE, event_handler = event_battery_handler },
["13.32.85"] = { event_name = METHOD.NO_USE, event_handler = event_abnormal_status_handler },
["13.33.85"] = { event_name = METHOD.NO_USE, event_handler = event_anti_lock_handler },
Expand Down
4 changes: 4 additions & 0 deletions drivers/Aqara/aqara-lock/src/test/test_aqara_lock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ local function test_init()
"highTemperature", "attemptsExceeded" }
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
lockAlarm.supportedAlarmValues(SUPPORTED_ALARM_VALUES, { visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device:generate_test_message("main",
Lock.supportedUnlockDirections({"fromInside", "fromOutside"}, { visibility = { displayed = false } })))
test.socket.capability:__expect_send(mock_device:generate_test_message("main", Battery.type("AA")))
test.socket.capability:__expect_send(mock_device:generate_test_message("main", Battery.quantity(8)))
test.mock_device.add_test_device(mock_device)
end
test.set_test_init_function(test_init)
Expand Down
3 changes: 2 additions & 1 deletion drivers/Aqara/aqara-presence-sensor/src/fp2/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local log = require "log"
local json = require "st.json"
local RestClient = require "lunchbox.rest"
local utils = require "utils"
local st_utils = require "st.utils"

local fp2_api = {}
fp2_api.__index = fp2_api
Expand Down Expand Up @@ -48,7 +49,7 @@ function fp2_api.new_device_manager(device_ip, bridge_info, socket_builder)

return setmetatable(
{
headers = ADDITIONAL_HEADERS,
headers = st_utils.deep_copy(ADDITIONAL_HEADERS),
socket_builder = socket_builder,
base_url = base_url,
}, fp2_api
Expand Down
11 changes: 11 additions & 0 deletions drivers/SmartThings/matter-sensor/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ matterManufacturer:
vendorId: 0x1021
productId: 0x0001
deviceProfileName: motion-contact-battery
# Neo
- id: "4991/1122"
deviceLabel: Door Sensor
vendorId: 0x137F
productId: 0x0462
deviceProfileName: contact-battery
- id: "4991/1123"
deviceLabel: Motion Sensor
vendorId: 0x137F
productId: 0x0463
deviceProfileName: motion-battery
#Tuo
- id: "5150/3"
deviceLabel: "TUO Temperature Sensor"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: aqs-temp-humidity-tvoc-meas
components:
- id: main
capabilities:
- id: airQualityHealthConcern
version: 1
- id: temperatureMeasurement
version: 1
- id: relativeHumidityMeasurement
version: 1
- id: tvocMeasurement
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
version: 1
categories:
- name: AirQualityDetector
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ local supported_profiles =
"aqs-temp-humidity-all-meas",
"aqs-temp-humidity-co2-pm25-tvoc-meas",
"aqs-temp-humidity-tvoc-level-pm25-meas",
"aqs-temp-humidity-tvoc-meas",
}

local AIR_QUALITY_MAP = {
Expand Down
Loading

0 comments on commit 3405324

Please sign in to comment.