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.


Collegare il condizionatore al wifi

Il condizionatore di casa non è connesso ad Internet e non può essere azionato da remoto, possiamo migliorarlo e renderlo IOT?

June 16, 2019

Retrofitting di una vecchia radio FM con connettività bluetooth

Trovata online per 5 euro e rivitalizzata.

September 28, 2018

Dart Fener parlante con Arduino Nano e DF player mini mp3

Un Dart Fener parlante: ti metti davanti a lui e gli parli e lui risponde con delle frasi del film, rigorosamente a caso

April 23, 2018

ESP8266-01 e schermo OLED: Mini Quiz

Collegare una scheda ESP8266-01 ad uno schermo OLED è complesso, perché la scheda ESP8266-01 ha solo 8 pin di cui solo 4 utilizzabili.

January 21, 2018

A new avatar generator for WordPress with get_avatar and Flathash

Brand new avatars for WordPress Gravatar service

April 7, 2017

3 ways to add author’s image in WordPress

Add author's image in WordPress without a plugin

April 5, 2017