Episensor RESTful Interface

written by Eoin Hurrell < Eoin.Hurrell@computing.dcu.ie >

Functions accessible from
http://clarityapp.ucd.ie/~ehurrell/episensor.php
Pass required parameters for each function.

Functions:

  1. GET LIST OF USERS


    < back to top
    Lists all of the users with data available

    Required Parameters:

    exec=users

    Example output

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=users
    < result>
    < user 0="32" UserID="32" 1="000D6F00001E62F6" ModuleID="000D6F00001E62F6" 2="Sep 14 2010 1:24PM" most_recent_data="Sep 14 2010 1:24PM" />
    < /result>

    Optional Parameters:

    time= [time, UTC time] - restricts to users who've uploaded data since specified time



  2. GET LIST OF MODULES


    < back to top
    Lists a user's available modules (some users may have multiple modules)

    Required Parameters:

    exec=modules
    user_id=[user id, int]

    Example output

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=modules&user_id=7
    < result>
    < module 0="7" UserID="7" 1="000D6F00001E6268" ModuleID="000D6F00001E6268" 2="000D6F00001E6268" Name="000D6F00001E6268" 3="000D6F00001E6268, Added automatically" Description="000D6F00001E6268, Added automatically" />
    < /result>

    Optional Parameters:

    cols=true - shows all columns eg:
    < result>
    < module 0="7" UserID="7" 1="000D6F00001E6268" ModuleID="000D6F00001E6268" 2="000D6F00001E6268" Name="000D6F00001E6268" 3="000D6F00001E6268, Added automatically" Description="000D6F00001E6268, Added automatically" 4="Jun 30 2010 4:18PM" InstallDateTime="Jun 30 2010 4:18PM" 5="Sep 15 2010 4:36PM" LastDataDateTime="Sep 15 2010 4:36PM" 6="0" Attention="0" 7="0" DeviceLQI="0" 8="255" LinkLQI="255" 9="47162" ShortAddress="47162" 10="3309" LastBatteryLevel="3309" 11="" Long="" 12="" Lat="" 13="1115" SoftwareVersion="1115" 14="1" ModuleTypeID="1" 15="Sep 15 2010 4:36PM" LastEditDate="Sep 15 2010 4:36PM" 16="Jun 30 2010 4:18PM" CreationDate="Jun 30 2010 4:18PM" />
    < /result>



  3. GET LIST OF SENSORS


    < back to top
    Shows the available sensors on each module. Each sensor records a different reading, Real Power, Watt Hours etc. (View the example query for a full list from a standard module)

    Required Parameters:

    exec=module_sensor
    user_id=[user id, int]
    module_id=[module id,string]

    Example output

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=module_sensor&user_id=7&module_id=000D6F00001E6129
    < result>
    < module_sensor 0="7" UserID="7" 1="000D6F00001E6129" ModuleID="000D6F00001E6129" 2="126" SensorID="126" 3="Real Power" Name="Real Power" />
    ...
    < /result>

    Optional Parameters:

    cols=true - shows all columns eg:
    < result>
    < module_sensor 0="7" UserID="7" 1="000D6F00001E6129" ModuleID="000D6F00001E6129" 2="126" SensorID="126" 3="Real Power" Name="Real Power" 4="Real Power was added on 30/06/2010 (UTC)" Description="Real Power was added on 30/06/2010 (UTC)" 5="Jun 30 2010 4:09PM" InstallDateTime="Jun 30 2010 4:09PM" 6="Jun 30 2010 4:09PM" LastDataDateTime="Jun 30 2010 4:09PM" 7="0" Attention="0" 8="126" Address="126" 9="76" SensorTypeID="76" 10="Jun 30 2010 4:09PM" LastEditDate="Jun 30 2010 4:09PM" 11="Jun 30 2010 4:09PM" CreationDate="Jun 30 2010 4:09PM" />
    < /result>



  4. GET RAW SENSOR DATA


    < back to top

    Required Parameters:

    exec=raw_sensor
    user_id=[user id, int]
    start_time=[start time, UTC time]
    end_time=[end time, UTC time]

    Example output

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=raw_sensor&user_id=7&start_time=2010-08-30 00:00:00&end_time=2010-08-30 00:30:00
    < result>
    < raw_sensor 0="7" UserID="7" 1="000D6F00001E6248" ModuleID="000D6F00001E6248" 2="129" SensorID="129" 3="Feb 7 2010 4:00PM" reading_time="Feb 7 2010 4:00PM" 4="932136.000000" reading_value="932136.000000" />
    ...
    < /result>

    Optional Parameters:

    sensor_id=[sensor id,int] (if left out defaults to sensor 129)
    module_id=[module id,string]
    all=true - shows more than 10,000 rows
    cols=true - shows all columns eg:
    < result>
    < raw_sensor 0="7" UserID="7" 1="000D6F00001E6248" ModuleID="000D6F00001E6248" 2="129" SensorID="129" 3="Aug 30 2010 12:00AM" reading_time="Aug 30 2010 12:00AM" 4="6290958.000000" reading_value="6290958.000000" 5="?8?o?sL?????[?" ID="?8?o?sL?????[?" 6="0" Alarm="0" 7="Aug 30 2010 12:00AM" LastEditDate="Aug 30 2010 12:00AM" 8="Aug 30 2010 12:00AM" CreationDate="Aug 30 2010 12:00AM" />
    < /result>



  5. POWER MINUTE VALUES IN HOUR


    < back to top
    Returns the minute-by-minute power consumption in a given hour (optionally the expected values if you wish to use this for a comparison or prediction)

    Required Parameters:

    exec=power_value_minute
    user_id=[user id, int]
    start_time=[UTC time at very start of HOUR, UTC time]
    end_time=[UTC time at very end of HOUR, UTC time]

    Example output

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=power_value_minute&user_id=7&start_time=2010-02-24 00:00:00.000&end_time=2010-02-24 00:59:59.999
    < result>
    < power_value_minute 0="0" reading_time="Feb 24 2010 12:00:15:000AM" 1="1589031.000000" reading_value="1589031" />
    < /result>

    Optional Parameters:

    module_id=[module id,string]
    expected=true (displays expected values rather than actual ones)
    day_of_week=[int,(Sun=1, Sat=7)] (needed where expected=true)
    hour_of_day=[int, 0-23] (needed where expected=true)

    Optional Parameter Example

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=power_value_minute&user_id=7&expected=true&day_of_week=1&hour_of_day=12
    < result>
    < expected_power_value_minute 0="0.019638" expected_value="0.019638" />
    < /result>



  6. POWER HOUR VALUES IN DAY


    < back to top
    Returns the hour-by-hour power consumption in a given time(optionally the expected values if you wish to use this for a comparison or prediction)

    Required Parameters:

    exec=power_value_hour
    user_id=[user id, int]
    start_time=[UTC time at very start of HOUR, UTC time(hour:minute = 00:00)]
    end_time=[UTC time at very end of HOUR, UTC time(hour:minute = 23:59)]

    Example output

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=power_value_hour&user_id=7&start_time=2010-02-24 00:00:00.000&end_time=2010-02-24 00:59:59.999
    < result>
    < power_value_hour 0="Feb 24 2010 12:00:15:000AM" reading_time="Feb 24 2010 12:00:15:000AM" 1="1.28800000000" reading_value="1.28800000000" />
    < /result>

    Optional Parameters:

    module_id=[module id,string]
    expected=true (displays expected values rather than actual ones)
    day_of_week=[int,(Sun=1, Sat=7)] (needed where expected=true)
    week_of_year=[int, 1-52] (needed where expected=true)

    Optional Parameter Example

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=power_value_hour&user_id=7&expected=true&day_of_week=1&hour_of_day=12
    < result>
    < expected_power_value_hour 0="0" hour_in_day="0" 1="1.175049" expected_value="1.175049" />
    < /result>



  7. POWER DAILY VALUES (ACROSS MULTIPLE DAYS/WEEKS/MONTHS)


    < back to top
    Returns the day-by-day power consumption in a given timeframe (optionally the expected values if you wish to use this for a comparison or prediction)

    Required Parameters:

    exec=power_value_day
    user_id=[user id, int]
    start_time=[UTC time at very start of HOUR, UTC time(hour:minute = 00:00)]
    end_time=[UTC time at very end of HOUR, UTC time(hour:minute = 23:59)]

    Example

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=power_value_day&user_id=7&start_time=2010-02-24 00:00:00.000&end_time=2010-02-24 00:59:59.999
    < result>
    < power_value_day 0="Feb 24 2010 12:00:15:000AM" reading_time="Feb 24 2010 12:00:15:000AM" 1="1.28800000000" reading_value="1.28800000000" />
    < /result>

    Optional Parameters:

    module_id=[module id,string]
    expected=true (displays expected values rather than actual ones)
    day_of_week=[int,(Sun=1, Sat=7)] (needed where expected=true)
    week_of_year=[int, 1-52] (needed where expected=true)

    Optional Parameter Example

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=power_value_day&user_id=7&expected=true
    < result>
    < expected_power_value_day 0="1" week_day="1" 1="27.587304" expected_value="27.587304" />
    < /result>



  8. SENSOR MINUTE VALUES IN HOUR


    < back to top
    Returns the minute-by-minute values from any sensor in a given hour. Sensor id 129 is used to calculate power (so use Power Minute Values in Hour instead).

    Required Parameters:

    exec=sensor_value_minute
    user_id=[user id, int]
    start_time=[UTC time at very start of HOUR, UTC time]
    end_time=[UTC time at very end of HOUR, UTC time]

    Example

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=sensor_value_minute&user_id=7&sensor_id=129&start_time=2010-02-24 00:00:00.000&end_time=2010-02-24 00:59:59.999
    < result>
    < sensor_value_minute 0="0" reading_time="Feb 24 2010 12:00:15:000AM" 1="1589031.000000" reading_value="1589031" />

    Optional Parameters:

    module_id=[module id,string]



  9. SENSOR HOUR VALUES IN DAY


    < back to top
    Returns the hour-by-hour values from any sensor in a given time. Sensor id 129 is used to calculate power (so use Power Minute Values in Hour instead).

    Required Parameters:

    exec=sensor_value_hour
    user_id=[user id, int]
    start_time=[UTC time at very start of HOUR, UTC time(hour:minute = 00:00)]
    end_time=[UTC time at very end of HOUR, UTC time(hour:minute = 23:59)]

    Example

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=sensor_value_hour&user_id=7&sensor_id=129&start_time=2010-02-24 00:00:00.000&end_time=2010-02-24 00:59:59.999
    < result>
    < sensor_value_hour 0="Feb 24 2010 12:00:15:000AM" reading_time="Feb 24 2010 12:00:15:000AM" 1="1589714.842105" reading_value="1589714.842105" />
    < /result>

    Optional Parameters:

    module_id=[module id,string]



  10. SENSOR DAILY VALUES (ACROSS MULTIPLE DAYS/WEEKS/MONTHS)


    < back to top
    Returns the day-by-day values from any sensor in a given timeframe. Sensor id 129 is used to calculate power (so use Power Minute Values in Hour instead).

    Required Parameters:

    exec=sensor_value_hour
    user_id=[user id, int]
    start_time=[UTC time at very start of HOUR, UTC time(hour:minute = 00:00)]
    end_time=[UTC time at very end of HOUR, UTC time(hour:minute = 23:59)]

    Example

    http://clarityapp.ucd.ie/~ehurrell/episensor.php?exec=sensor_value_day&user_id=7&sensor_id=129&start_time=2010-02-24 00:00:00.000&end_time=2010-02-24 00:59:59.999
    < result>
    < sensor_value_day 0="Feb 24 2010 12:00:15:000AM" reading_time="Feb 24 2010 12:00:15:000AM" 1="1589714.842105" reading_value="1589714.842105" />
    < /result>

    Optional Parameters:

    module_id=[module id,string]
Documentation ver 1.0