IoT based Washing Machine Control Algorithm
Are you looking for IoT based Washing Machine Control Algorithm to send and receive a command from the server? Here is the algorithm that helps you to write your own logic.

Declaration: Washing Machine connected with Raspberry Pi for all the IoT based command. You can also implement some other device like Arduino. This tutorial does not include the IoT based Command.
PushCommand: Send data to the Server through Raspberry Pi
PullCommand: Receive data from the Server through Raspberry Pi
Step1: IoT based command to washing machine to start Step2: If Machine Started Step2.1 If (Drum Loaded with Cloth ) Then PushCommand ← Update drum weight and height (Server Process the data: If (Drum Weight > capacity) Generate Notification and return fail error Display Error Message ← PullCommand ) Ack ← PullCommand If ( Ack == Success ) Then Fill drum with water according to drum weight and height PushCommand ← Notify about the water level Step 2.2 Ack ← PullCommand If Ack == Success Then If (is Detergent available) Then PushCommand ← Notify With Success Ack ← PullCommand //Washing Cycle If Ack == Success Then Door.Lock= true PushCommand ← Notify Ack ← PullCommand Motor.State = MotorState.Start Timer.Interval=1000 // 1 Sec. Timer.start() While(Timer.Counter >= MaxWashingTime) Washing.cycle= Running Timer.Counter ++ PushCommand ← Notify Cycle Ack ← PullCommand End While If (Timer.Counter >= MaxWashingTime) Then PushCommand ← Notify Ack ← PullCommand Timer.stop() Motor.State = MotorState.Stop DrainValve.Open() While(wait) Wait ← Water out End While DrainValve.Close() End If End If End If Repeat Step2.1 to Step 2.2 PushCommand ← Notify Ack ← PullCommand Motor.State = MotorState.Start Timer.start() While(Timer.Counter >= MaxWashingTime) Washing.cycle= Running Timer.Counter ++ PushCommand ← Notify Cycle Ack ← PullCommand End While If (Timer.Counter >= MaxWashingTime) Then PushCommand ← Notify Ack ← PullCommand Timer.stop() Motor.State = MotorState.Stop DrainValve.Open() While(wait) Wait ← Water out End While DrainValve.Close() End If //Drying Cycle PushCommand ← Notify Drying Cycle Ack ← PullCommand Motor.State = MotorState.Start Timer.start() While(Timer.Counter >= MaxDryingTime) Washing.cycle= Running Timer.Counter ++ PushCommand ← Notify Cycle Ack ← PullCommand End While If (Timer.Counter >= MaxDryingTime) Then PushCommand ← Notify Ack ← PullCommand Timer.stop() Motor.State = MotorState.Stop DrainValve.Open() While(wait) Wait ← Water out End While DrainValve.Close() End If Display.Message ← “Wash Completed” Buzzer.Ring = true PushCommand ← Notify Ack ← PullCommand End If Else PushCommand ← Notify With Error End Else End If Else While (1 Min interval) Check the drum status If (Drum Loaded with Cloth ) Continue with Step 2.1 End If Else Display ← “Waiting for loading drum with cloth” End Else End While End Else