Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/methods-device/SDKPY-115 #36

Merged
merged 12 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
min_python_version = 3.7.0
max-line-length = 100
max-line-length = 140
ban-relative-imports = true
format-greedy = 1
inline-quotes = double
Expand All @@ -17,7 +17,9 @@ extend-ignore =
ANN101,
# ANN102: Missing type annotation for cls in classmethod
ANN102,
E722
E722,
BLK100,
# BLK100: Missing type annotation for public function
per-file-ignores =
# F401: Module imported by unused (non-implicit modules)
# TC002: Move third-party import '...' into a type-checking block
Expand Down
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,29 @@ If you have any questions, feel free to check our [Help Center](https://help.tag
### Insert Device Data

```python
from tagoio_sdk import Device
from tagoio_sdk import Resources

myDevice = Device({ "token": "my_device_token" })
result = myDevice.sendData({
resources = Resources()
resource.devices.sendDeviceData("myDeviceID", {
"variable": "temperature",
"unit": "F",
"value": 55,
"time": "2015-11-03 13:44:33",
"location": { "lat": 42.2974279, "lng": -85.628292 },
"location": {"lat": 42.2974279, "lng": -85.628292},
})
```

### Edit Device Data

```python
from tagoio_sdk import Device

myDevice = Device({"token": "my_device_token"})
result = myDevice.editData(
{
"id": "id_of_the_data_item",
"value": "123",
"time": "2022-04-01 12:34:56",
"location": {"lat": 42.2974279, "lng": -85.628292},
}
)
from tagoio_sdk import Resources

resources = Resource()
resource.devices.editDeviceData("myDeviceID", {
"id": "idOfTheRecord",
"value": "new value",
"unit": "new unit"
})
```

## Development Commands
Expand Down
4 changes: 2 additions & 2 deletions docs/source/Resources/Dashboards/Dashboard_Type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DashboardCreateInfo

**arrangement**: list[Arrangement]

**tags**: list[TagsObj]
**tags**: list[:ref:`TagsObj`]

**visible**: bool

Expand Down Expand Up @@ -183,7 +183,7 @@ WidgetResource

**Attributes:**

filter: list[TagsObj]
filter: list[:ref:`TagsObj`]

.. _DeviceResourceView:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/Resources/Devices/Devices_Type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ DeviceCreateInfoBasic
| **configuration_params**: Optional[list[ConfigurationParams]]
| [Optional] An array of configuration params

| **tags**: Optional[list[TagsObj]]
| **tags**: Optional[list[:ref:`TagsObj`]]
| [Optional] An array of tags

| **serie_number**: Optional[str]
Expand Down
74 changes: 74 additions & 0 deletions docs/source/Resources/Devices/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,77 @@ Retrieves a list of all tokens
"amount": 20,
"orderBy": "created_at,desc",
}

==========
sendDeviceData
==========

Send data to a device.

**Parameters:**

| **deviceID**: GenericID: str
| Device ID

| **data**: Union[:ref:`DataCreate`, list[:ref:`DataCreate`]]
| An array or one object with data to be send to TagoIO.

.. code-block::
:caption: **Example:**

from tagoio_sdk import Resources

resources = Resources()
resource.devices.sendDeviceData("myDeviceID", {
"variable": "temperature",
"unit": "F",
"value": 55,
"time": "2015-11-03 13:44:33",
"location": { "lat": 42.2974279, "lng": -85.628292 },
})

==========
editDeviceData
==========

Edit data in a device.

**Parameters:**

| **deviceID**: GenericID: str
| Device ID

| **updatedData**: Union[:ref:`DataEdit`, list[:ref:`DataEdit`]]
| An array or one object with data to be send to TagoIO.

.. code-block::
:caption: **Example:**

resources = Resource()
resource.devices.editDeviceData("myDeviceID", {
"id": "idOfTheRecord",
"value": "new value",
"unit": "new unit"
})

==========
deleteDeviceData
==========

Delete data from a device.

**Parameters:**

| **deviceID**: GenericID: str
| Device ID

| *Optional* **queryParams**: :ref:`DataQuery`
| Query parameters to filter the results.

.. code-block::
:caption: **Example:**

resources = Resource()
resource.devices.deleteDeviceData("myDeviceID", {
"ids": ["recordIdToDelete", "anotherRecordIdToDelete" ]
})
6 changes: 3 additions & 3 deletions docs/source/Resources/Run/Run_Types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ UserCreateInfo
| **company**: Optional[str]
| **phone**: Optional[str]
| **language**: Optional[str]
| **tags**: Optional[list[TagsObj]]
| **tags**: Optional[list[:ref:`TagsObj`]]
| **active**: Optional[bool]

.. _UserInfo:
Expand All @@ -282,7 +282,7 @@ UserInfo
| **company**: Optional[str]
| **phone**: Optional[str]
| **language**: Optional[str]
| **tags**: Optional[list[TagsObj]]
| **tags**: Optional[list[:ref:`TagsObj`]]
| **active**: Optional[bool]
| **id**: GenericID
| **profile**: GenericID
Expand All @@ -292,7 +292,7 @@ UserInfo
| **created_at**: datetime
| **updated_at**: datetime
| **options**: object
| **tags**: list[TagsObj]
| **tags**: list[:ref:`TagsObj`]

.. _LoginResponse:

Expand Down
Loading