You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Scripting-Language.md
+26-8Lines changed: 26 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -377,16 +377,19 @@ for next loops are supported to repeat HTML code (precede with % char)
377
377
%for var from to inc
378
378
%next
379
379
```
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
384
384
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
388
391
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.
390
393
391
394
A web user interface may be generated containing any of the following elements:
392
395
@@ -398,6 +401,7 @@ remark: state variable names used for IO in the web interface may not contain an
398
401
`vn` = name of variable to hold button state
399
402
`txt1` = text of ON state of button
400
403
`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
401
405
402
406
#### Pulldown
403
407
@@ -407,6 +411,14 @@ remark: state variable names used for IO in the web interface may not contain an
407
411
`xs` = optional xs (default 200)
408
412
`txt1` = text of 1. entry
409
413
`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
410
422
411
423
#### Radio button
412
424
@@ -581,6 +593,11 @@ If a Tasmota `SENSOR` or `STATUS` or `RESULT` message is not generated or a `Var
581
593
582
594
## Special Variables
583
595
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
+
584
601
(read only)
585
602
`upsecs` = seconds since start
586
603
`uptime` = minutes since start
@@ -628,6 +645,7 @@ now optional binary mode, much faster and more precise, also supports arrays.
628
645
`udp(4)` = return udp remote ip as string
629
646
`udp(5)` = return udp remote port
630
647
`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
631
649
632
650
when #define USE_SCRIPT_MDNS
633
651
`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