Flukso Energy meter monitoring pack: Part 2: Get data into MySQL

This blog post is part of a series check out the other posts in this series:

So after we have successfully installed the device and data is flowing to the flukso website we get a nice graph on our dashboard which is available by logging into the website:


Cool… So now we get a clear overview of our energy consumption. But there’s nothing we can do with it basically. We can look at it. Make some adjustments but no alerts, no long term reports nothing…

So as I discussed in the first post there’s an open API which makes the data available locally. This is great. No need to retrieve the data from an external website. It stays inside my own network.

The setup was very similar to my Nest Thermostat approach because I had that framework already in place I planned to use it the same way and get the data in SCOM via the same process.

Again the heart of my setup is my trusty Synology DS412+ hosting my linux distro and my MySQL dbase instance:


How did I get data in?

The setup is very similar to my Nest Thermostat approach. To get the data queried out of the Flukso device I have used the script written by a fellow fluksonian PeterJ (yep that’s the official name of users of flukso):

He uses a set of PHP scripts to get the data in.

A high level overview of the install:

  • Connect to your Synology box with Winscp
  • Copy the content of the files to /volume1/web/flukso (Make sure to follow the exact same paths as described on the google drive).
  • Open settings.php and fill in the parameters requested:


// Rename to

// DB Settings
define(‘DB_HOST’, ‘localhost’);
define(‘DB_NAME’, ‘flukso’);
define(‘DB_USER’, ‘<fill in a user with rights to create dbase on your Mysql>’);
define(‘DB_PASS’, ‘<fill in the password of that user>);

// Flukso settings
define(‘FL_ADDRESS’, ‘ipaddressofflukso:8080/sensor’);
define(‘FL_PASSWORD’, ”); //for future use
define(‘FL_SENSOR1’, ‘sensor ID’);
define(‘FL_SENSOR2’, ”);
define(‘FL_SENSOR3’, ”);

// Meter settings
define(‘START_DAY’, ‘070000’);
define(‘END_DAY’, ‘230000’);


  • Note the sensor ID can be retrieved from the website in the sensor section (make sure to use the ID and not the token)


  • Run the install.php script by accessing your synology via putty to gain a terminal access (more explanation check the Nest thermostat topic here)
  • At this point the dbase should be created an ready to go:


  • All left to do is create another line in the cron and restart it to get data flowing into our dbase and ready to get extracted by SCOM.
  • The crontab which needs to be changed is located in /etc and is named crontab. The line is in red.

Note: make sure to use TABS between the different columns otherwise the line will be deleted with the next reboot. On a Synology box it is… I don”t know on other linux distro’s but better safe than sorry right:


  • The line that needs to be added: */1    *    *    *    *    root    /usr/bin/php /volume1/web/flukso/cronjob.php

After this install the data should normally be coming in.

I’ve tried to create a brief overview on how to setup the Synology to get the data from the flukso into my own MySQL dbase using a community driven script. However this is a System Center blog so I’m not going to go further in detail here.

If you still have questions either check the flukso forum which has some really active members out there eager to help spread the word on this nifty device:

Or connect with me on twitter @dieterwijckmans so I can assist where needed.

Enough talk, let’s build
Something together.