diff --git a/api/device.json b/api/device.json
new file mode 100644
index 0000000..0596273
--- /dev/null
+++ b/api/device.json
@@ -0,0 +1,125 @@
+{
+ "swagger": "2.0",
+ "basePath": "/gotapi/device",
+ "info": {
+ "title": "device Profile",
+ "version": "2.0.0",
+ "description": "スマートデバイスへの接続関連の機能を提供するAPI。"
+ },
+ "consumes": [
+ "application/x-www-form-urlencoded",
+ "multipart/form-data"
+ ],
+ "paths": {
+ "/pairing": {
+ "post": {
+ "operationId": "devicePairingPost",
+ "x-type": "one-shot",
+ "summary": "スマートデバイスとペアリングする。",
+ "description": "",
+ "parameters": [
+ {
+ "name": "serviceId",
+ "description": "サービスID。
ペアリング対象スマートデバイス",
+ "in": "query",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "schema": {
+ "$ref": "#/definitions/PairingResponse"
+ },
+ "examples": {
+ "application/json": {
+ "result": 0,
+ "product": "Example System",
+ "version": "1.0.0"
+ }
+ }
+ }
+ }
+ },
+ "delete": {
+ "operationId": "devicePairingDelete",
+ "x-type": "one-shot",
+ "summary": "スマートデバイスとペアリングを解除する。",
+ "description": "",
+ "parameters": [
+ {
+ "name": "serviceId",
+ "description": "サービスID。
ペアリング解除対象スマートデバイス",
+ "in": "query",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "schema": {
+ "$ref": "#/definitions/PairingReleaseResponse"
+ },
+ "examples": {
+ "application/json": {
+ "result": 0,
+ "product": "Example System",
+ "version": "1.0.0"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "definitions": {
+ "PairingResponse": {
+ "type": "object",
+ "allOf": [
+ {
+ "$ref": "#/definitions/CommonResponse"
+ }
+ ]
+ },
+ "PairingReleaseResponse": {
+ "type": "object",
+ "allOf": [
+ {
+ "$ref": "#/definitions/CommonResponse"
+ }
+ ]
+ },
+ "CommonResponse": {
+ "type": "object",
+ "required": [
+ "result",
+ "product",
+ "version"
+ ],
+ "properties": {
+ "result": {
+ "type": "integer",
+ "title": "処理結果",
+ "description": "0: 正常応答
0以外: 異常応答"
+ },
+ "product": {
+ "type": "string",
+ "title": "システム名",
+ "description": "DeviceConnectシステムの名前。"
+ },
+ "version": {
+ "type": "string",
+ "title": "システムバージョン",
+ "description": "DeviceConnectシステムのバージョン名。"
+ },
+ "hmac": {
+ "type": "string",
+ "title": "署名",
+ "description": "レスポンスに対する署名。アプリケーション側から事前にHMACキーを共有されていた場合は必須。"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/api/powerMeter.json b/api/powerMeter.json
index c3dd073..78363b7 100644
--- a/api/powerMeter.json
+++ b/api/powerMeter.json
@@ -30,14 +30,14 @@
"200": {
"description": "",
"schema": {
- "$ref": "#/definitions/PowerStateResponse"
+ "$ref": "#/definitions/PowerStatusResponse"
},
"examples": {
"application/json": {
"result": 0,
"product": "Example System",
"version": "1.0.0",
- "powerstate": "OFF"
+ "powerstatus": "OFF"
}
}
}
@@ -109,36 +109,66 @@
"operationId": "powerMeterIntegratedPowerGet",
"x-type": "one-shot",
"summary": "スマートデバイスが計測した積算電力量を取得する。",
- "description": "",
+ "description": "指定した日時から過去24時間分の計測値を24または48分割して返す。(1時間または30分ごとの値を返す。)",
"parameters": [
{
"name": "serviceId",
- "description": "サービスID。取得対象スマートデバイス",
+ "description": "サービスID。
取得対象スマートデバイス",
"in": "query",
"required": true,
"type": "string"
},
{
"name": "date",
- "description": "取得日付。RFC 3339 例: 2014-01-01T00:00:00+0900",
+ "description": "取得日付。
RFC 3339 例: 2014-01-01T00:00:00+0900
省略時はAPI実行日時が指定される",
"in": "query",
"required": false,
"type": "string",
"format": "date-time"
+ },
+ {
+ "name": "unit",
+ "description": "積算電力量単位。積算電力量の単位を指定。
省略時は'Wh'",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ },
+ {
+ "name": "count",
+ "description": "積算電力量コマ数。24時間分の積算電力量を指定数で返す。
24: 24分割=1時間単位(デフォルト)
48: 48分割=30分単位",
+ "in": "query",
+ "required": false,
+ "type": "integer",
+ "format": "int32",
+ "enum": [
+ 24,
+ 48
+ ]
+ },
+ {
+ "name": "powerFlow",
+ "in": "query",
+ "description": "積算電力量方向指定。取得する積算電力量の方向を指定。
normal : 正方向
reverse : 逆方向
省略時はnormal (正方向)",
+ "required": false,
+ "type": "string",
+ "enum": [
+ "normal",
+ "reverse"
+ ]
}
],
"responses": {
"200": {
"description": "",
"schema": {
- "$ref": "#/definitions/IntegratedPowerValueResponse"
+ "$ref": "#/definitions/IntegratedPowerResponse"
},
"examples": {
"application/json": {
"result": 0,
"product": "Example System",
"version": "1.0.0",
- "integratedpowervalue": [
+ "integratedpower": [
0,
1,
2,
@@ -153,17 +183,20 @@
1024,
2048,
4096,
- 8192,
- 16384,
- 32768,
- 65536,
- 131072,
- 262144,
- 524288,
- 1048576,
- 2097152,
- 4194304
- ]
+ 2048,
+ 1024,
+ 512,
+ 256,
+ 128,
+ 64,
+ 32,
+ 16,
+ 8,
+ 4
+ ],
+ "unit": "Wh",
+ "count": 24,
+ "powerFlow": "normal"
}
}
}
@@ -174,29 +207,81 @@
"get": {
"operationId": "powerMeterInstantaneousPowerGet",
"x-type": "one-shot",
- "summary": "スマートデバイスが計測した瞬間電力量を取得する。",
+ "summary": "スマートデバイスが計測した瞬時電力量を取得する。",
+ "description": "",
+ "parameters": [
+ {
+ "name": "serviceId",
+ "description": "サービスID。
取得対象スマートデバイス",
+ "in": "query",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "unit",
+ "description": "瞬時電力量単位。瞬時電力量の単位を指定。
例:
'W'
'kW'
省略時は'W'",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "",
+ "schema": {
+ "$ref": "#/definitions/InstantaneousPowerResponse"
+ },
+ "examples": {
+ "application/json": {
+ "result": 0,
+ "product": "Example System",
+ "version": "1.0.0",
+ "instantaneouspower": 38.4,
+ "unit": "W"
+ }
+ }
+ }
+ }
+ }
+ },
+ "/instantaneousCurrent": {
+ "get": {
+ "operationId": "powerMeterInstantaneousCurrentGet",
+ "x-type": "one-shot",
+ "summary": "スマートデバイスが計測した瞬時電流量を取得する。",
"description": "",
"parameters": [
{
"name": "serviceId",
- "description": "サービスID。取得対象スマートデバイス",
"in": "query",
+ "description": "サービスID。
取得対象スマートデバイス",
"required": true,
"type": "string"
+ },
+ {
+ "name": "unit",
+ "description": "瞬時電流量単位。瞬時電流量の単位を指定。
例:
'mA'
'A'
省略時は'A'",
+ "in": "query",
+ "required": false,
+ "type": "string"
}
],
"responses": {
"200": {
"description": "",
"schema": {
- "$ref": "#/definitions/InstantaneousPowerValueResponse"
+ "$ref": "#/definitions/InstantaneousCurrentResponse"
},
"examples": {
"application/json": {
"result": 0,
"product": "Example System",
"version": "1.0.0",
- "instantaneouspowervalue": 38.4
+ "instantaneouscurrent": {
+ "rphase": 1234.5,
+ "tphase": -2345.6,
+ "unit": "mA"
+ }
}
}
}
@@ -206,13 +291,13 @@
},
"definitions": {
- "PowerState": {
+ "PowerStatus": {
"type": "object",
"required": [
- "powerstate"
+ "powerstatus"
],
"properties": {
- "powerstate": {
+ "powerstatus": {
"type": "string",
"title": "電源状態",
"description": "電源状態を示す文字列。",
@@ -220,75 +305,141 @@
}
}
},
- "PowerStateResponse": {
- "type": "object",
+ "PowerStatusResponse": {
"allOf": [
{
"$ref": "#/definitions/CommonResponse"
},
{
- "$ref": "#/definitions/PowerState"
+ "$ref": "#/definitions/PowerStatus"
}
]
},
"PowerControlResponse": {
- "type": "object",
"allOf": [
{
"$ref": "#/definitions/CommonResponse"
}
]
},
- "IntegratedPowerValue": {
+ "IntegratedPower": {
"type": "object",
"required": [
- "integratedpowervalue"
+ "count",
+ "integratedpower",
+ "powerFlow",
+ "unit"
],
"properties": {
- "integratedpowervalue": {
+ "integratedpower": {
"type": "array",
"title": "積算電力量",
- "description": "サイズが24のnumberの配列。各値は積算電力量を表す実数。単位はWh。時間順に格納されているため、最初の要素は24時間前のもの。
例: リクエストで date=2015-08-24T15:14:00+0900 を指定した場合、0から23までの各インデックスに対応する時間帯は下記のとおり。
0 : 2015-08-23T15:00 ~ 15:59
:
23 :2015-08-24T14:00 ~ 14:59",
+ "description": "24時間分の計測値を返す。
サイズが24または48のnumberの配列。各値は積算電力量を表す実数。単位はパラメーター設定による。時間順に格納されているため、最初の要素は24時間前のもの。
例: リクエストで date=2015-08-24T15:14:00+0900, count=24 を指定した場合、0から23までの各インデックスに対応する時間帯は下記のとおり。
0 : 2015-08-23T15:00 ~ 15:59
:
23 :2015-08-24T14:00 ~ 14:59",
"items": {
- "type": "number"
- },
- "minItems": 24,
- "maxItems": 24
+ "type": "number",
+ "format": "double"
+ }
+ },
+ "unit": {
+ "type": "string",
+ "title": "積算電力量単位",
+ "description": "積算電力量の単位を表す。例:'Wh' 'kWh'"
+ },
+ "count": {
+ "type": "integer",
+ "title": "積算電力量コマ数",
+ "description": "積算電力量コマ数(24または48)"
+ },
+ "powerFlow": {
+ "type": "string",
+ "title": "積算電力量方向",
+ "description": "積算電力量方向を表す。'normal' 'reverse'"
}
}
},
- "IntegratedPowerValueResponse": {
- "type": "object",
+ "IntegratedPowerResponse": {
"allOf": [
{
"$ref": "#/definitions/CommonResponse"
},
{
- "$ref": "#/definitions/IntegratedPowerValue"
+ "$ref": "#/definitions/IntegratedPower"
}
]
},
- "InstantaneousPowerValue": {
+ "InstantaneousPower": {
"type": "object",
"required": [
- "instantaneouspowervalue"
+ "instantaneouspower",
+ "unit"
],
"properties": {
- "instantaneouspowervalue": {
+ "instantaneouspower": {
"type": "number",
- "title": "瞬間電力量",
- "description": "瞬間電力量を表す実数。単位はW。"
+ "title": "瞬時電力量",
+ "description": "瞬時電力量を表す実数。単位はパラメータ設定による。",
+ "format": "double"
+ },
+ "unit": {
+ "type": "string",
+ "title": "瞬時電力量単位",
+ "description": "瞬時電力量の単位を表す。例:'W' 'kW'"
}
}
},
- "InstantaneousPowerValueResponse": {
+ "InstantaneousPowerResponse": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/CommonResponse"
+ },
+ {
+ "$ref": "#/definitions/InstantaneousPower"
+ }
+ ]
+ },
+ "InstantaneousCurrent": {
"type": "object",
+ "required": [
+ "instantaneouscurrent"
+ ],
+ "properties": {
+ "instantaneouscurrent": {
+ "type": "object",
+ "description": "瞬時電流量を表す実数。単位はパラメータによる。",
+ "title": "瞬時電流量",
+ "properties": {
+ "rphase": {
+ "type": "number",
+ "format": "double",
+ "description": "R相の瞬時電流量を表す実数。",
+ "title": "R相瞬時電流量"
+ },
+ "tphase": {
+ "type": "number",
+ "format": "double",
+ "description": "T相の瞬時電流量を表す実数。単相の場合は省略。",
+ "title": "T相瞬時電流量"
+ },
+ "unit": {
+ "type": "string",
+ "description": "瞬時電流量の単位を表す。例:'mA' 'A'",
+ "title": "瞬時電流量単位"
+ }
+ },
+ "required": [
+ "rphase",
+ "unit"
+ ]
+ }
+ }
+ },
+ "InstantaneousCurrentResponse": {
"allOf": [
{
"$ref": "#/definitions/CommonResponse"
},
{
- "$ref": "#/definitions/InstantaneousPowerValue"
+ "$ref": "#/definitions/InstantaneousCurrent"
}
]
},