Fan Component - on_speed_set Trigger

I’m running a Tuya based fan switch with a 4 speed fan. I’m trying to have the fan turn on using the on speed set Trigger. The issue I’m having is that I can’t turn off the fan, because when it turns off, it sends an updated speed command which triggers the on_speed_set trigger again. I’ve tried including a on_turn_off trigger as well, but the last state sent in the logs is the speed. The only option I got to work would eliminate the lowest speed of the fan.

[10:34:50][D][tuya:304]: Datapoint 1 update to OFF
[10:34:50][D][fan:092]: 'MJ FC01 Fan Speed' - Sending state:
[10:34:50][D][fan:093]:   State: OFF
[10:34:50][D][fan:095]:   Speed: 1
[10:34:50][D][fan:021]: 'MJ FC01 Fan Speed' - Setting:
[10:34:50][D][fan:024]:   State: OFF
[10:34:50][D][tuya:593]: Setting datapoint 1 to 0
[10:34:50][D][fan:021]: 'MJ FC01 Fan Speed' - Setting:
[10:34:50][D][fan:024]:   State: ON
[10:34:50][D][fan:030]:   Speed: 1
[10:34:50][D][tuya:593]: Setting datapoint 1 to 1
[10:34:50][D][tuya:593]: Setting datapoint 3 to 0
[10:34:50][D][tuya:304]: Datapoint 1 update to ON
[10:34:50][D][fan:092]: 'MJ FC01 Fan Speed' - Sending state:
[10:34:50][D][fan:093]:   State: ON
[10:34:50][D][fan:095]:   Speed: 1
[10:34:50][D][fan:021]: 'MJ FC01 Fan Speed' - Setting:
[10:34:50][D][fan:024]:   State: ON
[10:34:50][D][fan:030]:   Speed: 1
[10:34:50][D][tuya:593]: Setting datapoint 1 to 1
[10:34:50][D][tuya:593]: Setting datapoint 3 to 0
fan:
  - platform: "tuya"
    name: MJ FC01 Fan Speed
    switch_datapoint: 1
    speed_datapoint: 3
    speed_count: 4
    id: officefan1    
    on_turn_off:
      - fan.turn_off: 
          id: officefan1
    on_speed_set:
      then:
        - if:
            condition:
              lambda: |-
                return id(officefan1).state = "OFF";
            then:
              - fan.turn_on:
                  id: officefan1
                  speed: 1