Jump to content

Virtual components - API (1.0)


Dimitar

Recommended Posts

Virtual Components

Virtual components are a special set of components that do not exist in the device initially and are created dynamically by the user.

All virtual components use the general component interface, which means that they can be accessed using the standard methods <Component>.GetStatus, <Component>.GetConfig, and <Component>.SetConfig.

Creation and deletion of components is done through 2 methods from the Virtual namespace.

There is a limit of 10 instances per device. IDs for these components start from 200 and are limited to 299.

A list with all virtual components can be fetched only by Shelly.GetComponents method.

Available virtual components:

Interaction with virtual components

Virtual components are used to store/transfer data between scripts or runs, but they provide the possibility for the user to interact with them from the device's local home page. Each virtual group is added to the home page and is made up of cards. Each component has its own card with different inputs inside, based on the component's configuration.

Methods

Virtual.Add

Request

Properties:

Property Type Description

type

string

The type of virtual component to be created. Range of values: boolean, text, number, enum, group. Required

config

object

Configuration to be used for the new component. Optional

Response

The result from calling this method is a JSON object, with an id on success, otherwise it will return an error.

Received attributes:

Property Type Description

id

number

ID of the newly created component.

Virtual.Delete

Request

Properties:

Property Type Description

key

string

Component key (in format <type>:<cid>, for example boolean:200). Required

Response

The result from calling this method is null on success, otherwise it will return an error.

Examples

Virtual.Add example

  • Virtual.Add HTTP GET Request
  • Virtual.Add Curl Request
  • Virtual.Add Mos Request
http://192.168.33.1/rpc/Virtual.Add?type="boolean"
 

Response

{
  "id": 200
}
 

Virtual.Delete example

  • Virtual.Delete HTTP GET Request
  • Virtual.Delete Curl Request
  • Virtual.Delete Mos Request
http://192.168.33.1/rpc/Virtual.Delete?key="boolean:200"
 

Response

null

Boolean

The virtual Boolean component is used to store a true/false value. It uses Boolean as RPC namespace and has the following methods:

Methods

Boolean.SetConfig

Property Type Description

id

number

Id of the component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

Boolean.GetConfig

Properties:

Property Type Description

id

number

Id of the component instance

Find the Boolean.GetConfig response properties in config section

Boolean.GetStatus

Properties:

Property Type Description

id

number

Id of the component instance

Find more about the status response properties in status section

Boolean.Set

This method updates the value of the Boolean 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

id

number

Id of the component instance. Required

value

boolean

For truthy value only true is accepted, everything else is parsed as false. Required

Configuration

The configuration of the Boolean 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 Boolean component its id must be specified.

Properties:

Property Type Description

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

boolean

Value, applied on reboot if persisted is set to false

ui

object

Properties of how the component will be rendered in the UI

Property Type Description

view

string

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

icon

string or null

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

titles

array of strings or null

Allows setting custom titles for both (Truthy/Falsy) states. Item at index 0 is is used for the title when the value is set to false, at index 1 - for true, both are of type string. Default values are ["False", "True"] for view=button and ["Off", "On"] for view=toggle.

buttonIcons

array of strings or null

Allows setting custom titles for both (Truthy/Falsy) states. Item at index 0 is is used for the url for icon shown when the value is set to false, at index 1 - for true, both are of type string.

INFO
  • "" (empty string): The component does not have a card;
  • "button": Card with a button (value=true while holding, otherwise value=false);
  • "toggle": Card with a toggle button (Changes its value on each hit);
  • "label": Card showing the title for the value.

Status

The status of the Boolean 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 Boolean component its id must be specified.

Properties:

Property Type Description

source

string

Source of the last command

value

boolean

Value of the component

last_update_ts

number

Unix timestamp for the value update

Webhook Events

Currently, there are two events related to the Boolean component that can trigger webhooks:

  • boolean.true - produced when the value changes from false to true
  • boolean.false - produced when the value changes from true to false

Examples

Boolean.SetConfig example

  • Boolean.SetConfig HTTP GET Request
  • Boolean.SetConfig Curl Request
  • Boolean.SetConfig Mos Request
http://192.168.33.1/rpc/Boolean.SetConfig?id=200&config={"name":"Gate status","ui":{"titles":["Close","Open"]}}
 

Response

{
  "restart_required": false
}
 

Boolean.GetConfig example

  • Boolean.GetConfig HTTP GET Request
  • Boolean.GetConfig Curl Request
  • Boolean.GetConfig Mos Request
http://192.168.33.1/rpc/Boolean.GetConfig?id=200
 

Response

