Skip to content

Commit 5a0c5ab

Browse files
committed
ZLL: use native / default handlers
1 parent 32685fb commit 5a0c5ab

File tree

1 file changed

+0
-46
lines changed
  • drivers/SmartThings/zigbee-switch/src/zll-dimmer-bulb

1 file changed

+0
-46
lines changed

drivers/SmartThings/zigbee-switch/src/zll-dimmer-bulb/init.lua

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -152,58 +152,12 @@ local function device_added(driver, device)
152152
device:refresh()
153153
end
154154

155-
local function handle_switch_on(driver, device, cmd)
156-
device:send(OnOff.commands.On(device))
157-
158-
device.thread:call_with_delay(2, function(d)
159-
device:refresh()
160-
end)
161-
end
162-
163-
local function handle_switch_off(driver, device, cmd)
164-
device:send(OnOff.commands.Off(device))
165-
166-
device.thread:call_with_delay(2, function(d)
167-
device:refresh()
168-
end)
169-
end
170-
171-
local function handle_set_level(driver, device, cmd)
172-
local level = math.floor(cmd.args.level / 100.0 * 254)
173-
device:send(Level.commands.MoveToLevelWithOnOff(device, level, cmd.args.rate or 0xFFFF))
174-
175-
device.thread:call_with_delay(2, function(d)
176-
device:refresh()
177-
end)
178-
end
179-
180-
local function handle_set_color_temperature(driver, device, cmd)
181-
colorTemperature_defaults.set_color_temperature(driver, device, cmd)
182-
183-
local function query_device()
184-
device:refresh()
185-
end
186-
device.thread:call_with_delay(2, query_device)
187-
end
188-
189155
local zll_dimmer_bulb = {
190156
NAME = "ZLL Dimmer Bulb",
191157
lifecycle_handlers = {
192158
doConfigure = do_configure,
193159
added = device_added
194160
},
195-
capability_handlers = {
196-
[capabilities.switch.ID] = {
197-
[capabilities.switch.commands.on.NAME] = handle_switch_on,
198-
[capabilities.switch.commands.off.NAME] = handle_switch_off
199-
},
200-
[capabilities.switchLevel.ID] = {
201-
[capabilities.switchLevel.commands.setLevel.NAME] = handle_set_level
202-
},
203-
[capabilities.colorTemperature.ID] = {
204-
[capabilities.colorTemperature.commands.setColorTemperature.NAME] = handle_set_color_temperature
205-
}
206-
},
207161
sub_drivers = {
208162
require("zll-dimmer-bulb/ikea-xy-color-bulb")
209163
},

0 commit comments

Comments
 (0)