NAME

Device::Neurio - Methods for wrapping the Neurio API calls so that they are accessible via Perl

VERSION

Version 0.16

SYNOPSIS

This module provides a Perl interface to a Neurio sensor via the following 
methods:
  - new
  - connect
  - fetch_Samples
  - fetch_Samples_Full
  - fetch_Samples_Last_Live
  - fetch_Samples_Recent_Live
  - fetch_Stats_Energy
  - fetch_Appliances
  - fetch_Appliances_Events
  - fetch_Appliance
  - fetch_Appliances_Stats

Please note that in order to use the 'Samples' methods in this module you will 
require three parameters (key, secret, sensor_id) as well as an Energy Aware 
Neurio sensor installed in your house.  In order to use the 'Appliances'
methods, you will also require another parameter (location_id).  This information
can be obtained from the Neurio developpers website.

The module is written entirely in Perl and was developped on Raspbian Linux.

All date/time values are specified using ISO8601 format (yyyy-mm-ddThh:mm:ssZ)

SAMPLE CODE

  use Device::Neurio;

  $my_Neurio = Device::Neurio->new($key,$secret,$sensor_id);

  $my_Neurio->connect($location_id);

  $data = $my_Neurio->fetch_Samples_Last_Live();
  print $data->{'consumptionPower'}

  $data = $my_Neurio->fetch_Samples_Recent_Live("2014-06-18T19:20:21Z");
  print $data->[0]->{'consumptionPower'}

  undef $my_Neurio;

EXPORT

All by default.

SUBROUTINES/METHODS

new - the constructor for a Neurio object

Creates a new instance which will be able to fetch data from a unique Neurio 
sensor.  All three parameters are required and can be obtained from the
Neurio developpers website.

my $Neurio = Device::Neurio->new($key, $secret, $sensor_id, $debug);

  This method accepts the following parameters:
    - $key       : unique key for the account - Required 
    - $secret    : secret key for the account - Required 
    - $sensor_id : sensor ID connected to the account - Required 
    - $debug     : turn on debug messages - Optional

Returns a Neurio object if successful.
Returns 0 on failure

DESTROY - the destructor for a Neurio object

Destroys a previously created Neuri object.

connect - open a secure connection to the Neurio server

Opens a secure connection via HTTPS to the Neurio server which provides
access to a set of API commands to access the sensor data.

An optional location ID can be given.  This is only required if calls
will be made to the 'Appliance' methods.  Calls to the 'Samples'
methods do not require that a location ID be set.  If a location_id is not
specified at connection, then it must be specified when using the 'Appliance'
methods.

A location ID can be acquired from the Neurio developpers web site

  $Neurio->connect($location_id);

  This method accepts the following parameter:
    - $location_id : unique location id - Optional 

Returns 1 on success 
Returns 0 on failure

debug - Configure debug settings for a Neurio object

Enables debug printouts and an optional file handle can be supplied
where printouts will be re-directed.

   $my_Neurio = Device::Neurio->new($key,$secret,$sensor_id);

   $my_Neurio->connect($location_id);
   $my_Neurio->debug($debug,$fileHandle);

  This method accepts at least one of the following parameters:
    - $debug      : turn on debug messages - Optional
    - $fileHandle : filehandle for logging debug messages - Optional

Returns nothing.

fetch_Samples_Recent_Live - Fetch recent sensor samples

Get recent samples, one sample per second for up to the last 2 minutes.
The values represent the sum of all phases.

  $Neurio->fetch_Samples_Recent_Live($last);

  This method accepts the following parameters:
     $last - time of last sample received specified using ISO8601 
             format (yyyy-mm-ddThh:mm:ssZ)  - Optional
     
     If no value is specified for $last, a default of 2 minutes is used.

Returns an array of Perl data structures on success
[
         {
           'generationEnergy' => 3716166644,
           'timestamp' => '2014-06-24T11:08:00.000Z',
           'consumptionEnergy' => 6762651207,
           'generationPower' => 564,
           'consumptionPower' => 821
         },
         ...
        ]
Returns 0 on failure