{
  "id": 200,
  "name": "Gate status",
  "ui": {
    "view": "label",
    "titles": [
      "Close",
      "Open"
    ],
    "buttonIcons": [
      "http://192.168.25.2:7999/icon_close.png",
      "http://192.168.25.2:7999/icon_open.png"
    ],
    "icon": "http://192.168.25.2:7999/icon_gate.png"
  },
  "persisted": true,
  "default_value": false
}
 

Boolean.GetStatus example

  • Boolean.GetStatus HTTP GET Request
  • Boolean.GetStatus Curl Request
  • Boolean.GetStatus Mos Request
http://192.168.33.1/rpc/Boolean.GetStatus?id=200
 

Response

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

Boolean.Set example

  • Boolean.Set HTTP GET Request
  • Boolean.Set Curl Request
  • Boolean.Set Mos Request
http://192.168.33.1/rpc/Boolean.Set?id=200&value=true
 

Response

null

 

 

Number

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

Methods

Number.SetConfig

Property Type Description

id

number

Id of the component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

Number.GetConfig

Properties:

Property Type Description

id

number

Id of the component instance

Find the Number.GetConfig response properties in config section

Number.GetStatus

Properties:

Property Type Description

id

number

Id of the component instance

Find more about the status response properties in status section

Number.Set

This method updates the value of the Number 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

id

number

Id of the component instance. Required

value

number

String to be saved Required

Configuration

The configuration of the Number 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 Number component its id must be specified.

Properties:

Property Type Description

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

number

Number, applied on reboot if persisted is set to false

ui

object

Properties of how the component will be rendered in the UI

Property Type Description

view

string

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

unit

string

Allows settings unit to the value, its appended after the value.

step

number

Specifies the minimum value change for view=slider and view=field

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;
  • "slider": Card showing a slider.
  • "progressbar": Card showing progressbar.
  • "label": Card showing the value.

Status

The status of the Number 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 Number component its id must be specified.

Properties:

Property Type Description

source

string

Source of the last command

value

number

Value of the component

last_update_ts

number

Unix timestamp for the value update

Webhook Events

Currently, there are two events related to the Number component that can trigger webhooks:

  • number.change - produced when the value changes.

Examples

Number.SetConfig example

  • Number.SetConfig HTTP GET Request
  • Number.SetConfig Curl Request
  • Number.SetConfig Mos Request
http://192.168.33.1/rpc/Number.SetConfig?id=200&config={"name":"Savings","min":0,"ui":{"view":"field","step":0.01,"unit":"$"}}
 

Response

{
  "restart_required": false
}
 

Number.GetConfig example

  • Number.GetConfig HTTP GET Request
  • Number.GetConfig Curl Request
  • Number.GetConfig Mos Request
http://192.168.33.1/rpc/Number.GetConfig?id=200
 

Response

{
  "id": 200,
  "name": "Savings",
  "min": 0,
  "max": 999999999999999,
  "ui": {
    "view": "field",
    "unit": "$",
    "step": 0.01,
    "icon": null
  },
  "persisted": false,
  "default_value": 0
}
 

Number.GetStatus example

  • Number.GetStatus HTTP GET Request
  • Number.GetStatus Curl Request
  • Number.GetStatus Mos Request
http://192.168.33.1/rpc/Number.GetStatus?id=200
 

Response

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

Number.Set example

  • Number.Set HTTP GET Request
  • Number.Set Curl Request
  • Number.Set Mos Request
http://192.168.33.1/rpc/Number.Set?id=200&value=25.6
 

Response

null

 

 

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

Property Type Description

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:

Property Type Description

id

number

Id of the component instance

Find the Text.GetConfig response properties in config section

Text.GetStatus

Properties:

Property Type Description

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:

Property Type Description

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:

Property Type Description

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

ui

object

Properties of how the component will be rendered in the UI

Property Type Description

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:

Property Type Description

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 are two events 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","ui":{"view":"label"}}
 

Response

