Skip to content

TemperatureTextIndicator JSON

roosit edited this page Oct 16, 2026 · 2 revisions

TemperatureTextIndicator JSON

Up | Code | Русский

Purpose

This page describes the persisted format of the temperatureText indicator in a project, in a Mixel and in templates. For the user instructions on hand-editing .vttp, see the page Temperature Text JSON.

Two save modes

  • toJSON(false) — the real Mixel state: contains the selected source and sensor, the current property values, and the layer size and position.
  • toJSON(true) — the template state: contains values that can be carried between projects. The sensor property (Temperature) is saved in a template as an empty object {}: the source and the sensor are picked when the indicator is added to a project.

Common indicator wrapper

The layer identifier is built from the plugin uid and the indicator name:

{
  "name": "com.velitask.plagin.official.temperatureText",
  "data": {
    "properties": {}
  }
}
Part Value
plugin uid com.velitask.plagin.official
indicator name temperatureText

Real mixel state

In a real Mixel the layer size and position are stored next to properties. The exact shape of these State fields depends on the current runtime, so they are shown abbreviated. The sourceId.value and sensorId.value values are the numeric identifiers of the project's source and sensor, given below as an example.

{
  "name": "com.velitask.plagin.official.temperatureText",
  "data": {
    "size": { "...": "layer size state" },
    "positionInParent": { "...": "layer position state" },
    "properties": {
      "Temperature": {
        "sourceId": {"value": 1},
        "sensorId": {"value": 3}
      },
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "textAlign": {"value":4},
      "measurement": {"system":{"value":0},"format":{"value":0},"temperature":{"value":0}},
      "textTemplate": {"template":"{currNum} {currUnit}","vars":{"currNum":"%.1f","currUnit":"%s","celsius":"%.1f"}}
    }
  }
}

Template state

A template stores maket (here auto) instead of the size and position, and the sensor property is empty. The property values match the default values in the code.

{
  "name": "com.velitask.plagin.official.temperatureText",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Temperature": {},
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "textAlign": {"value":4},
      "measurement": {"system":{"value":0},"format":{"value":0},"temperature":{"value":0}},
      "textTemplate": {"template":"{currNum} {currUnit}","vars":{"currNum":"%.1f","currUnit":"%s","celsius":"%.1f"}}
    }
  }
}

Properties

JSON key Java property SDK type User meaning Default
Temperature mTemperature TemperatureAtomProperty The selected temperature sensor. An empty object in a template; sourceId/sensorId in a project.
font mText FontColorProperty The font and color of the text. name = Dialog, style = 0, size = 48, white color 255,255,255,255.
textAlign mTextAlign TextAlignProperty The position of the text inside the layer. 4 (CENTER).
measurement mUnits MeasurementProperty The measurement system, the unit label format and the temperature scale. system = 0, format = 0, temperature = 0.
textTemplate mTemplate TextTemplateProperty The string template with variables. {currNum} {currUnit}.

Formats of the nested values:

  • font — a flat object: name (string), style (number: 0 plain, 1 bold, 2 italic), size (integer, 1..999) and color (r, g, b, a, each 0..255).
  • textAlign — {"value": N}, N from 0 to 8 (the order is TOP_LEFT, TOP_CENTER, TOP_RIGHT, CENTER_LEFT, CENTER, CENTER_RIGHT, BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT). A value out of range is treated as CENTER_LEFT.
  • textTemplate — {"template": string, "vars": {name: format}}; the vars keys are variable names without braces.
  • measurement — three nested objects {"value": N}: system (0 from global settings, 1 metric, 2 imperial, 3 nautical, 4 mixed), format (0 full, 1 normal, 2 short, 3 symbol), temperature (0 Celsius, 1 Fahrenheit, 2 Kelvin).

Template variables (in the order of the makeText(...) arguments):

Variable Default format Meaning
{currNum} %.1f The temperature in the selected scale (curr.value()), a floating-point number.
{currUnit} %s The unit label for {currNum} (curr.unit()).
{celsius} %.1f The temperature in degrees Celsius regardless of the selected scale.

Examples

A template with the Fahrenheit scale, a symbol label and compact text:

{
  "name": "com.velitask.plagin.official.temperatureText",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Temperature": {},
      "font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
      "textAlign": {"value":4},
      "measurement": {"system":{"value":4},"format":{"value":3},"temperature":{"value":1}},
      "textTemplate": {"template":"{currNum}{currUnit}","vars":{"currNum":"%.1f","currUnit":"%s","celsius":"%.1f"}}
    }
  }
}

Here system.value = 4 is the mixed system, temperature.value = 1 is Fahrenheit, and format.value = 3 is the symbol label (°F).

Compatibility

  • VelitaskPlagin.getUID() (com.velitask.plagin.official) must not be changed without a migration of saved projects.
  • Indicator.getName() (temperatureText) must not be changed without a migration.
  • The property names (Temperature, font, textAlign, measurement, textTemplate) must not be renamed without a migration: loading goes by name.
  • The template variable names (currNum, currUnit, celsius) are part of the vars format; renaming breaks the saved formats.
  • The property order mostly affects the UI; renaming is more dangerous than reordering.

Clone this wiki locally