Configuration for Broadlink remote controlling "Dumb" Fan to HomeKit

Hi Experts,

I am new to the HA environment, and have recently tried to integrate most of my smart devices from HA to HK.

I am however, facing an issue of controlling my “dumb” fan using HK after the learn_command steps.

I would like to control the light settings on my “dumb” fan, however, the light settings go in a loop as such:
White → Cool → Warm → Night → Off → White…
The scripts which I have prepared is able to change the states from the Off state (basically repeating the script multiple times to set the state).
The issue now is that I am unable to switch the light states from one to another, e.g., White to Night in a single script, as I am not able to retrieve the current state of the light.

Would like to seek your expertise on how I can do such configurations.

Thank you.

-BUMP-

Is there anyone out here who is able to advise what I can use to set the state while the script is switched off?

I have been exploring the use of variables but I am not sure how to write them.

Any advise would be appreciated. Thank you.