(20.12.2024, 11:49)admin Wrote: Custom actions for buttons can be done via a script: https://kb.logicmachine.net/libraries/zi...al-devices
Check ZigBee app monitor on what is sent when a certain button is pressed.
Thank you very much! I should have known this. Bonus question, though:
Is this an ok way to do this?
Code:
if not zb then
zb = require('applibs.zigbee')
zb.addcallback('44e2f8fffe37c87e', function(msg)
if msg.clustername == "Scenes" then
if msg.clusterdata.TradfriArrowHold then
log('Hold')
elseif msg.clusterdata.TradfriArrowRelease and msg.clusterdata.TradfriArrowRelease.Value ~= 0 then
log('Release ' .. msg.clusterdata.TradfriArrowRelease.Value)
elseif msg.clusterdata.TradfriArrowSingle and msg.clusterdata.TradfriArrowSingle.Value == 2 then
log('Scene')
elseif msg.clusterdata.TradfriArrowSingle and msg.clusterdata.TradfriArrowSingle.Value == 257 then
log('Left')
elseif msg.clusterdata.TradfriArrowSingle and msg.clusterdata.TradfriArrowSingle.Value == 256 then
log('Right')
end
elseif msg.clustername == "OnOff" then
if msg.clusterdata.CommandIdentifier == "On" then
log("On")
elseif msg.clusterdata.CommandIdentifier == "Off" then
log("Off")
end
elseif msg.clustername == "LevelControl" and msg.clusterdata.MoveWithOnOff and msg.clusterdata.MoveWithOnOff.MoveMode == "Up" then
log("Up")
elseif msg.clustername == "LevelControl" and msg.clusterdata.Move and msg.clusterdata.Move.MoveMode and msg.clusterdata.Move.MoveMode == "Down" then
log("Down")
elseif msg.clustername == "LevelControl" and msg.clusterdata.CommandIdentifier == "Stop" then
log("Stop")
else
log(msg)
end
end)
end
zb.loop(1)