1- -- Copyright 2022 SmartThings
2- --
3- -- Licensed under the Apache License, Version 2.0 (the "License");
4- -- you may not use this file except in compliance with the License.
5- -- You may obtain a copy of the License at
6- --
7- -- http://www.apache.org/licenses/LICENSE-2.0
8- --
9- -- Unless required by applicable law or agreed to in writing, software
10- -- distributed under the License is distributed on an "AS IS" BASIS,
11- -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12- -- See the License for the specific language governing permissions and
13- -- limitations under the License.
1+ -- Copyright 2022 SmartThings, Inc.
2+ -- Licensed under the Apache License, Version 2.0
3+
144
155local log = require " log"
166local capabilities = require " st.capabilities"
@@ -22,13 +12,6 @@ local Basic = (require "st.zwave.CommandClass.Basic")({ version=1 })
2212local SwitchMultilevel = (require " st.zwave.CommandClass.SwitchMultilevel" )({ version = 4 })
2313local fan_speed_helper = (require " zwave_fan_helpers" )
2414
25- local FAN_3_SPEED_FINGERPRINTS = {
26- {mfr = 0x001D , prod = 0x1001 , model = 0x0334 }, -- Leviton 3-Speed Fan Controller
27- {mfr = 0x0063 , prod = 0x4944 , model = 0x3034 }, -- GE In-Wall Smart Fan Control
28- {mfr = 0x0063 , prod = 0x4944 , model = 0x3131 }, -- GE In-Wall Smart Fan Control
29- {mfr = 0x0039 , prod = 0x4944 , model = 0x3131 }, -- Honeywell Z-Wave Plus In-Wall Fan Speed Control
30- {mfr = 0x0063 , prod = 0x4944 , model = 0x3337 }, -- GE In-Wall Smart Fan Control
31- }
3215
3316local function map_fan_3_speed_to_switch_level (speed )
3417 if speed == fan_speed_helper .fan_speed .OFF then
6346--- @param driver st.zwave.Driver
6447--- @param device st.zwave.Device
6548--- @return boolean true if the device is an 3-speed fan , else false
66- local function is_fan_3_speed (opts , driver , device , ...)
67- for _ , fingerprint in ipairs (FAN_3_SPEED_FINGERPRINTS ) do
68- if device :id_match (fingerprint .mfr , fingerprint .prod , fingerprint .model ) then
69- return true
70- end
71- end
72- return false
73- end
7449
7550local capability_handlers = {}
7651
@@ -110,7 +85,8 @@ local zwave_fan_3_speed = {
11085 }
11186 },
11287 NAME = " Z-Wave fan 3 speed" ,
113- can_handle = is_fan_3_speed ,
88+ can_handle = require (" zwave-fan-3-speed.can_handle" ),
89+ shared_device_thread_enabled = true ,
11490}
11591
11692return zwave_fan_3_speed
0 commit comments