Help Creating a rule in rule machine

Hi, i'm trying to create a rule to control my fan from a novelli blue switch, but not sure how to go about it in rule machine. Any help or input would be appreciated. This is a copy from invelli below.

Create a Rule in Rule Machine
Trigger:
• Button 7 pushed on your VZM31‑SN
Actions (in order):
IF (FanCycleState = "off") THEN
Set FanCycleState to "on"
Set VZM36 Fan to On
ELSE-IF (FanCycleState = "on") THEN
Set FanCycleState to "low"
Set VZM36 Fan Speed to Low
ELSE-IF (FanCycleState = "low") THEN
Set FanCycleState to "medium"
Set VZM36 Fan Speed to Medium
ELSE-IF (FanCycleState = "medium") THEN
Set FanCycleState to "high"
Set VZM36 Fan Speed to High
ELSE-IF (FanCycleState = "high") THEN
Set FanCycleState to "off"
Turn Off VZM36 Fan
END-IF

Looks like you have logic, these should get you over the hump.

How to Use Rule Machine Part 1: The Basics
How to Use Rule Machine 2: Simple Conditional Rules
How to Use Rule Machine Part 3: Advanced Conditional Rules

Thank you I'll check it out.

Does the "Cycle Speed" command not do what you want? From the rule it looks like you're trying to write, that's what this command alone is supposed to do (if you're using their driver, I can't speak to how it was implemented, but this is typical behavior).

I would use a state variable incremented to a max each time you press the button. Using that variable after incrementing or resetting, set the fan speed based on the current value. Much cleaner code imho.