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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| 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