fetch_Samples_Last_Live - Fetch the last live sensor sample

Get the last sample recorded by the sensor.
The values represent the sum of all phases.

  $Neurio->fetch_Samples_Last_Live();

  This method accepts no parameters

Returns a Perl data structure on success:
{
         'generationEnergy' => 3716027450,
         'timestamp' => '2014-06-24T11:03:43.000Z',
         'consumptionEnergy' => 6762445671,
         'generationPower' => 542,
         'consumptionPower' => 800
       };
Returns 0 on failure

fetch_Samples - Fetch sensor samples from the Neurio server

Get samples for a specified time interval.
The values represent the sum of all phases.

$Neurio->fetch_Samples($start,$granularity,$end,$frequency,$perPage,$page);

  This method accepts the following parameters:
    - $start       : yyyy-mm-ddThh:mm:ssZ - Required
                     specified using ISO8601 format
    - $granularity : seconds|minutes|hours|days - Required
    - $end         : yyyy-mm-ddThh:mm:ssZ - Optional
                     specified using ISO8601 format
    - $frequency   : if the granularity is specified as 'minutes', then the 
                     frequency must be a multiple of 5 - Optional
    - $perPage     : number of results per page - Optional
    - $page        : page number to return - Optional

Returns an array of Perl data structures on success
    [
             {
               'generationEnergy' => 3568948578,
               'timestamp' => '2014-06-21T19:00:00.000Z',
               'consumptionEnergy' => 6487889194,
               'generationPower' => 98,
               'consumptionPower' => 240
             },
            ...
            ]
Returns 0 on failure

fetch_Samples_Full - Fetches full samples for all phases

Get full samples for a specified time interval. Sample data will include
information broken down by channel.

$Neurio->fetch_Samples_Full($start,$granularity,$end,$frequency,$perPage,$page);

  This method accepts the following parameters:
    - $start       : yyyy-mm-ddThh:mm:ssZ - Required
                     specified using ISO8601 format
    - $granularity : seconds|minutes|hours|days - Required
    - $end         : yyyy-mm-ddThh:mm:ssZ - Optional
                     specified using ISO8601 format
    - $frequency   : an integer - Optional
    - $perPage     : number of results per page - Optional
    - $page        : page number to return - Optional

Returns an array of Perl data structures on success
[
 {
   'timestamp' => '2014-06-16T19:20:21.000Z',
   'channelSamples' => [
                         {
                           'voltage' => '123.19',
                           'power' => 129,
                           'name' => '1',
                           'energyExported' => 27,
                           'channelType' => 'phase_a',
                           'energyImported' => 2682910899,
                           'reactivePower' => 41
                         },
                         {
                           'voltage' => '123.94',
                           'power' => 199,
                           'name' => '2',
                           'energyExported' => 6,
                           'channelType' => 'phase_b',
                           'energyImported' => 3296564362,
                           'reactivePower' => -45
                         },
                         {
                           'voltage' => '123.57',
                           'power' => 327,
                           'name' => '3',
                           'energyExported' => 10,
                           'channelType' => 'consumption',
                           'energyImported' => 5979475235,
                           'reactivePower' => -4
                         }
                       ]
 },
 ...
]
Returns 0 on failure

fetch_Stats_Energy - Fetches energy statistics

Get brief stats for energy consumed in a given time interval.
The values represent the sum of all phases.

To convert the energy returned into kWh, divide it by 3600000

  $Neurio->fetch_Stats_Energy($start,$granularity,$frequency,$end);

  This method accepts the following parameters:
    - $start       : yyyy-mm-ddThh:mm:ssZ - Required
                     specified using ISO8601 format
    - $granularity : minutes|hours|days|months - Required
    - $frequency   : if the granularity is specified as 'minutes', then the 
                     frequency must be a multiple of 5 - Required
    - $end         : yyyy-mm-ddThh:mm:ssZ - Optional
                     specified using ISO8601 format

Returns a Perl data structure containing all the raw data
Returns 0 on failure

fetch_Appliances - Fetch the appliances for a specific location

