I’ve expanded this for RF fans too:
Step 0: Requisites
- A Tuya RF remote with the Fan already learnt
- Scenes for the Fan On (if remote has it, mine don’t), Off, and Fan Speeds
- Official Tuya Cloud integration set up and working - sorry, no local control for this…
- SmartIR integration - this allows to have the AC / Climate in HA with all the right modes for your AC. Generic Thermostat is not enough.
- Automation - covered below
Step 0: Requisites
Make sure you have the requirements 1-3 above installed and set up.
You might need some time if you didn’t already have it. In my case, I already had all from before…
Step 1: Smart IR
- Follow the instructions in the SmartIR Fan section to set it up
You should end up with something like this in your condiguration.yaml:
smartir:
fan:
- platform: smartir
name: Ventilador Comedor
unique_id: ventilador_comedor
device_code: 1081
controller_data: home-assistant/fan-comedor/command
- platform: smartir
name: Ventilador Habitacion
unique_id: ventilador_habitacion
device_code: 1020
controller_data: home-assistant/fan-habitacion/command
Note: I have 2 in the example
Important: device_code depends on your AC, and it’s relevant because it defines the modes, temperatures, etc for your AC. Spend some time in the SmartIR Fan devices to find your model or the one that is similar to yours (open the files, compare speeds & on/off modes, oscillation).
controller_data is just fake. Just use what I have (adapt the fan-xxx name).
- Restart HA so that these fan entities appear in HA.
- You will now have new climate entities in HA.
Step 2: The automation that translates HA Fan front-end to Tuya Scenes
We need to make the HA fan trigger the Tuya RF Scenes for the fan.
So, this is my automation:
alias: Ventilador Comedor (Tuya Scenes)
description: ""
trigger:
- platform: state
entity_id:
- fan.ventilador_comedor
id: "off"
from: null
to: "off"
alias: On/Off
- platform: state
entity_id:
- fan.ventilador_comedor
id: "on"
from: null
to: "on"
alias: On/Off
- platform: state
entity_id:
- fan.ventilador_comedor
id: speed
attribute: last_on_speed
for:
hours: 0
minutes: 0
seconds: 0
alias: When Speed changes
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- "off"
sequence:
- service: scene.turn_on
data: {}
target:
entity_id: scene.ventilador_comedor_off
- conditions:
- condition: trigger
id:
- speed
- "on"
sequence:
- service: scene.turn_on
data: {}
target:
entity_id: >
scene.ventilador_comedor_{{
state_attr('fan.ventilador_comedor','last_on_speed') }}
mode: single
Please review it and adjust it to your scenes and fan, looking at its attributes. For example, the one I used has last_on_speed only so I use that to call the right scene (which are called scene.ventilador_comedor_1, scene.ventilador_comedor_2, … scene.ventilador_comedor_6 matching the 6 speeds from the SmartIF Fan files I grabbed, 1081 and 1020, for each of my fans (one 6 speeds plus winter/summer modes, one only 3 speeds).
OPTIONAL - Step 4: Have the full Fan control back in Google Home / Google Assistant
If you want to have the fan control in the GA/GH app, you can expose the HA fan to Google, to have what we should get from Tuya directly in GA and HA…
If you weren’t already exposing the fan entities in your google-assistant entry in configuration.yaml, do it. Mine looks like this (you should already have most of this from requisite 4!), but read the documentation to adjust it to your needs (like expose_by_default: true instead of exposed_domains, etc.)
google_assistant:
project_id: home-assistant
service_account: !include SERVICE_ACCOUNT.JSON
report_state: true
exposed_domains:
- light
- input_boolean
- climate
- fan
In the GH app, I only get On/Off, but I can voice control either via % or low, mid, mid high, high, etc. In a GH display I do get the speed 
Don’t forget to restart HA and then ask google to “sync my devices!”
That should be it! Hopefully I haven’t forgotten anything, so let me know if you have issues or questions and I’ll review.



