Smart Plug

Fetch

Request URL:

POST /provider/fetch

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number" : "{Smart Plug Serial Number}"
}

Response:

{
    "provider": {
        "online": true,
        "power": [
            0
        ]
    },
    "_links": {
        "self": {
            "href": "/v1/provider/fetch"
        }
    }
}

Switch Plug On/Off

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{Smart Plug Serial Number}”,
  "command" : "switch_on_off",
  "state" : "on"  //receives values “on”/“off”
}

Response:

{
  "provider": {
      "isok": true,
      "id": 8****3,
      "type": "relay",
      "code": "SHPLG-1"
  },
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}

Default State

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{Smart Plug Serial Number}”,
  "command" : "default_switch",
  "state" : "last"  // Default power-on state ("off", "on", "last")
}

Response:

{
  "provider": {
      "isok": true,
      "id": 81****3,
      "type": "relay",
      "code": "SHPLG-1"
  },
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}

Max Power Turn Off

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{Smart Plug Serial Number}”,
  "command" : "max_power_turn_off",
  "max_power" : 3000  // overpower threshold in Watts
}

Response:

{
  "provider": {
      "isok": true,
      "id": 8*****93,
      "type": "relay",
      "code": "SHPLG-1"
  },
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}

Automatic Turn On/Off

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
  "serial_number": “{Smart Plug Serial Number}”,
  "command" : "auto_switch",// Automatic flip back timer, seconds. 
  "state" : "on", // Will engage after turning the plug ON or OFF
  "timeout": 5 // Seconds, 0 = OFF
}

Response:

{
  "provider": {
      "isok": true,
      "id": 8*****3,
      "type": "relay",
      "code": "SHPLG-1"
  },
  "_links": {
      "self": {
          "href": "/v1/provider/send"
      }
  }
}

Last updated