Single push switch through modbus, need help dimming philips hue

Hi

I have a intustrial IDEC PLC computer at my house. It uses 24V push buttons in every room and relays to turn on/ off all lights.

I’ve just started integrating Philips Hue to the house and… of course I run into some problems.

I’m currently using a modbus read to read inputs (0 or 1) and I’m able to turn on/off lights.
But I’m having a hard time understanding the dimming procedures some people have posted.

What I’m trying to to is, short push = on/off, longer push = dimming up/down depends on last dimming var.

Can anyone help me or point me into the right direction ?