0
# Property Management
1
2
Real-time and historical property data management with timeseries support. Properties represent data points associated with IoT things that can be read, written, and monitored over time.
3
4
## Core Imports
5
6
```python
7
from iot_api_client.api import (
8
PropertiesV2Api,
9
PropertyTypesV1Api
10
)
11
from iot_api_client.models import (
12
ModelProperty,
13
PropertyValue,
14
ArduinoProperty,
15
ArduinoPropertytype,
16
ArduinoSeriesResponse
17
)
18
```
19
20
## Capabilities
21
22
### Property CRUD Operations
23
24
Core property management operations for creating, reading, updating, and deleting thing properties.
25
26
```python { .api }
27
class PropertiesV2Api:
28
def properties_v2_create(self, id: str, model_property: ModelProperty, x_organization: str = None) -> ArduinoProperty:
29
"""
30
Creates a property associated to the given thing.
31
32
Args:
33
id: Thing ID
34
model_property: Property creation payload
35
x_organization: Organization ID for organization-level access
36
37
Returns:
38
ArduinoProperty: Created property object
39
"""
40
41
def properties_v2_list(self, id: str, show_deleted: bool = None, x_organization: str = None) -> List[ArduinoProperty]:
42
"""
43
Returns the list of properties associated to the given thing.
44
45
Args:
46
id: Thing ID
47
show_deleted: Include deleted properties
48
x_organization: Organization ID for organization-level access
49
50
Returns:
51
List[ArduinoProperty]: List of property objects
52
"""
53
54
def properties_v2_show(self, id: str, pid: str, show_deleted: bool = None, x_organization: str = None) -> ArduinoProperty:
55
"""
56
Returns the property requested by the user.
57
58
Args:
59
id: Thing ID
60
pid: Property ID
61
show_deleted: Include deleted properties
62
x_organization: Organization ID for organization-level access
63
64
Returns:
65
ArduinoProperty: Property object
66
"""
67
68
def properties_v2_update(self, id: str, pid: str, model_property: ModelProperty, x_organization: str = None) -> ArduinoProperty:
69
"""
70
Updates a property associated to the given thing.
71
72
Args:
73
id: Thing ID
74
pid: Property ID
75
model_property: Property update payload
76
x_organization: Organization ID for organization-level access
77
78
Returns:
79
ArduinoProperty: Updated property object
80
"""
81
82
def properties_v2_delete(self, id: str, pid: str, force: bool = None, x_organization: str = None) -> None:
83
"""
84
Removes a property associated to the given thing.
85
86
Args:
87
id: Thing ID
88
pid: Property ID
89
force: Force deletion even if property has data
90
x_organization: Organization ID for organization-level access
91
"""
92
```
93
94
### Property Value Publishing
95
96
Publish real-time values to properties.
97
98
```python { .api }
99
class PropertiesV2Api:
100
def properties_v2_publish(self, id: str, pid: str, property_value: PropertyValue, x_organization: str = None) -> None:
101
"""
102
Publish a property value to Arduino IoT Cloud.
103
104
Args:
105
id: Thing ID
106
pid: Property ID
107
property_value: Value to publish
108
x_organization: Organization ID for organization-level access
109
"""
110
```
111
112
### Timeseries Data Access
113
114
Retrieve historical property data with flexible time ranges and aggregation options.
115
116
```python { .api }
117
class PropertiesV2Api:
118
def properties_v2_timeseries(self, id: str, pid: str, desc: bool = None, start: str = None, end: str = None, interval: int = None, x_organization: str = None) -> ArduinoSeriesResponse:
119
"""
120
Get property timeseries data.
121
122
Args:
123
id: Thing ID
124
pid: Property ID
125
desc: Sort results in descending order
126
start: Start timestamp (RFC3339 format)
127
end: End timestamp (RFC3339 format)
128
interval: Aggregation interval in seconds
129
x_organization: Organization ID for organization-level access
130
131
Returns:
132
ArduinoSeriesResponse: Timeseries data
133
"""
134
```
135
136
### Property Types
137
138
Discover available property types for creating properties.
139
140
```python { .api }
141
class PropertyTypesV1Api:
142
def property_types_v1_list_types(self) -> List[ArduinoPropertytype]:
143
"""
144
Returns the list of available property types.
145
146
Returns:
147
List[ArduinoPropertytype]: Available property types
148
"""
149
```
150
151
## Usage Examples
152
153
### Creating a Property
154
155
```python
156
from iot_api_client.models import ModelProperty
157
158
# Create a temperature property
159
temperature_property = ModelProperty(
160
name="temperature",
161
type="FLOAT",
162
permission="READ_WRITE",
163
variable_name="temp",
164
persist=True,
165
tag=1,
166
update_strategy="ON_CHANGE",
167
min_delta=0.1
168
)
169
170
property_obj = properties_api.properties_v2_create("thing-id", temperature_property)
171
print(f"Created property: {property_obj.name} (ID: {property_obj.id})")
172
```
173
174
### Publishing Property Values
175
176
```python
177
from iot_api_client.models import PropertyValue
178
from datetime import datetime
179
180
# Publish a temperature reading
181
value = PropertyValue(
182
value=23.5,
183
created_at=datetime.utcnow()
184
)
185
186
properties_api.properties_v2_publish("thing-id", "property-id", value)
187
```
188
189
### Retrieving Timeseries Data
190
191
```python
192
from datetime import datetime, timedelta
193
194
# Get last 24 hours of data with 1-hour intervals
195
end_time = datetime.utcnow()
196
start_time = end_time - timedelta(days=1)
197
198
timeseries = properties_api.properties_v2_timeseries(
199
"thing-id",
200
"property-id",
201
start=start_time.isoformat() + "Z",
202
end=end_time.isoformat() + "Z",
203
interval=3600 # 1 hour in seconds
204
)
205
206
for data_point in timeseries.data:
207
print(f"Time: {data_point.timestamp}, Value: {data_point.value}")
208
```
209
210
### Getting Available Property Types
211
212
```python
213
# List all available property types
214
property_types = property_types_api.property_types_v1_list_types()
215
216
for prop_type in property_types:
217
print(f"Type: {prop_type.type}, Description: {prop_type.description}")
218
```
219
220
## Types
221
222
```python { .api }
223
class ModelProperty:
224
max_value: float
225
min_value: float
226
name: str
227
permission: str # "READ", "WRITE", "READ_WRITE"
228
persist: bool
229
tag: int
230
type: str # Property type (FLOAT, INT, BOOL, STRING, etc.)
231
update_parameter: float
232
update_strategy: str # "ON_CHANGE", "TIMED"
233
variable_name: str
234
min_delta: float
235
236
class PropertyValue:
237
value: Any
238
created_at: datetime
239
240
class ArduinoProperty:
241
created_at: datetime
242
deleted_at: datetime
243
href: str
244
id: str
245
last_value: Any
246
linked_variables: List[ArduinoLinkedvariable]
247
max_value: float
248
min_value: float
249
name: str
250
persist: bool
251
permission: str
252
tag: int
253
thing_id: str
254
type: str
255
update_parameter: float
256
update_strategy: str
257
updated_at: datetime
258
variable_name: str
259
260
class ArduinoPropertytype:
261
type: str
262
description: str
263
264
class ArduinoSeriesResponse:
265
count_values: int
266
data: List[TimeseriesDataPoint]
267
from_date: datetime
268
interval: int
269
message: str
270
query: str
271
resp_version: int
272
series_limit: int
273
sort: str
274
status: str
275
times: List[str]
276
to_date: datetime
277
values: List[Any]
278
279
class TimeseriesDataPoint:
280
timestamp: str
281
value: Any
282
```