-
Notifications
You must be signed in to change notification settings - Fork 0
/
open-api-3.yaml
137 lines (133 loc) · 3.42 KB
/
open-api-3.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
openapi: 3.1.0
info:
title: TP-Link Smart Home HS110 Plug API
version: ${VERSION}
contact:
name: Lars Michaelis
email: mail@larmic.de
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0
paths:
/tp-link-api/api/{plugIp}:
get:
summary: Returns a smart plug general info by ip.
parameters:
- name: plugIp
in: path
required: true
description: ip address of plug (i.e. 10.0.0.100)
schema:
type: string
responses:
'200':
description: Smart plug
content:
'application/json':
schema:
$ref: "#/components/schemas/System"
'404':
description: Smart plug not found.
content:
application/json:
schema:
$ref: "#/components/schemas/ProtocolError"
/tp-link-api/api/{plugIp}/consumption:
get:
summary: Returns a smart plug consumption info by ip.
parameters:
- name: plugIp
in: path
required: true
description: ip address of plug (i.e. 10.0.0.100)
schema:
type: string
responses:
'200':
description: Smart plug consumption info
content:
'application/json':
schema:
$ref: "#/components/schemas/Consumption"
'404':
description: Smart plug not found.
content:
application/json:
schema:
$ref: "#/components/schemas/ProtocolError"
components:
schemas:
System:
required:
- ip
- port
- alias
- model
- mac
- softwareVersion
- hardwareVersion
- led
- switch
properties:
ip:
type: string
description: Smart plug ip addres (i.e. 10.0.0.100).
port:
type: integer
description: Smart plug port (i.e. 9999).
name:
type: string
description: Smart plug name or alias.
icon:
type: string
description: Smart plug icon hash.
model:
type: string
description: Smart plug model.
mac:
type: string
description: Smart plug mac address.
softwareVersion:
type: string
description: Smart plug software version.
hardwareVersion:
type: string
description: Smart plug hardware version.
led:
type: string
description: Smart plug led state.
enum:
- on
- off
power:
type: string
description: Smart plug power switch state.
enum:
- on
- off
Consumption:
required:
- current_mw
- today_wh
- total_wh
properties:
current_mw:
type: integer
description: Actual consumption in milli watt
today_wh:
type: integer
description: Consumption of the day in watt per hours
total_wh:
type: integer
description: Consumption since switch on device in watt per hours
ProtocolError:
required:
- code
- message
properties:
code:
type: integer
description: HTTP code.
message:
type: string
description: Error message.