Documentation

← Back to site

Show subdevice information

Last updated on June 15, 2016 12:25

This method will show information about a particular subdevice. Optionally, this can include historical usage information.

URL

/api/v1/subdevices/show

Parameters

  • id - the ID of the subdevice
  • include_usage_data - set to 1 to include historical usage data

Response

The server will respond with details of the subdevice.

{
  "id":2,
  "label":"Socket",
  "device_id":8,
  "power_state":null,
  "startup_mode":0,
  "aggregated_hourly_at":"2014-10-09T11:58:18.000Z",
  "aggregated_daily_at":"2014-10-09T11:58:18.000Z",
  "device_type":"ecalm",
  "remote_id":0,
  "extra_data":{},
  "timer1_enabled":null,
  "timer1_on_time":null,
  "timer1_off_time":null,
  "timer1_monday":null,
  "timer1_tuesday":null,
  "timer1_wednesday":null,
  "timer1_thursday":null,
  "timer1_friday":null,
  "timer1_saturday":null,
  "timer1_sunday":null,

  "timer2_enabled":null,
  "timer2_on_time":null,
  "timer2_off_time":null,
  "timer2_monday":null,
  "timer2_tuesday":null,
  "timer2_wednesday":null,
  "timer2_thursday":null,
  "timer2_friday":null,
  "timer2_saturday":null,
  "timer2_sunday":null,

  "timer3_enabled":null,
  "timer3_on_time":null,
  "timer3_off_time":null,
  "timer3_monday":null,
  "timer3_tuesday":null,
  "timer3_wednesday":null,
  "timer3_thursday":null,
  "timer3_friday":null,
  "timer3_saturday":null,
  "timer3_sunday":null,

  "today_wh":0,
  "today_wh_range":"low",
  "last_data_instant":0,
  "unknown_state?":true,
  "unknown_state":true,
  "device_groups":[
    {
      "id":1,
      "name":"My Devices",
      "user_id":1
    }
  ],
  "monthly_data_usage":[
    {
      "name":"Previous 12 months",
      "data":{
        "2014-03-01 00:00:00 UTC":0,
        "2014-04-01 00:00:00 UTC":0,
        ...
        "2015-02-01 00:00:00 UTC":0
      }
    }
  "daily_data_usage":[
    {
      "name":"Previous 30 days",
      "data":{
        "2014-10-09 00:00:00 UTC":0,
        "2014-10-10 00:00:00 UTC":0,
        ...
        "2014-11-08 00:00:00 UTC":0
      }
    }
  ],
  "hourly_data_usage":[
    {
      "name":"Previous 24 hours",
      "data":{
        "2014-11-08 20:00:00 UTC":0,
        "2014-11-08 21:00:00 UTC":0,
        ...
        "2014-11-09 19:00:00 UTC":0
      }
    }
  ],
  "idle_ratio_today":"0.0",
  "idle_ratio_this_month":"0.0",
  "total_usage_today":0,
  "total_usage_this_month":0,
  "voltage": 241.0,
  "voltage_reported_at": "2014-10-09T11:58:18.000Z",
  "frequency": 50.0,
  "real_power": 0.0,
  "reactive_power": 0.0
}

In the case of a Motion sensor or Open/close sensor, recent historical sensor data will also be included, as in the following example:

"data": {
    "device_type": "motion"
    "id": 16913
    "label": "Richard motion sensor"
    "device_id": 2103
    "historical_sensor_data": {
        10: 0
        11: 1
        12: 0
        13: 0
        14: 0
        15: 0
        16: 0
        17: 0
        18: 0
        19: 0
        20: 0
        21: 0
        22: 11
        23: 3
        00: 3
        01: 34
        02: 7
        03: 3
        04: 3
        05: 8
        06: 19
        07: 13
        08: 0
        09: 0
        "recent": 0
    }
    "device_groups": [1]
    0:  {
        "id": 6776
        "name": "My Devices"
        "user_id": 6404
    }
    "sensor_state": 1
}

The historical sensor data shows the last 24 complete clock hours with the key as the hour of the day. The value is the number of sensor events that occurred in that hour. So for example:

01: 34

indicates that 34 events occurred between 01:00 and 01:59