Skip to content

Commit 4393c95

Browse files
authored
Merge pull request #171 from samson0v/master
Updated REST client to 3.9
2 parents 172d302 + 5f47e4a commit 4393c95

File tree

1,122 files changed

+10904
-2145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,122 files changed

+10904
-2145
lines changed

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

examples/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

examples/configure_vcs_access.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

examples/example_application.py

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
2323
datefmt='%Y-%m-%d %H:%M:%S')
2424

2525
# ThingsBoard REST API URL
26-
url = "http://localhost:8080"
26+
url = "http://192.168.1.201:8380"
2727

2828
# Default Tenant Administrator credentials
2929
username = "[email protected]"
@@ -37,34 +37,38 @@ def main():
3737
# Auth with credentials
3838
rest_client.login(username=username, password=password)
3939

40-
# Creating an Asset
41-
default_asset_profile_id = rest_client.get_default_asset_profile_info().id
42-
asset = Asset(name="Building 1", label="Building 1",
43-
asset_profile_id=default_asset_profile_id)
44-
asset = rest_client.save_asset(asset)
45-
46-
logging.info("Asset was created:\n%r\n", asset)
47-
48-
# Creating a Device
49-
# Also, you can use default Device Profile:
50-
# default_device_profile_id = rest_client.get_default_device_profile_info().id
51-
device_profile = DeviceProfile(name="Thermometer",
52-
type="DEFAULT",
53-
transport_type="DEFAULT",
54-
profile_data=DeviceProfileData(configuration={"type": "DEFAULT"},
55-
transport_configuration={"type": "DEFAULT"}))
56-
device_profile = rest_client.save_device_profile(device_profile)
57-
device = Device(name="Thermometer 1", label="Thermometer 1",
58-
device_profile_id=device_profile.id)
59-
device = rest_client.save_device(device)
40+
print(rest_client.save_device_attributes(DeviceId('34416c10-bba7-11ef-9c05-3598fcc4571c', 'DEVICE'), 'SHARED_SCOPE', {'temperature': 45.0}))
6041

61-
logging.info(" Device was created:\n%r\n", device)
62-
63-
# Creating relations from device to asset
64-
relation = EntityRelation(_from=asset.id, to=device.id, type="Contains")
65-
rest_client.save_relation(relation)
66-
67-
logging.info(" Relation was created:\n%r\n", relation)
42+
# Creating an Asset
43+
# default_asset_profile_id = rest_client.get_default_asset_profile_info().id
44+
# asset = Asset(name="Building 1", label="Building 1",
45+
# asset_profile_id=default_asset_profile_id)
46+
# asset = rest_client.save_asset(asset)
47+
#
48+
# logging.info("Asset was created:\n%r\n", asset)
49+
#
50+
# rest_client.process_devices_bulk_import()
51+
#
52+
# # Creating a Device
53+
# # Also, you can use default Device Profile:
54+
# # default_device_profile_id = rest_client.get_default_device_profile_info().id
55+
# device_profile = DeviceProfile(name="Thermometer",
56+
# type="DEFAULT",
57+
# transport_type="DEFAULT",
58+
# profile_data=DeviceProfileData(configuration={"type": "DEFAULT"},
59+
# transport_configuration={"type": "DEFAULT"}))
60+
# device_profile = rest_client.save_device_profile(device_profile)
61+
# device = Device(name="Thermometer 1", label="Thermometer 1",
62+
# device_profile_id=device_profile.id)
63+
# device = rest_client.save_device(device)
64+
#
65+
# logging.info(" Device was created:\n%r\n", device)
66+
#
67+
# # Creating relations from device to asset
68+
# relation = EntityRelation(_from=asset.id, to=device.id, type="Contains")
69+
# rest_client.save_relation(relation)
70+
#
71+
# logging.info(" Relation was created:\n%r\n", relation)
6872
except ApiException as e:
6973
logging.exception(e)
7074

examples/example_application_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

examples/load_all_entities_from_vcs_ce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

examples/load_all_entities_from_vcs_pe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

examples/load_all_entities_to_vcs_ce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

examples/load_all_entities_to_vcs_pe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

examples/version_control_complex_example_ce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024. ThingsBoard
1+
# Copyright 2025. ThingsBoard
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)