/* eslint-disable */ /** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run json-schema-to-typescript to regenerate this file. */ /** * The main heading displayed above the switch controls. Use to describe the control group (e.g., 'Light Controls', 'Pump Switches'). */ export type Title = string; /** * Secondary text displayed below the title. Use for additional context like location, device group, or instructions. */ export type Subtitle = string; /** * How large the switches and their labels are drawn. 'small' fits dense control panels, 'normal' is the default, and 'big' suits touch screens and wall displays. */ export type Size = "small" | "normal" | "big"; /** * Display text identifying this switch. Should clearly describe what the switch controls (e.g., 'Main Power', 'Pump 1', 'Night Mode'). */ export type Label = string; /** * Helper text displayed below the switch label to guide the operator. Use for what the switch does, when it is safe to flip it, or how long the action takes. */ export type HintText = string; /** * Values that indicate the ON state. Can be: a single value ('1', 'true', 'ON'), comma-separated list ('1,true,ON'), or numeric expression ('<4' means values below 4 are ON, '>33' means values above 33 are ON). If a value matches both ON and OFF, ON takes precedence. */ export type ONValues = string; /** * Values that indicate the OFF state. Can be: a single value ('0', 'false', 'OFF'), comma-separated list ('0,false,OFF'), or numeric expression ('<4' means values below 4 are OFF, '>33' means values above 33 are OFF). A value matching neither ON nor OFF also shows the switch OFF. */ export type OFFValues = string; /** * The current state value from the backend, used to display the correct switch position. Strongly recommended to bind this to the actual device state column to keep the visual state synchronized with the physical device state: after a click the switch waits up to 10 seconds for this value to confirm the new position, then returns to the position it reports. Without a value the switch keeps the position the operator last set. Not needed when URL Parameter Key is set. */ export type SwitchState = string; /** * The specific command/topic sent to the app when the switch is clicked. Arguments sent are: True for turning ON, False for turning OFF. Refer to the app's documentation for available topics. */ export type ActionAppTopic = string; /** * Turns this switch into a view control: the NAME of the URL parameter it sets (e.g. 'onlyAlarms'). While the switch is ON the parameter holds the URL Parameter Value; while it is OFF the parameter is removed. The switch's position then follows the URL, so it survives a reload and a shared link, and it fires no device action — State Map, Switch State and the action settings are ignored. Every widget that should follow this switch needs a filterAnd condition with "useFilter": true and exactly this name as the bare "value" — e.g. {"column": "status", "operator": "=", "value": "onlyAlarms", "useFilter": true, "dataType": "string"}. While the switch is OFF the frontend drops that condition and the widget shows unfiltered data. */ export type URLParameterKey = string; /** * The value written into the URL parameter while the switch is ON. Defaults to 'true'. A widget following this switch compares it against its own filtered column, so it must match the values stored in that column exactly (same spelling and case), e.g. 'ALARM'. Only used when URL Parameter Key is set. */ export type URLParameterValue = string; /** * What every click writes into Column: a constant, or bound to a column, such as the id of the record shown on this page. Converted to the column's type (number, true/false). */ export type Value = string; /** * More columns of the row Write to Column writes, each with a fixed or bound value, such as the id of the record the switch belongs to. While one of them has no value (its binding has delivered none yet), the switch is disabled, so it never writes a row without its key. */ export type ExtraColumns = { targetColumn?: Column; value?: Value; [k: string]: unknown; }[]; /** * Array of switch configurations. Each entry creates a toggle switch with its own state mapping and optional device action binding, or with a URL parameter it sets. */ export type Switches = { label?: Label; description?: HintText; stateMap?: StateMap; value?: SwitchState; actionDevice?: ActionDeviceTarget; actionApp?: ActionApp; actionTopic?: ActionAppTopic; parameterKey?: URLParameterKey; parameterValue?: URLParameterValue; targetColumn?: WriteToColumn; extraColumns?: ExtraColumns; [k: string]: unknown; }[]; /** * Toggle switches that show an on/off state and change it on click: a switch calls a device action, stores its position in a table (targetColumn), or sets a URL parameter that other widgets filter on (parameterKey). Several switches fit in one tile, drawn small, normal or big. */ export interface SwitchConfiguration { title?: Title; subTitle?: Subtitle; size?: Size; dataseries?: Switches; [k: string]: unknown; } /** * Defines how data values are interpreted as switch states. Configure which values represent ON and OFF. A value matching neither shows the switch OFF. Not needed when URL Parameter Key is set. */ export interface StateMap { on?: ONValues; off?: OFFValues; [k: string]: unknown; } /** * The device that receives commands when the switch is clicked. In data-driven mode, bind to a 'Device ID' column to dynamically target different devices per row. */ export interface ActionDeviceTarget { [k: string]: unknown; } /** * The application/service on the target device that handles the switch command. Select from available apps installed on the device. */ export interface ActionApp { [k: string]: unknown; } /** * Stores the switch's position in a table: every click writes a row, with true in this column for ON and false for OFF (1 and 0 in a numeric column), plus the Extra Columns, as a form does. Bind Switch State to the latest value of the same column, filtered to the same record, and set State Map to on 'true', off 'false', so the switch shows what is stored. A device action still fires when Action App Topic is set. Ignored when URL Parameter Key is set. */ export interface WriteToColumn { [k: string]: unknown; } /** * The column this value goes into, normally in the same table as Write to Column. */ export interface Column { [k: string]: unknown; }