Get the appliances added for a specified location. 

The location_id is an optional parameter because it can be specified when 
connecting.  If it is specified below, then this will over-ride the location 
ID set when connecting, but for this function call only.

  $Neurio->fetch_Appliances($location_id);

  This method accepts the following parameters:
    - $location_id  : id of a location - Optional

Returns an array of Perl data structures on success
[
         {
           'locationId' => 'xxxxxxxxxxxxxxx',
           'name' => 'lighting_appliance',
           'id' => 'yyyyyyyyyyyyyyyyy',
           'label' => 'Range Light on Medium',
           'tags' => []
         },
         {
           'locationId' => 'xxxxxxxxxxxxxxx-3',
           'name' => 'refrigerator',
           'id' => 'zzzzzzzzzzzzzzzz',
           'label' => '',
           'tags' => []
         },
         ....
        ]
Returns 0 on failure

fetch_Appliance - Fetch information about a specific appliance

Get the information for a given appliance.

The applicance_id parameter is determined by using the fetch_Appliance method 
which returns a list of appliances with their IDs

  $Neurio->fetch_Appliance($appliance_id);

  This method accepts the following parameters:
    - $appliance_id  : id of the appliance - Required

Returns a Perl data structure on success:
{
         'locationId' => 'xxxxxxxxxxxxx,
         'name' => 'lighting_appliance',
         'id' => 'yyyyyyyyyyyyyyy',
         'label' => 'Range Light on Medium',
         'tags' => []
       };
Returns 0 on failure

fetch_Appliances_Specs - Fetch specs about all appliances

Get all supported appliance types that Neurio can detect, along with their 
specifications.

  $Neurio->fetch_Appliances_Specs();

  This method accepts no parameters:

Returns a Perl data structure on success:
{
         'locationId' => 'xxxxxxxxxxxxx,
         'name' => 'lighting_appliance',
         'id' => 'yyyyyyyyyyyyyyy',
         'label' => 'Range Light on Medium',
         'tags' => []
       };
Returns 0 on failure

fetch_Appliances_Status - Fetch specs about all appliances

Query the appliance statuses for a specified location.

  $Neurio->fetch_Appliances_Status($location_id);

  This method accepts the following parameters:
     - $location_Id  : id of a location - Required

Returns a Perl data structure on success:
[
   {
       "appliance" : {
           "id" : "2SMROBfiTA6huhV7Drrm1g",
           "name" : "television",
           "label" : "upstairs TV",
           "tags" : ["bedroom_television", "42 inch LED"],
           "locationId" : "0qX7nB-8Ry2bxIMTK0EmXw",
           "createdAt": "2014-10-16T18:21:11.038Z",
           "updatedAt": "2014-10-16T18:47:09.566Z",
       },
       "isTrained": true,
       "lastUsed": "2014-10-31T15:08:01.310Z"
   },
   ...
 ]
Returns 0 on failure

fetch_Appliances_Stats_by_Location - Fetch appliance stats for a given location

Get appliance usage data for a given location.

  $Neurio->fetch_Appliances_Stats_by_location($location_id,$start,$granularity,$end,$minPower,$perPage,$page);

  This method accepts the following parameters:
     - $location_Id  : id of a location - Required
     - $start        : yyyy-mm-ddThh:mm:ssZ - Required
                       specified using ISO8601 format
     - $granularity  : seconds|minutes|hours|days - Required
     - $end          : yyyy-mm-ddThh:mm:ssZ - Required
                       specified using ISO8601 format
     - $minPower     : minimum power - Optional
     - $perPage      : number of results per page - Optional
     - $page         : page number to return - Optional

