Igloo supports several types of variables, in this guide we will se all the features of each type.

All types of variable support these fields:

  • developerOnly: if set to true the variable is only visible to the account of the producer (the user that created the thing) and not to the user that associated it with the claimCode nor the users they shared the thing with. We suggest you use developerOnly variables to store technical or diagnostic data that the end user wouldn’t understand
  • hidden: if set to true the variable will be hidden by default in the apps, the end user can change the hidden setting from the Aurora app. We suggest you use hidden variables to store secondary information that is not checked often
  • name: the name of the variable, shown as title of the tile in the apps
  • index: used to sort variables in the apps
  • value: stores the value of the variable
Variable

Many queries will return a generic Variable type that allows you to access only the fields supported by all variable types, for example

{
  thing(id:"{{thingId}}"){
    variables(limit:5){
      id
    }
  }
}

If you want to access a field that is unique to one type of variable, for example the precision field in float variables, you have to specify which type of variable you expect to receive

{
  thing(id:"{{thingId}}"){
    variables(limit:5){
      ...on FloatVariables{
        precision
      }
    }
  }
}
Float variables

The type FloatVariable represents a floating point number, for example the temperature measured now by a sensor. FloatVariable has some additional fields:

  • min: the minimum value your FloatValue can be (it is enforced when updating the value field), for example the min of light sensor measured light level could be 0
  • max: like min but for the maximum value
  • unitOfMeasurement: the unit you are measuring the value in, for example the unitOfMeasurement of a thermometer could be “°C”, it is used in the apps to display the value
  • precision: precision with which the value was measured, e.g. precision: 0.01 means that 0.01 is the least difference measurable. This is only for visualization purposes: the value field will be stored as passed even if it has greater precision than specified in the precision field.
  • userPermission: can be either READ_ONLY or READ_WRITE and specifies whether the end user that claimed the thing can change this value, for example a pressure measurement would be a READ_ONLY variable, while a READ_WRITE value could be the brightness of a smart lightbulb
String variables

The type StringVariable can represent any string, for example the status of your smart coffee machine (“Idle”, “Brewing” or “Coffee ready”). StringVariable‘s additional fields are:

  • userPermission: can be either READ_ONLY or READ_WRITE and specifies whether the end user that claimed the thing can change this value, the status of your thing could be a READ_ONLY value, while the text to display on a led sign could be a READ_WRITE value
  • maxChars: the maximum number of character the value field can have, mostly useful if your string is READ_WRITE
  • allowedValues: an array of the possible values for the value field (this will be enforced), for example the coffee flavor of our coffee machine
Boolean Variables

The type BooleanVariable is the simplest of them all, it’s used to represent a boolean value like the ON/OFF status of your thing. It’s only additional field is userPermission which behaves like the FloatValue‘s and StringValue‘s userPermission field.

Float series variables

The type FloatSeriesValue is used to store a series of float values measured over time, for example the UV radiation measured at 1 hour intervals for a week. It’s value field is an array of nodes, each node has a timestamp and a value.
In addition to the createFloatSeriesVariable and floatSeriesVariable mutations used to create and update the variable you can use createFloatSeriesNode and floatSeriesNode to create and update the nodes.
It supports the unitOfMeasurement, min, max and precision fields, they behave like the ones for float variables, but they are enforced on every node. In addition to those it has the following fields:

  • storedNodes: specifies how many nodes to keep in storage (excess nodes are automatically deleted in chronological order)
  • shownNodes: specifies how many nodes to show in the apps