roboto.domain.devices#

Submodules#

Package Contents#

class roboto.domain.devices.CreateDeviceRequest(/, **data)#

Bases: pydantic.BaseModel

Request payload to create a new device

Parameters:

data (Any)

device_id: str = None#
org_id: str | None = None#
class roboto.domain.devices.Device(record, roboto_client=None)#

A device is a non-human entity which can interact with Roboto on behalf of a specific organization. Each device is identified by a device_id, which is unique among all devices in the organization to which it belongs.

The most typical device is a robot which uploads its log data to Roboto, either directly from its on-board software stack, or indirectly through an automatic upload station or human-in-the-loop upload process. Its device ID may be a string that represents its serial number in a scheme native to its organization.

A dedicated uploader station which connects to many different robots and uploads data on their behalf could also be modeled as a device.

API access tokens can be allocated for devices, and these tokens can be used to authenticate Roboto requests made on behalf of a device.

Parameters:
classmethod create(device_id, caller_org_id=None, roboto_client=None)#

Registers a device with Roboto.

Parameters:
Return type:

Device

create_token(expiry_days=366, name=None, description=None)#
Parameters:
  • expiry_days (int)

  • name (Optional[str])

  • description (Optional[str])

Return type:

tuple[roboto.domain.tokens.Token, str]

property created: datetime.datetime#
Return type:

datetime.datetime

property created_by: str#
Return type:

str

delete()#

Deletes this device.

Return type:

None

property device_id: str#

This device’s ID. Device ID is a user-provided identifier for a device, which is unique within the device’s org.

Return type:

str

classmethod for_org(org_id, roboto_client=None)#

List all devices registered for a given org.

Parameters:
  • org_id (str) – The org to list devices for

  • roboto_client (Optional[roboto.http.RobotoClient]) – Common parameters required to construct any Device object

Returns:

A generator of Device objects. For orgs with a large number of devices, this may involve multiple service calls, and the generator will yield results as they become available.

Return type:

collections.abc.Generator[Device, None, None]

classmethod from_id(device_id, roboto_client=None, org_id=None)#
Parameters:
  • device_id (str) – The device ID to look up. See Device.device_id() for more details.

  • roboto_client (Optional[roboto.http.RobotoClient]) – Common parameters required to construct any Device object

  • org_id (Optional[str]) – The org to which the device belongs. If not specified by a caller who only belongs to one org, will default to the org_id of that org. If not specified by a caller who belongs to multiple orgs, will raise an exception.

Returns:

A Device object representing the specified device

Raises:

RobotoNotFoundException – If the specified device is not registered with Roboto

Return type:

Device

property modified: datetime.datetime#
Return type:

datetime.datetime

property modified_by: str#
Return type:

str

property org_id: str#

The ID of the org to which this device belongs.

Return type:

str

property record: roboto.domain.devices.record.DeviceRecord#

The underlying DeviceRecord object which represents this device. This is often used as the wire representation of a device during API requests, and is subject to evolve over time. You should not program against this if avoidable.

Return type:

roboto.domain.devices.record.DeviceRecord

tokens()#
Return type:

collections.abc.Sequence[roboto.domain.tokens.Token]

class roboto.domain.devices.DeviceRecord(/, **data)#

Bases: pydantic.BaseModel

A wire-transmissible representation of a device.

Parameters:

data (Any)

created: datetime.datetime = None#
created_by: str = None#
device_id: str = None#
modified: datetime.datetime = None#
modified_by: str = None#
org_id: str = None#