Returns an array of Perl data structures on success
[
   {
       "appliance": {
           "label": "",
           "name": "dryer",
           "locationId": "0qX7nB-8Ry2bxIMTK0EmXw",
           "tags": [],
           "createdAt": "2015-01-04T23:42:54.009Z",
           "updatedAt": "2015-01-30T19:19:10.278Z",
           "id": "4SmROBfiTA6huhV7Drrm1h"
       },
       "averagePower": 5162.4,
       "eventCount": 5,
       "lastEvent": {
           "appliance": {
               "label": "",
               "name": "dryer",
               "locationId": "0qX7nB-8Ry2bxIMTK0EmXw",
               "tags": [],
               "createdAt": "2015-01-04T23:42:54.009Z",
               "updatedAt": "2015-01-30T19:19:10.278Z",
               "id": "4SmROBfiTA6huhV7Drrm1h"
           },
           "status": "complete",
           "start": "2015-02-04T22:24:41.816Z",
           "end": "2015-02-04T22:31:06.792Z",
           "energy": 1308604,
           "averagePower": 5155,
           "guesses": {
               "air_conditioner": 0.5,
               "dryer": 0.5
           },
           "groupIds": ["2pMROafiTA6huhV7Drrm1g"],
           "lastCycle": {
               "groupId": "cd0r-kOrRvWFbIuuUnL5GQ",
               "start": "2015-02-04T22:29:25.798Z",
               "end": "2015-02-04T22:31:06.792Z",
               "energy": 482612,
               "averagePower": 5182,
               "createdAt": "2015-02-04T22:29:38.701Z",
               "updatedAt": "2015-02-04T23:28:08.014Z",
               "significant": true,
               "sensorId": "0x0000C47F510179FE",
               "id": "Xj_L10ryTgSdX8euqj_fHw"
           },
           "cycleCount": 2,
           "isConfirmed": true,
           "id": "-yvnL0vgTN2DUx2dVv4uTw"
       },
       "timeOn": 687944,
       "energy": 14443276,
       "usagePercentage": 16.34809,
       "guesses": {},
       "start": "2015-02-04T03:37:51.566Z",
       "end": "2015-02-11T23:41:06.554Z",
       "groupIds": ["2pMROafiTA6huhV7Drrm1g"],
       "id": "Y8StKV6nStaXaguxnmNKtg"
   },
   ...
]
Returns 0 on failure

fetch_Appliances_Stats_by_Appliance - Fetch usage data for a given appliance

Get appliance usage data for a given appliance.

  $Neurio->fetch_Appliances_Stats_by_Appliance($appliance_id,$start,$granularity,$end,$minPower,$perPage,$page);

  This method accepts the following parameters:
     - $appliance_id : id of the appliance - Required
     - $start        : yyyy-mm-ddThh:mm:ssZ - Required
                       specified using ISO8601 format
     - $granularity  : days, weeks, or months - Required
     - $end          : yyyy-mm-ddThh:mm:ssZ - Required
                       specified using ISO8601 format
     - $minPower     : minimum Power - Optional
     - $perPage      : number of results per page - Optional
     - $page         : page number to return - Optional

Returns an array of Perl data structures on success
[
   {
       "appliance": {
           "label": "",
           "name": "dryer",
           "locationId": "0qX7nB-8Ry2bxIMTK0EmXw",
           "tags": [],
           "createdAt": "2015-01-04T23:42:54.009Z",
           "updatedAt": "2015-01-30T19:19:10.278Z",
           "id": "4SmROBfiTA6huhV7Drrm1h"
       },
       "averagePower": 5162.4,
       "eventCount": 5,
       "lastEvent": {
           "appliance": {
               "label": "",
               "name": "dryer",
               "locationId": "0qX7nB-8Ry2bxIMTK0EmXw",
               "tags": [],
               "createdAt": "2015-01-04T23:42:54.009Z",
               "updatedAt": "2015-01-30T19:19:10.278Z",
               "id": "4SmROBfiTA6huhV7Drrm1h"
           },
           "status": "complete",
           "start": "2015-02-04T22:24:41.816Z",
           "end": "2015-02-04T22:31:06.792Z",
           "energy": 1308604,
           "averagePower": 5155,
           "guesses": {
               "air_conditioner": 0.5,
               "dryer": 0.5
           },
           "groupIds": ["2pMROafiTA6huhV7Drrm1g"],
           "lastCycle": {
               "groupId": "cd0r-kOrRvWFbIuuUnL5GQ",
               "start": "2015-02-04T22:29:25.798Z",
               "end": "2015-02-04T22:31:06.792Z",
               "energy": 482612,
               "averagePower": 5182,
               "createdAt": "2015-02-04T22:29:38.701Z",
               "updatedAt": "2015-02-04T23:28:08.014Z",
               "significant": true,
               "sensorId": "0x0000C47F510179FE",
               "id": "Xj_L10ryTgSdX8euqj_fHw"
           },
           "cycleCount": 2,
           "isConfirmed": true,
           "id": "-yvnL0vgTN2DUx2dVv4uTw"
       },
       "timeOn": 687944,
       "energy": 14443276,
       "usagePercentage": 16.34809,
       "guesses": {},
       "start": "2015-02-04T03:37:51.566Z",
       "end": "2015-02-11T23:41:06.554Z",
       "groupIds": ["2pMROafiTA6huhV7Drrm1g"],
       "id": "Y8StKV6nStaXaguxnmNKtg"
   },
   ...
]
Returns 0 on failure

