4.2.1.1. Tag

class wsapiwrapper.admin.tag.TagFormat(value)[source]

An enumeration.

FORMAT_HDC2021_TEMPONLY = 2
FORMAT_HDC2021_TRH = 1
class wsapiwrapper.admin.tag.TagWrapper(baseurl: str, adminapi_token: str)[source]

Wraps calls to tag endpoints on the Admin API.

__init__(baseurl: str, adminapi_token: str)[source]

Constructor for TagWrapper

Parameters
  • baseurl (str) – Websensor backend URL.

  • adminapi_token (str) – Token for accessing the admin API.

  • endpoint_one (str) – Endpoint for returning one resource instance.

  • endpoint_many (str) – Endpoint for returning a list of resource instances.

post(serial: str = None, secretkey: str = None, fwversion: str = None, hwversion: str = None, description: str = None)dict[source]

Make a POST request to the Tag endpoint.

Parameters
  • serial – Tag serial string (8 characters).

  • secretkey – Secret key (16 characters).

  • fwversion – Tag firmware version.

  • hwversion – Tag hardware version.

  • description – Tag description.

Returns

dict: A dictionary representing the new tag object.

simulate(tagid: int, frontendurl: str, nsamples: int = 100, smplintervalmins: int = 100, tagformat: wsapiwrapper.admin.tag.TagFormat = <TagFormat.FORMAT_HDC2021_TRH: 1>, usehmac: bool = False, batvoltagemv: int = 3000, bor: bool = False, svsh: bool = False, wdt: bool = False, misc: bool = False, lpm5wu: bool = False, clockfail: bool = False, tagerror: bool = False)str[source]

Make a GET request to the Tag simulate endpoint.

Parameters
  • tagid – Database ID of the tag to simulate.

  • frontendurl – URL of a cuplfrontend instance that will be contained in the simulated tag URL.

  • nsamples – Number of samples to put in the simulated tag URL.

  • smplintervalmins – Time interval between samples in minutes.

  • tagformat – Indicates the datatype for each sample.

  • usehmac – Specifies whether the hash is HMAC-MD5 or just MD5.

  • batvoltagemv – Battery voltage of the simulated tag in mV.

  • bor – Brown-out-Reset flag.

  • svsh – Supply Voltage Supervisor (high-side) reset flag.

  • wdt – Watchdog reset flag.

  • misc – Miscellaneous reset flag.

  • lpm5wu – Low power mode wake-up flag.

  • clockfail – Clock failure reset flag.

  • tagerror – Specify a tag error URL where the circular buffer is omitted.

Returns

A string containing a simulated tag URL

Return type

str