or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

dashboards.mddevices.mdindex.mdlora.mdproperties.mdseries.mdthings.md

things.mddocs/

0

# Thing Management

1

2

Management of IoT things including creation, cloning, sketch generation, template operations, and tagging. Things represent logical IoT entities that can have properties and be linked to devices.

3

4

## Core Imports

5

6

```python

7

from iot_api_client.api import (

8

ThingsV2Api,

9

ThingsV2TagsApi,

10

TemplatesApi

11

)

12

from iot_api_client.models import (

13

ThingCreate,

14

ThingUpdate,

15

ThingClone,

16

ThingSketch,

17

UpdateSketch,

18

ArduinoThing,

19

ArduinoThingtemplate,

20

Template,

21

Tag

22

)

23

```

24

25

## Capabilities

26

27

### Thing CRUD Operations

28

29

Core thing management operations for creating, reading, updating, and deleting IoT things.

30

31

```python { .api }

32

class ThingsV2Api:

33

def things_v2_create(self, thing_create: ThingCreate, force: bool = None, x_organization: str = None) -> ArduinoThing:

34

"""

35

Creates a new thing.

36

37

Args:

38

thing_create: Thing creation payload

39

force: Force creation even if validation fails

40

x_organization: Organization ID for organization-level access

41

42

Returns:

43

ArduinoThing: Created thing object

44

"""

45

46

def things_v2_list(self, across_user_ids: bool = None, device_id: str = None, ids: List[str] = None, show_deleted: bool = None, show_properties: bool = None, tags: List[str] = None, x_organization: str = None) -> List[ArduinoThing]:

47

"""

48

Returns the list of things associated to the user.

49

50

Args:

51

across_user_ids: Search across all user IDs

52

device_id: Filter by device ID

53

ids: List of specific thing IDs to retrieve

54

show_deleted: Include deleted things

55

show_properties: Include thing properties

56

tags: Filter by tags

57

x_organization: Organization ID for organization-level access

58

59

Returns:

60

List[ArduinoThing]: List of thing objects

61

"""

62

63

def things_v2_show(self, id: str, show_deleted: bool = None, x_organization: str = None) -> ArduinoThing:

64

"""

65

Returns the thing requested by the user.

66

67

Args:

68

id: Thing ID

69

show_deleted: Include deleted properties

70

x_organization: Organization ID for organization-level access

71

72

Returns:

73

ArduinoThing: Thing object

74

"""

75

76

def things_v2_update(self, id: str, thing_update: ThingUpdate, force: bool = None, x_organization: str = None) -> ArduinoThing:

77

"""

78

Updates a thing associated to the user.

79

80

Args:

81

id: Thing ID

82

thing_update: Thing update payload

83

force: Force update even if validation fails

84

x_organization: Organization ID for organization-level access

85

86

Returns:

87

ArduinoThing: Updated thing object

88

"""

89

90

def things_v2_delete(self, id: str, x_organization: str = None) -> None:

91

"""

92

Removes a thing associated to the user.

93

94

Args:

95

id: Thing ID

96

x_organization: Organization ID for organization-level access

97

"""

98

```

99

100

### Thing Cloning

101

102

Clone existing things with their properties and configurations.

103

104

```python { .api }

105

class ThingsV2Api:

106

def things_v2_clone(self, id: str, thing_clone: ThingClone, x_organization: str = None) -> ArduinoThing:

107

"""

108

Clone a given thing.

109

110

Args:

111

id: Thing ID to clone

112

thing_clone: Clone configuration payload

113

x_organization: Organization ID for organization-level access

114

115

Returns:

116

ArduinoThing: Cloned thing object

117

"""

118

```

119

120

### Sketch Management

121

122

Generate and manage Arduino sketches for things.

123

124

```python { .api }

125

class ThingsV2Api:

126

def things_v2_create_sketch(self, id: str, thing_sketch: ThingSketch = None, x_organization: str = None) -> ArduinoThing:

127

"""

128

Creates a new sketch thing.

129

130

Args:

131

id: Thing ID

132

thing_sketch: Sketch creation configuration

133

x_organization: Organization ID for organization-level access

134

135

Returns:

136

ArduinoThing: Thing with generated sketch

137

"""

138

139

def things_v2_update_sketch(self, id: str, update_sketch: UpdateSketch, x_organization: str = None) -> ArduinoThing:

140

"""

141

Update an existing thing sketch.

142

143

Args:

144

id: Thing ID

145

update_sketch: Sketch update payload

146

x_organization: Organization ID for organization-level access

147

148

Returns:

149

ArduinoThing: Thing with updated sketch

150

"""

151

152

def things_v2_delete_sketch(self, id: str, x_organization: str = None) -> ArduinoThing:

153

"""

154

Removes the sketch from the thing.

155

156

Args:

157

id: Thing ID

158

x_organization: Organization ID for organization-level access

159

160

Returns:

161

ArduinoThing: Thing without sketch

162

"""

163

```

