iSwitch Light and Fan Switch
Model reference: MGWF04W
iSwitch Light and

Available from:


Flashed with:

GPIO #Component
GPIO00 None
GPIO01 Tuya Tx
GPIO02 None
GPIO03 Tuya Rx
GPIO04 None
GPIO05 None
GPIO09 None
GPIO10 None
GPIO12 None
GPIO13 None
GPIO14 None
GPIO15 None
GPIO16 None
{"NAME":"iSwitchOZ Light Fan","GPIO":[0,107,0,108,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54}
Tuya-Convert might not be possible for this device if the manufacturer started using newest Tuya firmware since this template was published (2020-07-10).

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.

	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.

0 = Off, 1 = Slow, 2 = Medium, 3 = Fast, 4 = On (last speed)

	on Event#0 DO Power1 0 endon  
	on Event#1 DO Backlog Power1 1; TuyaSend4 3,2 endon 
	on Event#2 DO Backlog Power1 1; TuyaSend4 3,1 endon 
	on Event#3 DO Backlog Power1 1; TuyaSend4 3,0 endon
	on Event#4 DO Power1 1 endon

Rule2 ON