Ho @nayelyz
This is the log with my driver, but is the same with stock driver. Switch Binary report received with src_channel=1 for S1 on-off commands from real device.
S2 is only used for send scenes and must be src_channel=2.
The handler for Central scene notification won’t work either since scenes send with src_channel 1 and 2, for S1 and S2.
It wouldn’t work with button.defaults either since the profile only has a button capability in the main component. It would need 2 button capabilities in two additional components and modify the code
instead of the defaults.
This stock driver handler does not work
local function central_scene_notification_handler(self, device, cmd)
if cmd.src_channel == nil or cmd.src_channel == 0 then
ButtonDefaults.zwave_handlers[cc.CENTRAL_SCENE][CentralScene.NOTIFICATION](self, device, cmd)
end
end
I have it made for the fibaro double switch, which would work the same for the scenes S1 and S2, adding to profile the button1 and button2 components and delete button capability in main component
local function central_scene_notification_handler(self, device, cmd)
local map_key_attribute_to_capability = {
[CentralScene.key_attributes.KEY_PRESSED_1_TIME] = capabilities.button.button.pushed,
[CentralScene.key_attributes.KEY_RELEASED] = capabilities.button.button.held,
[CentralScene.key_attributes.KEY_HELD_DOWN] = capabilities.button.button.down_hold,
[CentralScene.key_attributes.KEY_PRESSED_2_TIMES] = capabilities.button.button.double,
[CentralScene.key_attributes.KEY_PRESSED_3_TIMES] = capabilities.button.button.pushed_3x
}
local event = map_key_attribute_to_capability[cmd.args.key_attributes]
local button_number = cmd.args.scene_number
local component = device.profile.components["button" .. button_number]
if component ~= nil then
device:emit_component_event(component, event({state_change = true}))
end
end
Activating scenes
The Switch 2 can activate scenes in the Z-Wave controller by sending scene ID and attribute of a specific action using Central Scene Command Class.
By default scenes are not activated, set parameters 28 and 29 to enable scene activation for selected actions.
Switch | Action | Scene ID | Attribute |
---|---|---|---|
Switch connected to S1 terminal | |||
Switch clicked once | 1 | Key Pressed 1 time | |
Switch clicked twice | 1 | Key Pressed 2 times | |
Switch clicked thrice | 1 | Key Pressed 3 times | |
Switch held | 1 | Key Held Down | |
Switch released | 1 | Key Released | |
Switch connected to S2 terminal | |||
Switch clicked once | 2 | Key Pressed 1 time | |
Switch clicked twice | 2 | Key Pressed 2 times | |
Switch clicked thrice | 2 | Key Pressed 3 times | |
Switch held | 2 | Key Held Down | |
Switch released | 2 | Key Released |