{
  "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
 

Response

{
  "id": 200,
  "name": "",
  "max_len": 255,
  "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
 

Response

{
  "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"
 

Response

null

 

 

Enum

The virtual Enum component is used to store a set of constant values. It uses Enum as RPC namespace and has the following methods:

Methods

Enum.SetConfig

Property Type Description

id

number

Id of the component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

Enum.GetConfig

Properties:

Property Type Description

id

number

Id of the component instance

Find the Enum.GetConfig response properties in config section

Enum.GetStatus

Properties:

Property Type Description

id

number

Id of the component instance

Find more about the status response properties in status section

Enum.Set

This method updates the value of the Enum 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

id

number

Id of the component instance. Required

value

string or null

One of the items from options or null Required

Configuration

The configuration of the Enum 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 Enum component its id must be specified.

Properties:

Property Type Description

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

number or string or null

Option selected on reboot if persisted is set to false

options

array of options of type number or string

String values that can be set for this enum instance Required

ui

object

Properties of how the component will be rendered in the UI

Property Type Description

view

string

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

titles

object

Allows defining custom titles for each option in format (option: title).

images

object

Allows defining custom images for each option in format (option: image url). Only for view=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;
  • "dropdown": Card with a dropdown field;
  • "label": Card showing an image if defined, otherwise the title.

Status

The status of the Enum 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 Enum component its id must be specified.

Properties:

Property Type Description

source

string

Source of the last command

value

string or null

One of the items from options or null

last_update_ts

number

Unix timestamp for the value update

Webhook Events

Currently, there are two events related to the Enum component that can trigger webhooks:

  • enum.change - produced when the value changes.

Examples

Enum.SetConfig example

  • Enum.SetConfig HTTP GET Request
  • Enum.SetConfig Curl Request
  • Enum.SetConfig Mos Request
http://192.168.33.1/rpc/Enum.SetConfig?id=200&config={"name":"Light to toggle","options":["kitchen_light","bedroom_light","bathroom_light","entrance_light"],"ui":{"titles":{"kitchen_light":"Kitchen light","bedroom_light":"Bedroom light","bathroom_light":"Bathroom light","entrance_light":"Entrance light"}}}
 

Response

{
  "restart_required": false
}
 

Enum.GetConfig example

  • Enum.GetConfig HTTP GET Request
  • Enum.GetConfig Curl Request
  • Enum.GetConfig Mos Request
http://192.168.33.1/rpc/Enum.GetConfig?id=200
 

Response

{
  "id": 200,
  "name": "",
  "options": [
    "kitchen_light",
    "bedroom_light",
    "bathroom_light",
    "entrance_light"
  ],
  "ui": {
    "view": "",
    "titles": {
      "kitchen_light": "Kitchen light",
      "bedroom_light": "Bedroom light",
      "bathroom_light": "Bathroom light",
      "entrance_light": "Entrance light"
    },
    "icon": "",
    "images": {}
  },
  "persisted": true,
  "default_value": "kitchen_light"
}
 

Enum.GetStatus example

  • Enum.GetStatus HTTP GET Request
  • Enum.GetStatus Curl Request
  • Enum.GetStatus Mos Request
http://192.168.33.1/rpc/Enum.GetStatus?id=200
 

Response

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

Enum.Set example

  • Enum.Set HTTP GET Request
  • Enum.Set Curl Request
  • Enum.Set Mos Request
http://192.168.33.1/rpc/Enum.Set?id=200&value="kitchen_light"
 

Response

null

Group

The virtual Group component is used to store a list of components keys. It uses Group as RPC namespace and has the following methods:

Methods

Group.SetConfig

Property Type Description

id

number

Id of the component instance

config

object

Configuration that the method takes

Find more about the config properties in config section

Group.GetConfig

Properties:

Property Type Description

id

number

Id of the component instance

Find the Group.GetConfig response properties in config section

Group.GetStatus

Properties:

Property Type Description

id

number

Id of the component instance

Find more about the status response properties in status section

Group.Set

This method updates the value of the Group component.

Request

Parameters:

Property Type Description

id

number

Id of the component instance. Required

value

array of strings

List of valid components keys (in format <type>:<cid>, e.g. boolean:200) Required

Configuration

The configuration of the Group 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 Group component its id must be specified.

Properties:

Property Type Description

id

number

Id of the component instance

name

string or null

Name of the component instance

ui

object

Properties of how the component will be rendered in the UI

Status

The status of the Group 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 Group component its id must be specified.

Properties:

Property Type Description

source

string

Source of the last command

value

array of strings

List of valid components keys (in format <type>:<cid>, e.g. boolean:200)

last_update_ts

number

Unix timestamp for the value update

Examples

Group.SetConfig example

  • Group.SetConfig HTTP GET Request
  • Group.SetConfig Curl Request
  • Group.SetConfig Mos Request
http://192.168.33.1/rpc/Group.SetConfig?id=200&config={"name":"Thermostat"}
 

Response

{
  "restart_required": false
}
 

Group.GetConfig example

  • Group.GetConfig HTTP GET Request
  • Group.GetConfig Curl Request
  • Group.GetConfig Mos Request
http://192.168.33.1/rpc/Group.GetConfig?id=200
 

Response

{
  "id": 200,
  "name": "Thermostat"
}
 

Group.GetStatus example

  • Group.GetStatus HTTP GET Request
  • Group.GetStatus Curl Request
  • Group.GetStatus Mos Request
http://192.168.33.1/rpc/Group.GetStatus?id=200
 

Response

{
  "value": [
    "boolean:200",
    "enum:200"
  ],
  "source": "rpc",
  "last_update_ts": 1700864253
}
 

Group.Set example

  • Group.Set HTTP GET Request
  • Group.Set Curl Request
  • Group.Set Mos Request
http://192.168.33.1/rpc/Group.Set?id=200&value=["boolean:200","enum:200"]
 

Response

null
 
  • Like 1
Link to comment
Share on other sites

  • Integrators

I understand that the virtual components have their own endpoints. But from a integrators point of view it would be useful to have a reference of added virtual components in an existing endpoint, preferably Shelly.GetStatus. That could be used as a trigger to update any integrated virtual components of the Shelly device into the third party integration instead of having to check Shelly.GetComponents or force to user to do a manual update from the integration to sync the virtual components. Is this something that can be considered?

  • Like 2
Link to comment
Share on other sites

  • Members

I agree too that from an API perspective, being real of virtual components should be transparent to the caller.

This way, existing components will start showing up those virtual components without too many to zero changes (and that could have been the case for the app too) when you enumerate components attached to the device.

We could have a type field in what is returned from the component call if we want to differentiate physical to virtual components, but I'm not even sure this is needed.

Link to comment
Share on other sites

14 hours ago, Phuturist said:

I understand that the virtual components have their own endpoints. But from a integrators point of view it would be useful to have a reference of added virtual components in an existing endpoint, preferably Shelly.GetStatus. That could be used as a trigger to update any integrated virtual components of the Shelly device into the third party integration instead of having to check Shelly.GetComponents or force to user to do a manual update from the integration to sync the virtual components. Is this something that can be considered?

Hello, the reason for the new endpoint is that when you have 10 virtual components + other dynamic that are coming the json response can become huge and the device will struggle to generate it. The new endpoint replaces both old endpoints (Shelly.GetConfig and Shelly.GetStatus), with `Shelly.GetComponents` you can fetch the status/config for every component from the device.

  • Like 1
Link to comment
Share on other sites

  • Integrators
3 hours ago, Kristian Todorov said:

Hello, the reason for the new endpoint is that when you have 10 virtual components + other dynamic that are coming the json response can become huge and the device will struggle to generate it. The new endpoint replaces both old endpoints (Shelly.GetConfig and Shelly.GetStatus), with `Shelly.GetComponents` you can fetch the status/config for every component from the device.

Thanx for the explanation. I want suggesting to include the status of the virtual components but just an indicator that virtual components have been added to the device. Something like virtual_components: { number: 2, last_update: timestamp} under Shelly.GetStatus. An integration would know it would have to call the component endpoint (without having to poll it).

  • Like 1
Link to comment
Share on other sites

On 12/4/2023 at 6:32 PM, Phuturist said:

I understand that the virtual components have their own endpoints. But from a integrators point of view it would be useful to have a reference of added virtual components in an existing endpoint, preferably Shelly.GetStatus. That could be used as a trigger to update any integrated virtual components of the Shelly device into the third party integration instead of having to check Shelly.GetComponents or force to user to do a manual update from the integration to sync the virtual components. Is this something that can be considered?

Then status will be very very long and cannot be send because limitations. You need to check components and then read them if there is.

  • Thanks 1
Link to comment
Share on other sites

On 12/5/2023 at 12:40 PM, Phuturist said:

Thanx for the explanation. I want suggesting to include the status of the virtual components but just an indicator that virtual components have been added to the device. Something like virtual_components: { number: 2, last_update: timestamp} under Shelly.GetStatus. An integration would know it would have to call the component endpoint (without having to poll it).

Will bring up this question to developers, and hopefully they will agree with you and add them. 

Link to comment
Share on other sites

On 12/5/2023 at 12:11 PM, didrocks said:

Note: https://preview-api-docs.shelly.cloud/ is not accessible without user/passwd (all links here references to it).

Sorry, here are the docs for Shelly.GetComponents

 

Shelly.GetComponents

This method returns a list with device's components, it supports paging, filter for dynamic components (for example virtual components) and allows the user to get only the needed information from the component.

Request

Parameters:

Property Type Description

offset

number

Index of the component from which to start generating the result Optional

include

array of strings

"status" will include the component's status, "config" - the config. The keys are always included. Combination of both (["config", "status"]) to get the full config and status of each component. Optional

dynamic_only

boolean

true to include only dynamic components, default false. Optional

Response

Property Type Description

components

array of objects

Property Type Description

key

string

Component's key (in format <type>:<cid>, for example boolean:200)

status

object

Component's status, will be omitted if "status" is not specified in the include property.

config

object

Component's config, will be omitted if "config" is not specified in the include property.

cfg_rev

number

Sys's configuration revision

offset

number

Index of the first component in the result

total

number

Total number of components with all filters applied

  • Thanks 2
Link to comment
Share on other sites

On 12/5/2023 at 12:40 PM, Phuturist said:

Thanx for the explanation. I want suggesting to include the status of the virtual components but just an indicator that virtual components have been added to the device. Something like virtual_components: { number: 2, last_update: timestamp} under Shelly.GetStatus. An integration would know it would have to call the component endpoint (without having to poll it).

You don't have to poll the device, cant you check the `gen` prop from `Shelly.GetDeviceInfo` and if its >2 you can fetch the components by `Shelly.GetComponents?dynamic_only=true`? 

  • Thanks 1
Link to comment
Share on other sites

  • Integrators
On 12/7/2023 at 1:04 PM, Kristian Todorov said:

You don't have to poll the device, cant you check the `gen` prop from `Shelly.GetDeviceInfo` and if its >2 you can fetch the components by `Shelly.GetComponents?dynamic_only=true`? 

Hmmm yes, that's probably a good alternative. Thanx.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
  • Members

I'm a bit confused. I added a Text component

{
    "id": 200,
    "name": "Test",
    "max_len": 255,
    "ui": {
        "view": "label",
        "icon": null
    },
    "persisted": false,
    "default_value": "lorem ipsum"
}


And I don't see it in the `Shelly.GetComponents` response.

{
    "components": [
        {
            "key": "ble",
            "status": {},
            "config": {
                "enable": false,
                "rpc": {
                    "enable": false
                },
                "observer": {
                    "enable": false
                }
            }
        },
        {
            "key": "cloud",
            "status": {
                "connected": false
            },
            "config": {
                "enable": false,
                "server": "iot.shelly.cloud:6012/jrpc"
            }
        },
        {
            "key": "mqtt",
            "status": {
                "connected": true
            },
            "config": {
                "enable": true,
                "server": "raspberry:1883",
                "client_id": "shelly-pm-mini-gen3-3fb9bc",
                "user": "iot",
                "ssl_ca": null,
                "topic_prefix": "shellies-gen3/shelly-pm-mini-gen3-3fb9bc",
                "rpc_ntf": true,
                "status_ntf": true,
                "use_client_cert": false,
                "enable_rpc": true,
                "enable_control": true
            }
        }
    ],
    "cfg_rev": 27,
    "offset": 0,
    "total": 8
}

What am I missing?

obraz.png

Link to comment
Share on other sites

  • Integrators
9 hours ago, Bieniu said:

I'm a bit confused. I added a Text component


And I don't see it in the `Shelly.GetComponents` response.hat am I missing?

obraz.png

I asked about this on the integrator Teams channel and got this response.

Quote

ShellyGetComponents generates the json response until it reaches the fixed limit, which limit we will increase in a feature update. If you have only 2-3 component they will be returned in a single response, but if you have more it requires more calls

Although I wasnt quite happy with the response it seems it's still a bit of work in progress. What I'm seeing is Shelly.GetComponents with no parameters returns only booleans and system components. Shelly.GetComponents with dynamic_only set to true returns only booleans and enums. Shelly.GetComponents with offset set to 0 returns only the booleans as well and Shelly.GetComponents with offset set to 5 (which is the current vc's i have) only returns a group.

In no case I was able to retrieve the text virtual components.

Edited by Phuturist
  • Thanks 1
Link to comment
Share on other sites

  • Integrators
2 hours ago, Bieniu said:

How can a user interact with such a component?

You need to add a group and add the virtual component to that groups. Only groups can make virtual components visible on the home page of the WebUI for interaction.

  • Thanks 1
Link to comment
Share on other sites

  • 3 months later...
Guest PiZ

Hello,

I am not able to add a Virtual component to a Shelly PRO EM 50.

With the rpc command I receive this answer: 

{"code":404,"message":"No handler for Virtual.Add"}

Which is my mistake ?

Thanks for your help….I am stuck !

Link to comment
Share on other sites

  • Members
On 5/1/2024 at 8:27 PM, Guest PiZ said:

Hello,

I am not able to add a Virtual component to a Shelly PRO EM 50.

With the rpc command I receive this answer: 

{"code":404,"message":"No handler for Virtual.Add"}

Which is my mistake ?

Thanks for your help….I am stuck !

Virtual Components are supported in gen3 devices, pro em devices are gen2

Link to comment
Share on other sites

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...