WPLight, a deeper look inside the project

Some more informations about the WPLight system

December 13, 2016

After a week of my WPLight crowdfunding campaign I need to better describe how developers will be able to talk with my Internet of Things lamp.

When I was uploading the project I thought that I need to talk mainly to bloggers, e-commerce owners and non-tech site owners. But most of the discussions I have had last week on WordPress groups was with technology people.

So, here is a deeper view of my WPLight. :)

You don’t know what is WPLight? It’s an IoT device for site owners, it’s a wonderful designed wifi lamp that blinks when something happens in your site. It’s ready to use for WordPress but comes with API for developers to talk with every CMS and every language.

Go and get one! :)

How does the WPLight work

When you configure the WPLoght it starts polling the server to get values to show. The calls are simply http REST api calls to an endpoint build inside the WPLight plugin (using admin ajax URL). For non-WordPress developers you have to build your own endpoint for the calls. Each call is really short and also the answer is small so there is no useless traffic from and to the server, even if we call the server often.

The endpoint answers just with a small string which contains instructions for the WPLight about the number and the mode of the blinks to perform.

Currently it can blink in two different modes:



Working as an alert means that it blinks with a speed based on the number that the counter represents.
For example: if you have 1 comment to approve, the blinks last 2 seconds. If you have 10 comments to approve it blinks faster, half a second. If you have 50 comments it blinks ever faster. If the number is too much big, it blinks at the fastest time it can.
This blinking mode is good to use the light as an alert, a note, like the number of push notifications you see on the icon of your favorite app.

As shown in the Kickstarter video it can be used in a shop to tell that there is a new order in the e-commerce that need some work. The person who works in the physical shop can’t stay watching PC and emails, but while working in the store he can see the light blinking and so discover that there is something to do online.

The alert mode require the lamp to call the server maximum once every every two minutes, if the server answers always the same number the lamp slow down and calls the server less.

The alert mode results in a costant blink, faster or slower, like this GIF:


The monitor mode is different, it shows events, each time they happens. Think to a monitor for viral events, for example, it makes a blink every time a user shares a post of your blog on Facebook.

This monitor is not really in real-time, because the WPLight can’t be directly reached by your web server, because it hasn’t a static IP and to reach it from outside your wifi network you need NAT and port forwaring on your wifi router and this isn’t really possible for most users.

So the WPLight polls the server more often than in alert mode and distribute a number of light blinks in a small interval. This way, if the windows is enaugh small it seems real time.

To not overload the server the calls are made maximum once in a minute.

I’ll try to explain better with an example: if you have a user session counter that adds 1 when a new user arrives on your website, the endpoint called will pass that counter to the light. The light calls the server every minute or two, when it see that there are, for example, 5 new sessions, it will blink randomly five times in the interval. This will made the monitor work.

I’ve tested the prototype with Google Analytics opened and the result is really good. There is only one minute delay between Analytics and WPLight.



I'm a software engineer, an everyday web developer and a maker. I usually build sites with PHP, within or without WordPress. I build Internet of Things with Arduino and ESP8266. I'm the founder of Rockit.it and Dailybest.it and I'm actually the Chief Technical Officer of Better Days web agency.



Come riciclare vecchi cellulari e rientrare in contatto con la natura

April 28, 2021

12 punti per scegliere il rivestimento conforme per il tuo PCB

Cos'è e come scegliere il rivestimento conforme (o conformal coating) quando si stampano i PCB

September 11, 2020

Stampare PCB per i progetti con Arduino non è difficile (parte II)

Tra i miglioramenti possibili, uno dei più affascinanti e complessi è passare dalla breadboard al circuito stampato, cioè passare dall'ammasso di fili e componenti saldati o precariamente connessi al supporto solido, professionale e compatto della scheda elettronica.

June 9, 2020

Dalla breadboard al circuito stampato (parte I)

Stufo di saldare? Proviamo a fare i PCB

May 8, 2020

Come costruire un saturimetro

Come costruire un saturimetro rudimentale con Arduino, modificando un sensore KY-039 per il battito cardiaco.

April 25, 2020

Trasformazione di uno zaino vintage di Millet Walter Bonatti

Retrofitting di un vecchio zaino, hacking di un oggetto vintage, l'ho migliorato? O l'ho peggiorato?

February 9, 2020