fetch_Appliances_Events_by_Location - Fetch events for a specific location

Get appliance events by location Id. 
An event is an interval when an appliance was in use.

An applicance_id can be requested by using the NeurioTools::get_appliance_ID 
method which returns an appliance ID for a given string name.


  $Neurio->fetch_Appliances_Events_by_Location($location_id, $start,$end,$perPage,$page);

  This method accepts the following parameters:
     - $location_Id  : id of a location - Required
     - $start        : yyyy-mm-ddThh:mm:ssZ - Required
                       specified using ISO8601 format
     - $end          : yyyy-mm-ddThh:mm:ssZ - Required
                       specified using ISO8601 format
     - $minpower     : Minimum power consumption - Optional
     - $perPage      : number of results per page - Optional
     - $page         : page number to return - Optional

Returns an array of Perl data structures on success
 [
   {
       "id" : "1cRsH7KQTeONMzjSuRJ2aw",
       "createdAt" : "2014-04-21T22:28:32Z",
       "updatedAt" : "2014-04-21T22:45:32Z",
       "appliance" : {
           "id" : "2SMROBfiTA6huhV7Drrm1g",
           "name" : "television",
           "label" : "upstairs TV",
           "tags" : ["bedroom_television", "42 inch LED"],
           "locationId" : "0qX7nB-8Ry2bxIMTK0EmXw"
       },
       "start" : "2014-04-21T05:26:10.785Z",
       "end" : "2014-04-21T05:36:00.547Z",
       "guesses" : {"dryer1" : 0.78, "dishwasher_2014" : 0.12},
       "energy" : 247896,
       "averagePower" : 122,
       "groupIds" : [ "2pMROafiTA6huhV7Drrm1g", "4SmROBfiTA6huhV7Drrm1h" ],
       "cycleCount" : 5,
       "isRunning" : false
   },
   ...
 ]
 Returns 0 on failure

fetch_Appliances_Events_by_Appliance - Fetch events for a specific appliance

Get appliance events by appliance Id. 
An event is an interval when an appliance was in use.

An applicance_id can be requested by using the NeurioTools::get_appliance_ID 
method which returns an appliance ID for a given string name.

  $Neurio->fetch_Appliances_Events_by_Appliance($appliance_id,$start,$end,$perPage,$page);

  This method accepts the following parameters:
     - $appliance_id : id of the appliance - Required
     - $start        : yyyy-mm-ddThh:mm:ssZ - Required
                       specified using ISO8601 format
     - $end          : yyyy-mm-ddThh:mm:ssZ - Required
                       specified using ISO8601 format
     - $minpower     : Minimum power consumption - Optional
     - $perPage      : number of results per page - Optional
     - $page         : page number to return - Optional

