Have you heard of Node Red ?

 

Node Red, a visual way to program your Pi and is a language specifically written for the “Internet Of Things”

Node Red comes preinstalled on Raspbian, just click / Programming / Node-RED

Then just open a browser  and visit http://<your Pi’s IP>/1880 to open the editor

Once you have it up and running grab this Sample flow and start testing out the features of the Pi Power Board

Here is a quick video showing you how its done

 

 

These are some screen shots of what the code will look like once you get it in to Node Red