164

165

### Template Operations

166

167

Generate and apply templates for things.

168

169

```python { .api }

170

class ThingsV2Api:

171

def things_v2_template(self, id: str, x_organization: str = None) -> ArduinoThingtemplate:

172

"""

173

Extract template from the given thing.

174

175

Args:

176

id: Thing ID

177

x_organization: Organization ID for organization-level access

178

179

Returns:

180

ArduinoThingtemplate: Thing template

181

"""

182

183

class TemplatesApi:

184

def templates_apply(self, id: str, template: Template, x_organization: str = None) -> ArduinoThing:

185

"""

186

Apply template to a thing.

187

188

Args:

189

id: Thing ID

190

template: Template to apply

191

x_organization: Organization ID for organization-level access

192

193

Returns:

194

ArduinoThing: Thing with applied template

195

"""

196

```

197

198

### Thing Tag Management

199

200

Organize and categorize things using tags.

201

202

```python { .api }

203

class ThingsV2TagsApi:

204

def things_v2_tags_list(self, id: str) -> ArduinoTags:

205

"""

206

List thing tags.

207

208

Args:

209

id: Thing ID

210

211

Returns:

212

ArduinoTags: Thing tags

213

"""

214

215

def things_v2_tags_upsert(self, id: str, tag: Tag) -> None:

216

"""

217

Creates or updates a thing tag.

218

219

Args:

220

id: Thing ID

221

tag: Tag to create or update

222

"""

223

224

def things_v2_tags_delete(self, id: str, key: str) -> None:

225

"""

226

Delete a thing tag.

227

228

Args:

229

id: Thing ID

230

key: Tag key to delete

231

"""

232

```

233

234

## Usage Examples

235

236

### Creating a Thing

237

238

```python

239

from iot_api_client.models import ThingCreate

240

241

thing_data = ThingCreate(

242

name="My IoT Device",

243

description="Temperature and humidity sensor",

244

device_id="device-123",

245

timezone="Europe/Rome"

246

)

247

248

thing = things_api.things_v2_create(thing_data)

249

print(f"Created thing: {thing.name} (ID: {thing.id})")

250

```

251

252

### Cloning a Thing

253

254

```python

255

from iot_api_client.models import ThingClone

256

257

clone_config = ThingClone(

258

name="Cloned Thing",

259

description="Copy of original thing",

260

include_tags=True

261

)

262

263

cloned_thing = things_api.things_v2_clone("original-thing-id", clone_config)

264

```

265

266

### Generating a Sketch

267

268

```python

269

from iot_api_client.models import ThingSketch

270

271

sketch_config = ThingSketch(

272

sketch_name="MySketch",

273

ota_compatible=True

274

)

275

276

thing_with_sketch = things_api.things_v2_create_sketch("thing-id", sketch_config)

277

```

278

279

## Types

280

281

```python { .api }

282

class ThingCreate:

283

name: str

284

description: str

285

device_id: str

286

id: str

287

properties: List[ModelProperty]

288

tags: Dict[str, str]

289

timezone: str

290

webhook_active: bool

291

webhook_uri: str

292

293

class ThingUpdate:

294

description: str

295

name: str

296

properties: List[ModelProperty]

297

tags: Dict[str, str]

298

timezone: str

299

webhook_active: bool

300

webhook_uri: str

301

302

class ThingClone:

303

include_tags: bool

304

name: str

305

description: str

306

307

class ArduinoThing:

308

created_at: datetime

309

deleted_at: datetime

310

description: str

311

device_id: str

312

href: str

313

id: str

314

name: str

315

organization_id: str

316

properties: List[ArduinoProperty]

317

properties_count: int

318

sketch_id: str

319

tags: Dict[str, str]

320

timezone: str

321

updated_at: datetime

322

user_id: str

323

variables_count: int

324

webhook_active: bool

325

webhook_uri: str

326

327

class ArduinoThingtemplate:

328

description: str

329

name: str

330

properties: List[ArduinoTemplateproperty]

331

tags: Dict[str, str]

332

timezone: str

333

```