πŸ“¦ Archived documentation: r1 (committed 2026-07-24) View current documentation β†’

Inputs and Outputs

Methods to read channel values and set relay states.

Available on: Flexs Q5 Pro

Functions

getFeed()

getFeed(id | name) β†’ number

Get custom feed value

Custom feeds can be used to log or visualise computed values from logic script. They can be read and written from the onboard web interface and viewed from the onboard display.

Arguments

NameTypeRequiredDefaultDescription
id number | string yes β€” ID of the custom feed to query. Can also supply a case insensitive string

Returns

number | bool Current custom feed value

Example

let value = getFeed(0);

setFeed()

setFeed(id | name,value)

Set custom feed value

Set the value of a custom feed.

Arguments

NameTypeRequiredDefaultDescription
id | name number | string yes β€” Feed ID
value number | bool yes β€” Feed Value

Example

let watts = inputs("voltage").inst * inputs("amperage").inst; // calculate watts from our voltage and amperage

setFeed(0,watts); // set the custom feed value



setFeed(1,true); // Set a boolean type feed. Could also use 1 or 0 inplace of true or false

inputs()

inputs(ch | label) β†’ object

Read the current value of an analog input channel

Return the current value of an analog input channel as an object in the form of {"ripple":0.001878,"state":false,"max":0.001997,"min":-0.000126,"inst":0.001106,"avg":0.000976}

The inst child contains the current realtime value. Aggregated metrics are computed based on the configured measurement interval.

Arguments

NameTypeRequiredDefaultDescription
channel | label number | string yes β€” Input channel number | input channel name

Returns

Current value

Example

let voltage = inputs(1).inst;

let current = inputs("current").avg; 

let state = inputs("switch").state; // for inputs configured as discrete

powermetrics()

powermetrics(id | label) β†’ object

Read the current value of a power metric.

Returns the current value as an object.

Simplified Form Result:

{ "thd": 3.2, "pf": 0.95, "freq": 59.8, "voltage": 225.34, "current": 1.2, "realpower": 230.4 }

Advanced Form Result: (advanced arg = true) { "label": "Total Power Con", "thd": 2.833947, "pf": 0.999362, "freq": 60.208321, "voltage": { "inst": 214.299423, "avg": 213.813995, "max": 216.401474, "min": 212.065689 }, "current": { "inst": 24.0798, "avg": 23.954132, "max": 24.357168, "min": 23.739422 }, "realpower": { "inst": 5157.308594, "avg": 5118.462891, "max": 5264.208984, "min": 5046.496094 } }

Arguments

NameTypeRequiredDefaultDescription
id | label number | string yes β€” Power Metric ID or Label
advanced bool optional false

Returns

Current Measurement Values

Example

let watts = powermetrics(0).realpower; // simple usage, returns average values


let maxWatts = powermetrics(0,true).realpower.max; // advanced usage

tempsensors()

tempsensors(id) β†’ object

Read the current value of an attached one wire temp sensor.

Sensors can be addressed by the index # (relating to the order defined on the sensors configuration page) or the UID (unique sensor id on sensor label)

Result Format: {"lastUpdated":3,"avg":14.900000,"inst":15.125000}

Arguments

NameTypeRequiredDefaultDescription
id | label number | string yes β€” Index, UID or Label (string)

Returns

object Return result

Example

let indoorTemp = tempsensors(0).inst;

relays()

relays(ch) β†’ object

Get the current relay state

Returns an object with the current relay information in the form of an object {"lvd":false,"hvd":false,"fuse":false,"state":false}

Arguments

NameTypeRequiredDefaultDescription
channel | label number | string yes β€” Relay channel # or label

Returns

object {"lvd":false,"hvd":false,"fuse":false,"state":false}

Example

let loadSwitch = relays(1).state;

setRelay()

setRelay(ch,state)

Set the relay state

Arguments

NameTypeRequiredDefaultDescription
channel | label number | string yes β€” Channel # or Label
state bool yes β€” State, True or False. 1 or 0

Example

setRelay(1,true); // turn relay 1 on