Tuya MCU Fan - Using Lambda

I have a Tuya MCU fan that I transplanted an ESP8266 into. I was able to get everything working fairly easily with the exception of the fan speed.

I’m not sure if the fan speed is datapoint 2 or 3 at the moment; I suspect 3 because when I use 2 it changes the “mode of the fan” between natural, sleep and normal, but does not change the speed. When using datapoint 3 I get nothing.

After doing some research I believe this is because the fan is expecting an integer and by default HA is throwing it a percentage. I was looking into using Lambdas as this seems to be the way to go to send integers but I’m just lost at where to begin. I’m hoping someone can point me in the right direction based on my code here. Thanks!

  platform: ESP8266
  board: esp01_1m
  name: arlec-tower-fan-1

  ssid: ""
  password: ""

  # Enable fallback hotspot (captive portal) in case wifi connection fails
    ssid: "Arlec Tower Fan Hotspot"
    password: ""



  port: 80

  # Disable UART logging as these pins are used for Tuya MCU comms
  baud_rate: 0

  rx_pin: GPIO03
  tx_pin: GPIO01
  baud_rate: 9600


  - platform: "tuya"
    name: Living Rm Fan
    switch_datapoint: 1
    speed_datapoint: 2
    oscillation_datapoint: 5
    speed_count: 4
  - platform: "tuya"
    sensor_datapoint: 21
    name: "Living Rm Temperature"
  - platform: "tuya"
    sensor_datapoint: 23
    name: "Time to off"

Have you already checked the state of that entity in Developer Tools?
The expected value is an enum, probably the values are 0, 1, 2, 3

Admittedly I have not but will do so tomorrow to confirm. Even when using an enum a lambda expression would be required right?