Skip to content

Commit c8bd369

Browse files
authored
Update Scripting-Language.md
1 parent ea970d8 commit c8bd369

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

docs/Scripting-Language.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,16 +377,19 @@ for next loops are supported to repeat HTML code (precede with % char)
377377
%for var from to inc
378378
%next
379379
```
380-
but this method is preferred:
381-
script subroutines may be called sub=name of subroutine, like normal subroutines
382-
`%=#sub`
383-
in this subroutine a web line may be sent by wcs (see below) thus allowing dynamic HTML pages
380+
but this method is preferred:
381+
script subroutines may be called sub=name of subroutine, like normal subroutines
382+
`%=#sub`
383+
in this subroutine a web line may be sent by wcs (see below) thus allowing dynamic HTML pages
384384

385-
=#sub(x) in any position of webline calls subroutine. this allows inserting content
386-
387-
insa(array) in any position insert all elements from an array comma separated
385+
script subfiles may be called like normal subroutines but in a file
386+
`%=#(subfile.tas)`
387+
388+
=#sub(x) in any position of webline calls subroutine. this allows inserting content
389+
390+
insa(array) in any position insert all elements from an array comma separated
388391

389-
%/file calls a file from the file system and send its content to browser. in this file any cmds may apply.
392+
%/file calls a file from the file system and send its content to browser. in this file any html code may apply.
390393

391394
A web user interface may be generated containing any of the following elements:
392395

@@ -398,6 +401,7 @@ remark: state variable names used for IO in the web interface may not contain an
398401
`vn` = name of variable to hold button state
399402
`txt1` = text of ON state of button
400403
`txt2` = text of OFF state of button
404+
if variable name vn begins with an undercore the name specifies a subroutine which is called when pressing the button
401405

402406
#### Pulldown
403407

@@ -407,6 +411,14 @@ remark: state variable names used for IO in the web interface may not contain an
407411
`xs` = optional xs (default 200)
408412
`txt1` = text of 1. entry
409413
`txt2` = text of 2. entry and so on
414+
if txt1 text is "#g" a list of GPIOs ist presented, those already used greyed out
415+
if txt1 starts with # and a number range like "#5-10" an number range from 5 to 10 ist presented
416+
417+
special selector for SML descriptor files
418+
`smlpd(json_url label sel)`
419+
`json_url` = url of a json file with directory of descriptor files
420+
`label` = label text
421+
`sel` = variable of selected entry
410422

411423
#### Radio button
412424

@@ -581,6 +593,11 @@ If a Tasmota `SENSOR` or `STATUS` or `RESULT` message is not generated or a `Var
581593

582594
## Special Variables
583595

596+
universal variables (defaults to 4, may be increased up to 10 by #define SCRIPT_LOCAL_NVARS N)
597+
may be used without a declaration in >D
598+
numbers: lnv0 ... lnv3
599+
strings: lsv0 ... sls3
600+
584601
(read only)
585602
`upsecs` = seconds since start
586603
`uptime` = minutes since start
@@ -628,6 +645,7 @@ now optional binary mode, much faster and more precise, also supports arrays.
628645
`udp(4)` = return udp remote ip as string
629646
`udp(5)` = return udp remote port
630647
`udp(6 url port string)` = send a string via UDP to url and port
648+
`udp(7 url port array)` = send an array via UDP to url and port
631649

632650
when #define USE_SCRIPT_MDNS
633651
`mdns(name mac type)` = open mdns service with name, mac (use device mac if '-') and type (use tasmota hostname if '-' or e.g. "shelly"). If “shelly” or “everhome” is used, a corresponding txt record is also set (for Shelly/EcoTracker emulation).

0 commit comments

Comments
 (0)