Trying to mimic lutron aurora behavior in nodered

hello, im starting to switch all my hue stuff over to zigbee2mqtt and im trying to write a function that mimics the way the lutron aurora buttons work on the hue bridge. clicking toggles and turning turns on and changes brightness. the problem im having is the turn and click events dont have different action types so im trying to figure out ways to differ the two through other means. here’s where im at. the input is a mqtt event:

if(!msg.payload.action) return;

const entityId = 'light.kitchen_sink';

const hass = global.get('homeassistant');
const states = hass.homeAssistant.states;
const lightEntity = states[entityId];

const actionLevel = msg.payload.action_level
const lightIsOn = lightEntity.state === 'on';
const isPush = msg.payload.action_transition_time === 0.02;
const hasGroup = !!msg.payload.action_group;

let service = 'turn_off';
let data = null;

if(isPush || (!isPush && hasGroup)) {
    service = 'toggle'; 

    if(!lightIsOn) {
        data = {
            brightness: 255
        }
    }
} else {
    service = 'turn_on';
    data = {
        brightness: actionLevel
    }
} 

// hue default for light transitions
if(data) data.transition = 2;

return {
    msg,
    lightEntity,
    payload: {
        service,
        target: {
            entity_id: [entityId],
        },
        data
    }
}

i was seeing the transition time being different between clicking and turning but that doesnt seem to be consistent. Does anyone have a better way to get these to act just like they do on the hue bridge?