0
# Device Management
1
2
Complete lifecycle management of Arduino IoT devices including creation, configuration, certificate management, OTA updates, password handling, and tagging.
3
4
## Core Imports
5
6
```python
7
from iot_api_client.api import (
8
DevicesV2Api,
9
DevicesV2CertsApi,
10
DevicesV2OtaApi,
11
DevicesV2PassApi,
12
DevicesV2TagsApi
13
)
14
from iot_api_client.models import (
15
CreateDevicesV2Payload,
16
ArduinoDevicev2,
17
Devicev2,
18
ArduinoDevicev2Cert,
19
CreateDevicesV2CertsPayload,
20
Devicev2Pass,
21
Devicev2Otaurlpyalod,
22
Tag
23
)
24
```
25
26
## Capabilities
27
28
### Device CRUD Operations
29
30
Core device management operations for creating, reading, updating, and deleting IoT devices.
31
32
```python { .api }
33
class DevicesV2Api:
34
def devices_v2_create(self, create_devices_v2_payload: CreateDevicesV2Payload, x_organization: str = None) -> ArduinoDevicev2:
35
"""
36
Creates a new device associated to the user.
37
38
Args:
39
create_devices_v2_payload: Device creation payload
40
x_organization: Organization ID for organization-level access
41
42
Returns:
43
ArduinoDevicev2: Created device object
44
"""
45
46
def devices_v2_list(self, across_user_ids: bool = None, serial: str = None, tags: List[str] = None, x_organization: str = None) -> List[ArduinoDevicev2]:
47
"""
48
Returns the list of devices associated to the user.
49
50
Args:
51
across_user_ids: Search across all user IDs
52
serial: Filter by device serial number
53
tags: Filter by device tags
54
x_organization: Organization ID for organization-level access
55
56
Returns:
57
List[ArduinoDevicev2]: List of device objects
58
"""
59
60
def devices_v2_show(self, id: str, x_organization: str = None) -> ArduinoDevicev2:
61
"""
62
Returns the device requested by the user.
63
64
Args:
65
id: Device ID
66
x_organization: Organization ID for organization-level access
67
68
Returns:
69
ArduinoDevicev2: Device object
70
"""
71
72
def devices_v2_update(self, id: str, devicev2: Devicev2, x_organization: str = None) -> ArduinoDevicev2:
73
"""
74
Updates a device associated to the user.
75
76
Args:
77
id: Device ID
78
devicev2: Device update payload
79
x_organization: Organization ID for organization-level access
80
81
Returns:
82
ArduinoDevicev2: Updated device object
83
"""
84
85
def devices_v2_delete(self, id: str, x_organization: str = None) -> None:
86
"""
87
Removes a device associated to the user.
88
89
Args:
90
id: Device ID
91
x_organization: Organization ID for organization-level access
92
"""
93
```
94
95
### Device Properties and Events
96
97
Access device properties, events, and status information.
98
99
```python { .api }
100
class DevicesV2Api:
101
def devices_v2_get_properties(self, id: str, show_deleted: bool = None, x_organization: str = None) -> ArduinoDevicev2properties:
102
"""
103
Returns device properties.
104
105
Args:
106
id: Device ID
107
show_deleted: Include deleted properties
108
x_organization: Organization ID for organization-level access
109
110
Returns:
111
ArduinoDevicev2properties: Device properties
112
"""
113
114
def devices_v2_update_properties(self, id: str, properties_values: PropertiesValues, x_organization: str = None) -> None:
115
"""
116
Update device properties values.
117
118
Args:
119
id: Device ID
120
properties_values: Properties to update
121
x_organization: Organization ID for organization-level access
122
"""
123
124
def devices_v2_get_events(self, id: str, limit: int = None, start: str = None, x_organization: str = None) -> ArduinoDevicev2EventProperties:
125
"""
126
Get device events.
127
128
Args:
129
id: Device ID
130
limit: Maximum number of events to return
131
start: Start timestamp for events
132
x_organization: Organization ID for organization-level access
133
134
Returns:
135
ArduinoDevicev2EventProperties: Device events
136
"""
137
138
def devices_v2_get_status_events(self, id: str, limit: int = None, start: str = None, x_organization: str = None) -> ArduinoDevicev2StatusEvents:
139
"""
140
Get device status events.
141
142
Args:
143
id: Device ID
144
limit: Maximum number of events to return
145
start: Start timestamp for events
146
x_organization: Organization ID for organization-level access
147
148
Returns:
149
ArduinoDevicev2StatusEvents: Device status events
150
"""
151
152
def devices_v2_timeseries(self, id: str, pid: str, start: str = None, end: str = None, interval: int = None, x_organization: str = None) -> ArduinoDevicev2propertyvalues:
153
"""
154
Get device property timeseries data.
155
156
Args:
157
id: Device ID
158
pid: Property ID
159
start: Start timestamp
160
end: End timestamp
161
interval: Data aggregation interval in seconds
162
x_organization: Organization ID for organization-level access
163
164
Returns:
165
ArduinoDevicev2propertyvalues: Timeseries data
166
"""
167
```
168
169
### Device Certificate Management
170
171
Manage device certificates for secure communication.
172
173
```python { .api }
174
class DevicesV2CertsApi:
175
def devices_v2_certs_create(self, id: str, create_devices_v2_certs_payload: CreateDevicesV2CertsPayload) -> ArduinoDevicev2Cert:
176
"""
177
Creates a new device certificate.
178
179
Args:
180
id: Device ID
181
create_devices_v2_certs_payload: Certificate creation payload
182
183
Returns:
184
ArduinoDevicev2Cert: Created certificate
185
"""
186
187
def devices_v2_certs_list(self, id: str) -> List[ArduinoDevicev2Cert]:
188
"""
189
Returns the list of certificates associated to the device.
190
191
Args:
192
id: Device ID
193
194
Returns:
195
List[ArduinoDevicev2Cert]: List of certificates
196
"""
197
198
def devices_v2_certs_show(self, id: str, cid: str) -> ArduinoDevicev2Cert:
199
"""
200
Returns the certificate requested by the user.
201
202
Args:
203
id: Device ID
204
cid: Certificate ID
205
206
Returns:
207
ArduinoDevicev2Cert: Certificate object
208
"""
209
210
def devices_v2_certs_update(self, id: str, cid: str, devicev2_cert: Devicev2Cert) -> ArduinoDevicev2Cert:
211
"""
212
Updates a device certificate.
213
214
Args:
215
id: Device ID
216
cid: Certificate ID
217
devicev2_cert: Certificate update payload
218
219
Returns:
220
ArduinoDevicev2Cert: Updated certificate
221
"""
222
223
def devices_v2_certs_delete(self, id: str, cid: str) -> None:
224
"""
225
Removes a device certificate.
226
227
Args:
228
id: Device ID
229
cid: Certificate ID
230
"""
231
```
232
233
### Over-The-Air (OTA) Updates
234
235
Manage firmware updates for devices.
236
237
```python { .api }
238
class DevicesV2OtaApi:
239
def devices_v2_ota_upload(self, id: str, ota_file, async_req: bool = None, expire_in_mins: int = None) -> ArduinoDevicev2Otaupload:
240
"""
241
Upload an OTA binary file.
242
243
Args:
244
id: Device ID
245
ota_file: OTA binary file
246
async_req: Execute request asynchronously
247
expire_in_mins: Expiry time in minutes for the upload URL
248
249
Returns:
250
ArduinoDevicev2Otaupload: Upload response
251
"""
252
253
def devices_v2_ota_send(self, id: str, devicev2_otabinaryurl: Devicev2Otabinaryurl) -> None:
254
"""
255
Send an OTA update to a device.
256
257
Args:
258
id: Device ID
259
devicev2_otabinaryurl: OTA binary URL payload
260
"""
261
262
def devices_v2_ota_url(self, id: str, devicev2_otaurlpyalod: Devicev2Otaurlpyalod) -> ArduinoDevicev2Otaupload:
263
"""
264
Generate an OTA update URL for a device.
265
266
Args:
267
id: Device ID
268
devicev2_otaurlpyalod: OTA URL generation payload
269
270
Returns:
271
ArduinoDevicev2Otaupload: OTA URL response
272
"""
273
```
274
275
### Device Password Management
276
277
Manage device authentication passwords.
278
279
```python { .api }
280
class DevicesV2PassApi:
281
def devices_v2_pass_get(self, id: str, suggest_password: bool = None) -> ArduinoDevicev2Pass:
282
"""
283
Get device password.
284
285
Args:
286
id: Device ID
287
suggest_password: Generate a suggested password
288
289
Returns:
290
ArduinoDevicev2Pass: Device password information
291
"""
292
293
def devices_v2_pass_set(self, id: str, devicev2_pass: Devicev2Pass) -> ArduinoDevicev2Pass:
294
"""
295
Set device password.
296
297
Args:
298
id: Device ID
299
devicev2_pass: Password payload
300
301
Returns:
302
ArduinoDevicev2Pass: Password confirmation
303
"""
304
305
def devices_v2_pass_check(self, id: str, check_devices_v2_pass_payload: CheckDevicesV2PassPayload) -> None:
306
"""
307
Check device password.
308
309
Args:
310
id: Device ID
311
check_devices_v2_pass_payload: Password check payload
312
"""
313
314
def devices_v2_pass_delete(self, id: str) -> None:
315
"""
316
Remove device password.
317
318
Args:
319
id: Device ID
320
"""
321
```
322
323
### Device Tag Management
324
325
Organize and categorize devices using tags.
326
327
```python { .api }
328
class DevicesV2TagsApi:
329
def devices_v2_tags_list(self, id: str) -> ArduinoTags:
330
"""
331
List device tags.
332
333
Args:
334
id: Device ID
335
336
Returns:
337
ArduinoTags: Device tags
338
"""
339
340
def devices_v2_tags_upsert(self, id: str, tag: Tag) -> None:
341
"""
342
Creates or updates a device tag.
343
344
Args:
345
id: Device ID
346
tag: Tag to create or update
347
"""
348
349
def devices_v2_tags_delete(self, id: str, key: str) -> None:
350
"""
351
Delete a device tag.
352
353
Args:
354
id: Device ID
355
key: Tag key to delete
356
"""
357
```
358
359
## Types
360
361
```python { .api }
362
class CreateDevicesV2Payload:
363
connection_type: str
364
fqbn: str
365
name: str
366
serial: str
367
soft_deleted: bool
368
type: str
369
user_id: str
370
wifi_fw_version: str
371
372
class ArduinoDevicev2:
373
connection_type: str
374
created_at: datetime
375
device_status: str
376
events: List[ArduinoDevicev2EventProperties]
377
fqbn: str
378
href: str
379
id: str
380
label: str
381
last_activity_at: datetime
382
linked_libraries: List[ArduinoLinkedvariable]
383
name: str
384
no_sketch: bool
385
organization_id: str
386
ota_available: bool
387
ota_compatible: bool
388
required_wifi_fw_version: str
389
serial: str
390
tags: Dict[str, str]
391
thing: ArduinoThing
392
type: str
393
user_id: str
394
wifi_fw_version: str
395
```