CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-arduino-iot-client

Arduino IoT Cloud API Python Client for managing devices, things, properties, and timeseries data

Overview
Eval results
Files

things.mddocs/

Thing Management

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.

Core Imports

from iot_api_client.api import (
    ThingsV2Api,
    ThingsV2TagsApi,
    TemplatesApi
)
from iot_api_client.models import (
    ThingCreate,
    ThingUpdate,
    ThingClone,
    ThingSketch,
    UpdateSketch,
    ArduinoThing,
    ArduinoThingtemplate,
    Template,
    Tag
)

Capabilities

Thing CRUD Operations

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

class ThingsV2Api:
    def things_v2_create(self, thing_create: ThingCreate, force: bool = None, x_organization: str = None) -> ArduinoThing:
        """
        Creates a new thing.

        Args:
            thing_create: Thing creation payload
            force: Force creation even if validation fails
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThing: Created thing object
        """

    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]:
        """
        Returns the list of things associated to the user.

        Args:
            across_user_ids: Search across all user IDs
            device_id: Filter by device ID
            ids: List of specific thing IDs to retrieve
            show_deleted: Include deleted things
            show_properties: Include thing properties
            tags: Filter by tags
            x_organization: Organization ID for organization-level access

        Returns:
            List[ArduinoThing]: List of thing objects
        """

    def things_v2_show(self, id: str, show_deleted: bool = None, x_organization: str = None) -> ArduinoThing:
        """
        Returns the thing requested by the user.

        Args:
            id: Thing ID
            show_deleted: Include deleted properties
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThing: Thing object
        """

    def things_v2_update(self, id: str, thing_update: ThingUpdate, force: bool = None, x_organization: str = None) -> ArduinoThing:
        """
        Updates a thing associated to the user.

        Args:
            id: Thing ID
            thing_update: Thing update payload
            force: Force update even if validation fails
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThing: Updated thing object
        """

    def things_v2_delete(self, id: str, x_organization: str = None) -> None:
        """
        Removes a thing associated to the user.

        Args:
            id: Thing ID
            x_organization: Organization ID for organization-level access
        """

Thing Cloning

Clone existing things with their properties and configurations.

class ThingsV2Api:
    def things_v2_clone(self, id: str, thing_clone: ThingClone, x_organization: str = None) -> ArduinoThing:
        """
        Clone a given thing.

        Args:
            id: Thing ID to clone
            thing_clone: Clone configuration payload
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThing: Cloned thing object
        """

Sketch Management

Generate and manage Arduino sketches for things.

class ThingsV2Api:
    def things_v2_create_sketch(self, id: str, thing_sketch: ThingSketch = None, x_organization: str = None) -> ArduinoThing:
        """
        Creates a new sketch thing.

        Args:
            id: Thing ID
            thing_sketch: Sketch creation configuration
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThing: Thing with generated sketch
        """

    def things_v2_update_sketch(self, id: str, update_sketch: UpdateSketch, x_organization: str = None) -> ArduinoThing:
        """
        Update an existing thing sketch.

        Args:
            id: Thing ID
            update_sketch: Sketch update payload
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThing: Thing with updated sketch
        """

    def things_v2_delete_sketch(self, id: str, x_organization: str = None) -> ArduinoThing:
        """
        Removes the sketch from the thing.

        Args:
            id: Thing ID
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThing: Thing without sketch
        """

Template Operations

Generate and apply templates for things.

class ThingsV2Api:
    def things_v2_template(self, id: str, x_organization: str = None) -> ArduinoThingtemplate:
        """
        Extract template from the given thing.

        Args:
            id: Thing ID
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThingtemplate: Thing template
        """

class TemplatesApi:
    def templates_apply(self, id: str, template: Template, x_organization: str = None) -> ArduinoThing:
        """
        Apply template to a thing.

        Args:
            id: Thing ID
            template: Template to apply
            x_organization: Organization ID for organization-level access

        Returns:
            ArduinoThing: Thing with applied template
        """

Thing Tag Management

Organize and categorize things using tags.

class ThingsV2TagsApi:
    def things_v2_tags_list(self, id: str) -> ArduinoTags:
        """
        List thing tags.

        Args:
            id: Thing ID

        Returns:
            ArduinoTags: Thing tags
        """

    def things_v2_tags_upsert(self, id: str, tag: Tag) -> None:
        """
        Creates or updates a thing tag.

        Args:
            id: Thing ID
            tag: Tag to create or update
        """

    def things_v2_tags_delete(self, id: str, key: str) -> None:
        """
        Delete a thing tag.

        Args:
            id: Thing ID
            key: Tag key to delete
        """

Usage Examples

Creating a Thing

from iot_api_client.models import ThingCreate

thing_data = ThingCreate(
    name="My IoT Device",
    description="Temperature and humidity sensor",
    device_id="device-123",
    timezone="Europe/Rome"
)

thing = things_api.things_v2_create(thing_data)
print(f"Created thing: {thing.name} (ID: {thing.id})")

Cloning a Thing

from iot_api_client.models import ThingClone

clone_config = ThingClone(
    name="Cloned Thing",
    description="Copy of original thing",
    include_tags=True
)

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

Generating a Sketch

from iot_api_client.models import ThingSketch

sketch_config = ThingSketch(
    sketch_name="MySketch",
    ota_compatible=True
)

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

Types

class ThingCreate:
    name: str
    description: str
    device_id: str
    id: str
    properties: List[ModelProperty]
    tags: Dict[str, str]
    timezone: str
    webhook_active: bool
    webhook_uri: str

class ThingUpdate:
    description: str
    name: str
    properties: List[ModelProperty]
    tags: Dict[str, str]
    timezone: str
    webhook_active: bool
    webhook_uri: str

class ThingClone:
    include_tags: bool
    name: str
    description: str

class ArduinoThing:
    created_at: datetime
    deleted_at: datetime
    description: str
    device_id: str
    href: str
    id: str
    name: str
    organization_id: str
    properties: List[ArduinoProperty]
    properties_count: int
    sketch_id: str
    tags: Dict[str, str]
    timezone: str
    updated_at: datetime
    user_id: str
    variables_count: int
    webhook_active: bool
    webhook_uri: str

class ArduinoThingtemplate:
    description: str
    name: str
    properties: List[ArduinoTemplateproperty]
    tags: Dict[str, str]
    timezone: str

Install with Tessl CLI

npx tessl i tessl/pypi-arduino-iot-client

docs

dashboards.md

devices.md

index.md

lora.md

properties.md

series.md

things.md

tile.json