After configuring your WiFi details and configuring the template, use the console to issue the following commands:
'Backlog TuyaMCU 12,9; TuyaMCU 11,1'
- TuyaMCU 12,9 configures the light switch - TuyaMCU 11,1 configures the fan switch
As the fan switch takes enums, we need rules to handle the fan switch when it's used from the switch (Rule 1), and a rule to set the fan speed and on/off when changed via MQTT (Rule 2)
Next add the following rules:
Rule: Publish speed to MQTT when using the physical switch.
```console Rule1 on TuyaReceived#Data=55AA03070005030400010016 DO Publish stat/%topic%/SPEED 3 endon on TuyaReceived#Data=55AA03070005030400010117 DO Publish stat/%topic%/SPEED 2 endon on TuyaReceived#Data=55AA03070005030400010218 DO Publish stat/%topic%/SPEED 1 endon ``` `Rule1 ON`
Set speed when commands arrive from OpenHAB via MQTT.