@@ -16,6 +16,7 @@ local capabilities = require "st.capabilities"
16
16
local clusters = require " st.matter.clusters"
17
17
local device_lib = require " st.device"
18
18
local im = require " st.matter.interaction_model"
19
+ local log = require " log"
19
20
20
21
local COMPONENT_TO_ENDPOINT_MAP = " __component_to_endpoint_map"
21
22
local INITIAL_PRESS_ONLY = " __initial_press_only"
@@ -24,13 +25,13 @@ local INITIAL_PRESS_ONLY = "__initial_press_only"
24
25
-- Third Reality MK1 specifics
25
26
---- ---------------------------------------------------------------------------------
26
27
27
- local THIRD_REALITY_MANUFACTURER_ID = 0x1407
28
- local THIRD_REALITY_MK1_PRODUCT_ID = 0x1388
28
+ local THIRD_REALITY_MK1_FINGERPRINT = { vendor_id = 0x1407 , product_id = 0x1388 }
29
29
30
30
local function is_third_reality_mk1 (opts , driver , device )
31
31
if device .network_type == device_lib .NETWORK_TYPE_MATTER and
32
- device .manufacturer_info .vendor_id == THIRD_REALITY_MANUFACTURER_ID and
33
- device .manufacturer_info .product_id == THIRD_REALITY_MK1_PRODUCT_ID then
32
+ device .manufacturer_info .vendor_id == THIRD_REALITY_MK1_FINGERPRINT .vendor_id and
33
+ device .manufacturer_info .product_id == THIRD_REALITY_MK1_FINGERPRINT .product_id then
34
+ log .info (" Using Third Reality MK1 sub driver" )
34
35
return true
35
36
end
36
37
return false
86
87
87
88
local function device_init (driver , device )
88
89
device :set_endpoint_to_component_fn (endpoint_to_component )
89
- subscribe (device )
90
+ device :extend_device (" subscribe" , subscribe )
91
+ device :subscribe ()
90
92
end
91
93
92
94
local function device_added (driver , device )
96
98
local function info_changed (driver , device , event , args )
97
99
if device .profile .id ~= args .old_st_store .profile .id then
98
100
configure_buttons (device )
99
- subscribe (device )
101
+ device : subscribe ()
100
102
end
101
103
end
102
104
0 commit comments