pilight 4.0

Steadily, the (input of the) community is growing which means more and more features are added to pilight in the same amount of time. So, besides all kinds of new features in pilight 4.0, again a lot of protocols have been added. The most important new features are webserver PHP support and automatic firmware updating. The rest consists of improvements and fixes. pilight now also supports 32bit and 64bit packages through an apt (Debian based GNU) and pkgNG repository (*BSD).

New features

Webserver PHP support

The pilight webserver can now handle PHP pages natively. This opens new posibilities to create new functionality for the community. I have create simple cronjob editor to set the date and time of my wakeup light script.

The posibility to have PHP scripts run also introduces new security issues. Especially when PHP can execute scripts with root privileges. To solve this an additional feature has been introduced. The pilight webgui will now run by default as the www-data (or www user on FreeBSD) user. To overwrite this, add this line to the settings.json:

"webserver-user": "root"

To prevent confusion, the webserver authentication settings have been change from:

"webserver-authentication": 1,
"webserver-username": "",
"webserver-password": ""


"webserver-authentication": [ "username", "password" ]

Automatic pilight firmware flashing

With pilight version 3.0, the new pilight band-pass filter has been introduced. This new filter runs on an ATTiny. Of course, not all of our users have the experience in flashing new firmware on this filters.

Therefor, with the release of pilight 4.0 it can now flash these ATTiny's automatically by incoorporating AVRdude into pilight. Currently, pilight automatically detects the firmware version running, the ATTiny version used (25, 45 or 85), and flash it with the new firmware when available.

Extended repositories

Those of you running Ubuntu, Mint, Debian, FreeBSD, or OpenBSD can know also install pilight through their native package management system. For both distribution, pre-compiled 32bit and 64bit binaries are available.

The apt repository can be found @ https://apt.pilight.org

The pkgNG repository can be found @ https://pkg.pilight.org

Important changes and improvements

Changed protocol settings support

The old device specific settings were difficult to understand and not very clear in their naming. With pilight 4.0 the old settings object you had to add to each device to change it's settings has been removed. Instead, all device specific settings are now just parameters just like the device it's own parameters.

Old situation

"rpi": {
	"name": "Rasp. Temp.",
	"protocol": [ "rpi_temp" ],
	"id": [{
		"id": 1
	"temperature": 43312,
	"settings": {
		"interval": 10

New situation

"rpi": {
	"name": "Rasp. Temp.",
	"protocol": [ "rpi_temp" ],
	"id": [{
		"id": 1
	"temperature": 43312,
	"poll-interval": 10,
	"gui-decimals": 2

Please check the wiki or the development section for more information.

Disabling the sender of receiving capability of a hardware mod

In pilight 4.0 you can disable the sender of receiver. This way, you can use pilight with just a sender or just a receiver and thereby saving one GPIO pin. Instead of assinging a GPIO pin, just set the setting to -1:

	"433gpio": {
		"sender": 0,
		"receiver": -1

Improved socket library

This improvement is especially important for developers. Before pilight 4.0 the socket buffers were devided in a small buffer (1024 bytes) and a large buffer (102400 bytes). I noticed (faster then expected) that the 102400 bytes wasn't enough for some configurations. With the introduction of pilight 4.0 it can handle socket buffers of any size.

pilight will now send all streams in 1024 chunks. If these streams smaller than 1024, everything is sent at once. If a stream is 1024 bytes, then you'll know it's a chunk of a bigger stream. In that case, read until you encounter the end of streams delimiter which is currently made up of two new lines \n\n.

If multiple streams were buffered somewhere, you can also distinct them by the double new line delimiters. An example:

{"message": "test"}\n\n
{"message": "test"}\n\n
{"message": "test"}\n\n

As you can see. pilight wanted to send three messages, but the TCP sockets concencated them to one. The socket_read function as improved in pilight 4.0 takes care of these buffered messages to check if we encountered concencated multiple streams. It will then convert these messages back so the output is just big stream separated by single newlines:

{"message": "test"}\n
{"message": "test"}\n
{"message": "test"}\n

Please notice that this commit will break all externally developed apps not updated to this new version.

New protocols

Several new protocols have been introduced and also some additional device types (POLLINGSW, XBMC, and LIRC). This means that pilight can now connect to the API of both Lirc and XBMC. For descriptions on these protocols check the development section.


  • Webcam


  • Quiqq
  • X10
  • Elro Advanced Device

Weather API

  • Sunrise / Sunset


  • Three Channel
  • Teknihall

Program API

  • XBMC
  • Lirc


  • Date and Time
  • Program


Both the Weather Underground and OpenWeatherMap protocols can now read the sunrise and sunset values. pilight 4.0 also introduces an update button for both protocols. So instead of polling the API of both sites each 10 to 15 minutes, a user can now manually ask for an update.


  • Several bugs in the webserver.
  • Only allow alphanumeric characters as location and device id's.
  • UUID generation on Raspberry Pi model A.
  • The arctech_switches all function.
  • Don't start additonal threads when a node reconnects.
  • Install some binaries to bin instead of sbin so they can be run without root privileges.
  • Binary library can now handle 32 bit numbers.
  • Respect the double json values instead of converting them to integers.
  • Add the developmental version to the internal config.
  • Fixed the redicted webpage (the page the user sees when he goes to the pilight API port instead of the pilight webserver port).

Published on