mirror of https://github.com/arendst/Tasmota.git
Updated Scripting Language (markdown)
parent
65aa2786d3
commit
de24357274
|
@ -66,14 +66,13 @@ To save code space almost no error messages are provided. However it is taken ca
|
|||
>`>D ssize`
|
||||
ssize = optional max string size (default=19)
|
||||
define and init variables here, must be the first section, no other code allowed
|
||||
`p:vname` specifies permanent vars (the number of permanent vars is limited by tasmota rules space (50 bytes)
|
||||
numeric var=4 bytes, string var=length of string+1)
|
||||
`p:vname` specifies permanent variables. The number of permanent variables is limited by Tasmota rules space (50 bytes) - numeric variables are 4 bytes; string variables are one byte longer than the length of string
|
||||
`t:vname` specifies countdown timers, if >0 they are decremented in seconds until zero is reached. see example below
|
||||
`i:vname` specifies auto increment counters if >=0 (in seconds)
|
||||
`m:vname` specifies a median filter variable with 5 entries (for elimination of outliers)
|
||||
`M:vname` specifies a moving average filter variable with 8 entries (for smoothing data)
|
||||
(max 5 filters in total m+M) optional another filter length (1..127) can be given after the definition.
|
||||
Filter vars can be accessed also in indexed mode vname[x] (index = 1...N, index 0 returns current array index pointer)
|
||||
Filter vars can be accessed also in indexed mode vname[x] (x = `1..N`, x = `0` returns current array index pointer)
|
||||
Using this filter, vars can be used as arrays
|
||||
>
|
||||
> Keep variable names as short as possible. The length of all variable names taken together may not exceed 256 characters.
|
||||
|
@ -100,11 +99,10 @@ Executed when a Tasmota MQTT `RESULT` message is received, e.g., on `POWER` chan
|
|||
Executed on restart. p vars are saved automatically after this call
|
||||
|
||||
>`>W`
|
||||
The lines in this section are shown in the WEBUI main page. Requires compiling with `#define USE_SCRIPT_WEB_DISPLAY`.
|
||||
The lines in this section are displayed in the web UI main page. Requires compiling with `#define USE_SCRIPT_WEB_DISPLAY`.
|
||||
|
||||
>`>J`
|
||||
The lines in this section are exported to MQTT at teleperiod time. Requires compiling with `#define USE_SCRIPT_JSON_EXPORT `.
|
||||
|
||||
The lines in this section are published via MQTT in a JSON payload on [TelePeriod](Commands#teleperiod). Requires compiling with `#define USE_SCRIPT_JSON_EXPORT `.
|
||||
|
||||
>`>M`
|
||||
[Smart Meter Interface](smart-meter-interface).
|
||||
|
@ -180,9 +178,10 @@ If you define a variable with the same name as a special variable that special v
|
|||
**Tasmota commands**
|
||||
`=> <command>` Execute \<command>
|
||||
`-> <command>` Execute \<command> - do not send MQTT or log messages (i.e., silent execute - useful to reduce traffic)
|
||||
- Variable replacement within commands is allowed using `%varname%`
|
||||
- optionally a digit (0..9) may be placed in front of the substitution variable to set the decimals of a number variable
|
||||
|
||||
**Variable Substitution**
|
||||
- A single percent sign must be given as `%%`
|
||||
- Variable replacement within commands is allowed using `%varname%`. Optionally, the decimal places precision for numeric values may be specified by placing a digit (`%Nvarname%`, N = `0..9`) in front of the substitution variable (e.g., `Humidity: %3hum%%%` will output `Humidity: 43.271%`)
|
||||
|
||||
**Special** commands:
|
||||
`print` or `=> print` prints to the log for debugging
|
||||
|
|
Loading…
Reference in New Issue