Returns an array of Perl data structures on success
[
   {
       "id" : "1cRsH7KQTeONMzjSuRJ2aw",
       "appliance" : {
           "id" : "2SMROBfiTA6huhV7Drrm1g",
           "name" : "television",
           "label" : "upstairs TV",
           "tags" : ["bedroom_television", "42 inch LED"],
           "locationId" : "0qX7nB-8Ry2bxIMTK0EmXw"
       },
       "start" : "2014-04-21T05:26:10.785Z",
       "end" : "2014-04-21T05:36:00.547Z",
       "guesses" : {"dryer1" : 0.78, "dishwasher_2014" : 0.12},
       "energy" : 247896,
       "averagePower" : 122,
       "groupIds" : [ "2pMROafiTA6huhV7Drrm1g", "4SmROBfiTA6huhV7Drrm1h" ],
       "lastCycle": {
           "groupId" : "4SmROBfiTA6huhV7Drrm1h",
           "start" : "2014-04-21T05:29:00.547Z",
           "end" : "2014-04-21T05:36:00.147Z",
           "energy" : 41846,
           "averagePower" : 122,
           "createdAt" : "2014-04-21T05:29:02.547Z",
           "updatedAt" : "2014-04-21T05:36:05.147Z",
           "sensorId" : "0x0013A00000000000",
           "id" : "ALJGM7voQpux5fujXtM2Qw"
       },
       "cycleCount" : 5,
       "status" : "complete",
       "isConfirmed" : false,
       "precedingEventId": "1cRsH7KQTeONMzjSuRJ2er"
   },
   ...
]

Returns 0 on failure

fetch_Appliances_Events_Recent - Fetch events after a spceific time

Get appliance events created or updated after a specific time.
An event is an interval when an appliance was in use.

  This method accepts the following parameters:
     - $location_Id : id of a location - Required
     - $since       : yyyy-mm-ddThh:mm:ssZ - Required
                      specified using ISO8601 format
     - $minPower    : minimum average power - Optional
     - $perPage     : number of results per page - Optional
     - $page        : page number to return - Optional

Returns an array of Perl data structures on success
 [
   {
       "id" : "1cRsH7KQTeONMzjSuRJ2aw",
       "appliance" : {
           "id" : "2SMROBfiTA6huhV7Drrm1g",
           "name" : "television",
           "label" : "upstairs TV",
           "tags" : ["bedroom_television", "42 inch LED"],
           "locationId" : "0qX7nB-8Ry2bxIMTK0EmXw"
       },
       "start" : "2014-04-21T05:26:10.785Z",
       "end" : "2014-04-21T05:36:00.547Z",
       "guesses" : {"dryer1" : 0.78, "dishwasher_2014" : 0.12},
       "energy" : 247896,
       "averagePower" : 122,
       "groupIds" : [ "2pMROafiTA6huhV7Drrm1g", "4SmROBfiTA6huhV7Drrm1h" ],
       "lastCycle": {
           "groupId" : "4SmROBfiTA6huhV7Drrm1h",
           "start" : "2014-04-21T05:29:00.547Z",
           "end" : "2014-04-21T05:36:00.147Z",
           "energy" : 41846,
           "averagePower" : 122,
           "createdAt" : "2014-04-21T05:29:02.547Z",
           "updatedAt" : "2014-04-21T05:36:05.147Z",
           "sensorId" : "0x0013A00000000000",
           "id" : "ALJGM7voQpux5fujXtM2Qw"
       },
       "cycleCount" : 5,
       "status" : "complete",
       "isConfirmed" : false,
       "precedingEventId": "1cRsH7KQTeONMzjSuRJ2er"
   },
   ...
 ]
 Returns 0 on failure

fetch_Location - Fetch information for a location

Retrieves information about a particular location.

  $Neurio->fetch_Location($location_id);

  This method accepts the following parameters:
    - $location_id  : id of a location - Required

