Skip to main content
Version: 1.0

Text

The virtual Text component is used to store a string value. It uses Text as RPC namespace and has the following methods:

Methods

Text.SetConfig

PropertyTypeDescription

id

number

Id of the component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

Text.GetConfig

Properties:

PropertyTypeDescription

id

number

Id of the component instance

Find the Text.GetConfig response properties in config section

Text.GetStatus

Properties:

PropertyTypeDescription

id

number

Id of the component instance

Find more about the status response properties in status section

Text.Set

This method updates the value of the Text component. It can be used to trigger webhooks. More information about the events triggering webhooks available for this component can be found below.

Request

Parameters:

PropertyTypeDescription

id

number

Id of the Text component instance. Required

value

string

String to be saved Required

Configuration

The configuration of the Text component contains information about the default value, whether it should persist after reboot, and properties of how it will be rendered in the UI. To Get/Set the configuration of the Text component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the component instance

name

string or null

Name of the component instance

persisted

boolean

true for the value to be persist, default false

default_value

string

String, applied on reboot if persisted is set to false

meta

object

Object for storing meta data

ui

object

Properties of how the component will be rendered in the UI

PropertyTypeDescription

view

string

Specifies the type of card used for showing the component. Supported values: "" (empty string), field, image, label.

icon

string or null

Allows setting custom icon for the component's card by providing an external hosted image via link.

info
  • "" (empty string): The component does not have a card;
  • "field": Card with a input field;
  • "image": Card that interprets the current value as url and shows its content (used for displaying images);
  • "label": Card showing the title for the value.

Status

The status of the Text component contains information about its current value, the timestamp for the value update, and the source of the last command. To obtain the status of the Text component its id must be specified.

Properties:

PropertyTypeDescription

source

string

Source of the last command

value

string

Value of the component

last_update_ts

number

Unix timestamp for the value update

Webhook Events

Currently, there is one event related to the Text component that can trigger webhooks:

  • text.change - produced when the value changes.

Examples

Text.SetConfig example

http://192.168.33.1/rpc/Text.SetConfig?id=200&config={"name":"City name","meta":{"ui":{"view":"label"}}}

Response

{
"restart_required": false
}

Text.GetConfig example

http://192.168.33.1/rpc/Text.GetConfig?id=200

Response

{
"id": 200,
"name": "",
"max_len": 255,
"meta": {
"ui": {
"name": "City name",
"view": "label"
}
},
"persisted": false,
"default_value": "Sofia"
}

Text.GetStatus example

http://192.168.33.1/rpc/Text.GetStatus?id=200

Response

{
"value": "Miami",
"source": "rpc",
"last_update_ts": 1700864253
}

Text.Set example

http://192.168.33.1/rpc/Text.Set?id=200&value="Miami"

Response

null