I ended up changing to Adam’s code and it works good!
https://community.smartthings.com/t/release-osram-lightify-smart-dimming-switch-ultra-fast-zigbee-handler-no-smart-app/54909