Returns a Perl data structure on success
{
   "name": "bob location",
   "timezone": "America/Vancouver",
   "sensors":
       [
           {
               "sensorId": "0x0000000000000001",
               "installCode": "5555",
               "sensorType": "neurio",
               "locationId": "222ROBfiTA6huhV7Drrrmg",
               "channels":
                   [
                       {
                            "sensorId": "0x0000000000000001",
                            "channel": 1,
                            "channelType": "phase_a",
                            "start": "2014-07-21T20:40:39.523Z",
                            "id": "2221OBfiTA6huhV7Drrrmg"
                       },
                        ...
                   ],
               "startTime": "2014-10-01T22:05:17.747Z",
               "id": "0x0000000000000001"
           },
           ...
       ],
   "energyRate": 0.1,
   "createdAt": "2014-10-01T22:05:22.406Z",
   "id": "2SMROBfiTA6huhV7Drrrmg"
}
Returns 0 on failure

fetch_UserLocation - Fetch information for a user's location

Retrieves information about a location for a particular user.

  $Neurio->fetch_UserLocation($user_id);

  This method accepts the following parameters:
    - $user_id  : id of a user - Required

Returns a Perl data structure on success
[
   {
       "name": "John",
       "timezone": "America/Vancouver",
       "sensors":
           [
               {
                   "sensorId": "0x0000000000000001",
                   "installCode": "5555",
                   "sensorType": "neurio",
                   "locationId": "222ROBfiTA6huhV7Drrrmg",
                   "channels":
                       [
                           {
                                "sensorId": "0x0000000000000001",
                                "channel": 1,
                                "channelType": "phase_a",
                                "start": "2014-07-21T20:40:39.523Z",
                                "id": "2221OBfiTA6huhV7Drrrmg"
                           },
                            ...
                       ],
                   "startTime": "2014-10-01T22:05:17.747Z",
                   "id": "0x0000000000000001"
               },
               ...
           ],
       "energyRate": 0.1,
       "createdAt": "2014-10-01T22:05:22.406Z",
       "id": "2SMROBfiTA6huhV7Drrrmg"
   },
   ...
]
Returns 0 on failure

fetch_User - Fetch information about a particular user

Retrieves information about a particular user.

  $Neurio->fetch_User($user_id);

  This method accepts the following parameters:
    - $user_id  : id of a user - Required

Returns a Perl data structure on success
{
   "id": 123,
   "name" : "Bruce Bane",
   "email" : "bruce@bane.com",
   "status" : "active",
   "createdAt" : "2014-04-21T22:28:32Z",
   "updatedAt" : "2014-04-21T22:45:32Z",
   "locations" : [
       {
           "id" : "2SMROBfiTA6huhV7Drrm1g",
           "name" : "my home",
           "timezone" "America/Vancouver",
           "sensors" : [
               {
                   "id" : "0qX7nB-8Ry2bxIMTK0EmXw",
                   "name" : "sensor 1",
                   "type" : "powerblaster",
                   "channels" : [
                       {
                           "channel" : 1
                           "channelType" : "phase_a"
                       },
                       ...
                   ]
               },
               ...
           ]
       },
       ...
   ]
}
Returns 0 on failure

fetch_User_Current - Fetch information about the current user

Retrieves information about the current user.

  $Neurio->fetch_User_Current();

  This method accepts no parameters:

Returns a Perl data structure on success
{
   "id": 123,
   "name" : "Bruce Bane",
   "email" : "bruce@bane.com",
   "status" : "active",
   "createdAt" : "2014-04-21T22:28:32Z",
   "updatedAt" : "2014-04-21T22:45:32Z",
   "locations" : [
       {
           "id" : "2SMROBfiTA6huhV7Drrm1g",
           "name" : "my home",
           "timezone" "America/Vancouver",
           "sensors" : [
               {
                   "id" : "0qX7nB-8Ry2bxIMTK0EmXw",
                   "name" : "sensor 1",
                   "type" : "powerblaster",
                   "channels" : [
                       {
                           "channel" : 1
                           "channelType" : "phase_a"
                       },
                       ...
                   ]
               },
               ...
           ]
       },
       ...
   ]
}
Returns 0 on failure

fetch_Sensors - Fetch information about all Neurio sensors

Retrieves information about all Neurio sensors.

  $Neurio->fetch_Sensors($perPage,$page);

  This method accepts the following parameters.
      - $perPage : number of results per page - Optional
      - $page    : page number to return - Optional

