Repository navigation
TemperatureTextIndicator JSON
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.
-
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.
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 |
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"}}
}
}
}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"}}
}
}
}| 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:0plain,1bold,2italic),size(integer,1..999) andcolor(r,g,b,a, each0..255). -
textAlign—{"value": N},Nfrom0to8(the order isTOP_LEFT,TOP_CENTER,TOP_RIGHT,CENTER_LEFT,CENTER,CENTER_RIGHT,BOTTOM_LEFT,BOTTOM_CENTER,BOTTOM_RIGHT). A value out of range is treated asCENTER_LEFT. -
textTemplate—{"template": string, "vars": {name: format}}; thevarskeys are variable names without braces. -
measurement— three nested objects{"value": N}:system(0from global settings,1metric,2imperial,3nautical,4mixed),format(0full,1normal,2short,3symbol),temperature(0Celsius,1Fahrenheit,2Kelvin).
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. |
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).
-
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 thevarsformat; renaming breaks the saved formats. - The property order mostly affects the UI; renaming is more dangerous than reordering.