Data acquisition with PHP

Library

There is a convenient PHP library for transmitting measurement values using PHP ready for download.

Download

Please download these files and put them alongside into the folder of your PHP program:

Hint

If you’re stuck with PHP4, use

Todo

Make distribution packages hiveeyes-php.zip and hiveeyes-php4.zip.

Telemetry API

Transmitting telemetry data using PHP is pretty easy, read on my dear:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
    // Put this file into the folder of your PHP program
    include("hiveeyes.php");

    // Acquire API library
    use Hiveeyes\HiveeyesNode;

    // Create a "Node API" telemetry client object
    $telemetry = new HiveeyesNode(
        array(
            "network"   => "testdrive",
            "gateway"   => "area-42",
            "node"      => "node-1",
        )
    );

    // Transmit data
    $data = array("temperature" => 42.84, "humidity" => 83, "weight" => 37.4);
    $telemetry->transmit($data);

Todo

  • Emphasize generation of custom “network”, “gateway” and “node” identifiers.
  • Add convenience by adding appropriate Javascript widgets.

Demo

Command line

There is a command line program example.php for demonstration purposes, it will send data to swarm.hiveeyes.org:

php -f src/clients/php5/example.php run demo
php -f src/clients/php5/example.php run sawtooth

Hint

If you’re stuck with PHP4, please use example.php4.

Todo

Todo

  • [o] After having export features, implement TelemetryClient->fetch(from, to) à la Grafana
  • [o] [docs] Link to Kotori: handbook/kotori, setup/getting-started and other appropriate sections