Want to control a wifi smart socket outlet with my windows 7 pc

Hello Folks,

I would like to turn on/off this socket located in another room to control electrical appliances e.g. lamps. I have an extra PC which I would like to act as the control unit of the system. I might add sensors that send data to the PC and then based on values, the PC controls these sockets. What else do I need and how can I automate actions based on events.