Returns a Perl data structure on success
[
     {
          "id" : "0x0013A00000000000",
          "sensorId" : "0x0013A00000000000",
          "email" : "example@example.com",
          "installCode" : "26huhV7Drrm1g",
          "sensorType" : "powerblaster",
          "locationId" : "hSMROBfiTA6huhV7Drrm1h",
          "startTime" : "2014-04-21T22:28:32Z",
          "endTime" : "2014-04-21T22:45:32Z",
          "channels" : [
              {
                   "id" : "4SMROBfiTA6huhV7Drrm1g",
                   "sensorId" : "2SMROBfiTA6huhV7Drrm1g",
                   "channel" : 1,
                   "channelType" : "consumption",
                   "name" : "channel1",
                   "start" : "2014-03-21T20:35:32Z",
                   "end" : "2014-03-21T20:38:32Z",
              },...
          ]
     },...
  ]
Returns 0 on failure

fetch_Sensor - Fetch information about a specific Neurio sensor

Retrieves information about a specific Neurio sensor.

  $Neurio->fetch_Sensor($sensor_id);

  This method accepts the following parameters.
      - $sensor_id : ID of a sensor - Required

Returns a Perl data structure on success
{
      "id" : "0x0013A00000000000",
      "sensorId" : "0x0013A00000000000",
      "email" : "example@example.com",
      "installCode" : "26huhV7Drrm1g",
      "sensorType" : "powerblaster",
      "locationId" : "hSMROBfiTA6huhV7Drrm1h",
      "startTime" : "2014-04-21T22:28:32Z",
      "endTime" : "2014-04-21T22:45:32Z",
      "channels" : [
          {
               "id" : "4SMROBfiTA6huhV7Drrm1g",
               "sensorId" : "2SMROBfiTA6huhV7Drrm1g",
               "channel" : 1,
               "channelType" : "consumption",
               "name" : "channel1",
               "start" : "2014-03-21T20:35:32Z",
               "end" : "2014-03-21T20:38:32Z",
          },...
      ]
 }
Returns 0 on failure

get_version - return the version of the API being used

Retrieves the version of the API being used.

  $Neurio->get_version();

  This method accepts no parameters:

Returns a list containing the version and build of the API
Returns 0 on failure

get_uptime - return the uptime of the Neurio Sensor being used

Retrieves the uptime of the Neurio Sensor being used.

  $Neurio->get_uptime();

  This method accepts no parameters:

Returns the uptime of the sensor
Returns 0 on failure

dump_Object - shows the contents of the local Neurio object

shows the contents of the local Neurio object in human readable form

  $Neurio->dump_Object();

  This method accepts no parameters

Returns nothing

printLOG - prints to the screen and to a logfile if specified.

  $Neurio->printLOG($string);

  This method accepts the following parameters.
      - $string    : the string to print - Required

Returns nothing.

get_last_reason - returns the text generated by the most recent fetch

Returns the HTTP Header reason for the most recent fetch command

  $Neurio->get_last_reason();

  This method accepts no parameters

Returns the textual reason

get_last_code - returns the code generated by the most recent fetch

Returns the HTTP Header code for the most recent fetch command

  $Neurio->get_last_code();

  This method accepts no parameters

Returns the numeric code

get_last_exec_time - returns the execution time for the last fetch

Returns the number of milliseconds it took for the last fetch call

  $Neurio->get_last_exec_time();

  This method accepts no parameters

Returns the number of milliseconds

AUTHOR

Kedar Warriner, kedar at cpan.org

BUGS

Please report any bugs or feature requests to C<bug-device-Neurio at rt.cpan.org>
or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Device-Neurio
I will be notified, and then you'll automatically be notified of progress on 
your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

 perldoc Device::Neurio

You can also look for information at:

ACKNOWLEDGEMENTS

Many thanks to:
 The guys at Energy Aware Technologies for creating the Neurio sensor and 
     developping the API.
 Everyone involved with CPAN.

LICENSE AND COPYRIGHT

Copyright 2014 Kedar Warriner <kedar at cpan.org>.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.