You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Get a Crownstone object by it's id, it's it exists.
218
223
224
+
#### async_close_session()
225
+
> Async function. This will close the websession in requestHandler to cleanup nicely after the program has finished.
226
+
227
+
#### reset()
228
+
> Reset the requestHandler parameters in case the cloud instance was cleaned up and needs to be recreated.
229
+
219
230
### Spheres
220
231
221
-
#### update()
222
-
> Async function. Sync the Spheres with the cloud. Doing this will replace all current sphere data with that of the cloud.
232
+
#### async_update_sphere_data()
233
+
> Async function. Sync the Spheres with the cloud. Calling the function again after init will update the current data.
223
234
224
235
#### find(sphere_name: String) -> Sphere
225
236
> Returns a sphere object if one exists by that name.
@@ -229,13 +240,13 @@ A User has the following fields in the cloud lib:
229
240
230
241
### Sphere
231
242
232
-
#### get_keys() -> Dict
243
+
#### async_get_keys() -> Dict
233
244
> Async function. Returns a dict with the keys of this sphere. The keys can be used for BLE connectivity with the Crownstones.
234
245
235
246
### Crownstones
236
247
237
-
#### update()
238
-
> Async function. Sync the Crownstones with the cloud for a sphere. Doing this will replace all the current crownstone data with that of the cloud.
248
+
#### async_update_crownstone_data()
249
+
> Async function. Sync the Crownstones with the cloud for a sphere. Calling the function again after init will update the current data.
239
250
240
251
#### find(crownstone_name: String) -> Crownstone
241
252
> Return a Crownstone object if one exists by that name.
@@ -245,19 +256,22 @@ A User has the following fields in the cloud lib:
245
256
246
257
### Crownstone
247
258
248
-
#### turn_on()
259
+
#### async_turn_on()
249
260
> Async function. Send a command to turn a Crownstone on. To make this work make sure to be in the selected sphere and have Bluetooth enabled on your phone.
250
261
251
-
#### turn_off()
262
+
#### async_turn_off()
252
263
> Async function. Send a command to turn a Crownstone off. To make this work make sure to be in the selected sphere and have Bluetooth enabled on your phone.
253
264
254
-
#### set_brightness(percentage: Int)
265
+
#### async_set_brightness(value: Float)
255
266
> Async function. Send a command to set a Crownstone to a given brightness level. To make this work make sure to be in the selected sphere and have Bluetooth enabled on your phone.
256
267
257
268
### Locations
258
269
259
-
#### update()
260
-
> Async function. Sync the Locations en present people in that location with the cloud for a sphere. Doing this will replace all the current location data with that of the cloud.
270
+
#### async_update_location_data()
271
+
> Async function. Sync the Locations with the cloud for a sphere. Calling the function again after init will update the current data.
272
+
273
+
#### async_update_location_presence()
274
+
> Async function. Sync the presence with the cloud. This will replace the current presence with the new presence.
261
275
262
276
#### find(location_name: String) -> Location
263
277
> Return a location object if one exists by that name.
@@ -267,8 +281,8 @@ A User has the following fields in the cloud lib:
267
281
268
282
### Users
269
283
270
-
#### update()
271
-
> Async function. Sync the Users with the cloud for a sphere. Doing this will replace all the current user data with that of the cloud.
284
+
#### async_update_user_data()
285
+
> Async function. Sync the Users with the cloud for a sphere. Calling the function again after init will update the current data.
272
286
273
287
#### find_by_first_name(first_name: String) -> List
274
288
> Returns a list of all users with that first name, as duplicate first names can exist.
@@ -281,15 +295,16 @@ A User has the following fields in the cloud lib:
281
295
282
296
## Async vs sync
283
297
The lib can be used synchonously and asynchronously.<br>
298
+
All async functions in the library API functions in this library have the prefix **async_**
284
299
Async functions need to be awaited:
285
300
```Python
286
-
await cloud.spheres.update()
301
+
await cloud.spheres.async_update_sphere_data()
287
302
```
288
303
All the async functions mentioned above can also be used synchronously.<br>
289
-
Simply type the same function name, but with underscore sync at the end. for example:
304
+
Sync functions don't have the async prefix. for example:
0 commit comments