Skip to main content
Version: 1.0

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

PropertyTypeDescription

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:

PropertyTypeDescription

id

number

Id of the component instance

Find the Boolean.GetConfig response properties in config section

Boolean.GetStatus

Properties:

PropertyTypeDescription

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:

PropertyTypeDescription

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:

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

boolean

Value, 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), 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;
  • "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:

PropertyTypeDescription

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 is one event related to the Boolean component that can trigger webhooks:

  • boolean.change - produced when the value changes.

Examples

Boolean.SetConfig example

http://192.168.33.1/rpc/Boolean.SetConfig?id=200&config={"name":"Gate status","meta":{"ui":{"titles":["Close","Open"]}}}

Response

{
"restart_required": false
}

Boolean.GetConfig example

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

Response

{
"id": 200,
"name": "Gate status",
"meta": {
"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

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

Response

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

Boolean.Set example

http://192.168.33.1/rpc/Boolean.Set?id=200&value=true

Response

null