Text
The virtual Text
component is used to store a string value. It uses Text
as RPC namespace and has the following methods:
Text.SetConfig
to update the component's configurationText.GetConfig
to obtain the component's configurationText.GetStatus
to obtain the component's statusText.Set
to update the component's value
Methods
Text.SetConfig
Property | Type | Description |
---|---|---|
| number | Id of the component instance |
| object | Configuration that the method takes |
Find more about the config properties in config section
Text.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the component instance |
Find the Text.GetConfig response properties in config section
Text.GetStatus
Properties:
Property | Type | Description |
---|---|---|
| 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:
Property | Type | Description |
---|---|---|
| number | Id of the Text component instance. Required |
| 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:
Property | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the component instance | ||||||||||||
| string or null | Name of the component instance | ||||||||||||
| boolean |
| ||||||||||||
| string | String, applied on reboot if | ||||||||||||
| object | Object for storing meta data |
| object | Properties of how the component will be rendered in the UI
|
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:
Property | Type | Description |
---|---|---|
| string | Source of the last command |
| string | Value of the component |
| 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
- Text.SetConfig HTTP GET Request
- Text.SetConfig Curl Request
- Text.SetConfig Mos Request
http://192.168.33.1/rpc/Text.SetConfig?id=200&config={"name":"City name","meta":{"ui":{"view":"label"}}}
curl -X POST -d '{"id":1,"method":"Text.SetConfig","params":{"id":200,"config":{"name":"City name","meta":{"ui":{"view":"label"}}}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Text.SetConfig '{"id":200,"config":{"name":"City name","meta":{"ui":{"view":"label"}}}}'
Response
- Text.SetConfig HTTP GET Response
- Text.SetConfig Curl Response
- Text.SetConfig Mos Response
{
"restart_required": false
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"restart_required": false
}
}
{
"restart_required": false
}
Text.GetConfig example
- Text.GetConfig HTTP GET Request
- Text.GetConfig Curl Request
- Text.GetConfig Mos Request
http://192.168.33.1/rpc/Text.GetConfig?id=200
curl -X POST -d '{"id":1,"method":"Text.GetConfig","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Text.GetConfig '{"id":200}'
Response
- Text.GetConfig HTTP GET Response
- Text.GetConfig Curl Response
- Text.GetConfig Mos Response
{
"id": 200,
"name": "",
"max_len": 255,
"meta": {
"ui": {
"name": "City name",
"view": "label"
}
},
"persisted": false,
"default_value": "Sofia"
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"id": 200,
"name": "",
"max_len": 255,
"meta": {
"ui": {
"name": "City name",
"view": "label"
}
},
"persisted": false,
"default_value": "Sofia"
}
}
{
"id": 200,
"name": "",
"max_len": 255,
"meta": {
"ui": {
"name": "City name",
"view": "label"
}
},
"persisted": false,
"default_value": "Sofia"
}
Text.GetStatus example
- Text.GetStatus HTTP GET Request
- Text.GetStatus Curl Request
- Text.GetStatus Mos Request
http://192.168.33.1/rpc/Text.GetStatus?id=200
curl -X POST -d '{"id":1,"method":"Text.GetStatus","params":{"id":200}}' http://${SHELLY}/rpc
mos --port ${PORT} call Text.GetStatus '{"id":200}'
Response
- Text.GetStatus HTTP GET Response
- Text.GetStatus Curl Response
- Text.GetStatus Mos Response
{
"value": "Miami",
"source": "rpc",
"last_update_ts": 1700864253
}
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": {
"value": "Miami",
"source": "rpc",
"last_update_ts": 1700864253
}
}
{
"value": "Miami",
"source": "rpc",
"last_update_ts": 1700864253
}
Text.Set example
- Text.Set HTTP GET Request
- Text.Set Curl Request
- Text.Set Mos Request
http://192.168.33.1/rpc/Text.Set?id=200&value="Miami"
curl -X POST -d '{"id":1,"method":"Text.Set","params":{"id":200,"value":"Miami"}}' http://${SHELLY}/rpc
mos --port ${PORT} call Text.Set '{"id":200,"value":"Miami"}'
Response
- Text.Set HTTP GET Response
- Text.Set Curl Response
- Text.Set Mos Response
null
{
"id": 1,
"src": "shelly1pmminig3-84fce63fe000",
"params": null
}
null