diff --git a/Scripting-Language.md b/Scripting-Language.md index 02fa9c68..efffe1c5 100644 --- a/Scripting-Language.md +++ b/Scripting-Language.md @@ -27,6 +27,7 @@ USE_TOUCH_BUTTONS | enable virtual touch button support with touch displays USE_WEBSEND_RESPONSE | enable receiving the response of a websend command (received in section E) USE_SCRIPT_WEB_DISPLAY | enable `>W` section USE_SCRIPT_JSON_EXPORT | enable `>J` section +USE_SCRIPT_SUB_COMMAND | enable to call scripter subroutines via name in console or with MQTT

To enter a script, go to `Configuration` =\> `Edit script` in the Tasmota web UI menu @@ -108,7 +109,7 @@ The lines in this section are displayed in the web UI main page. Requires compil >- USER IO elements are displayed at the top of the page > >A web user interface may be generated containing any of the following elements: toggle button, check box, slider, or text input. ->- **Button:** `bu( )` +>- **Button:** `bu( )` (up to 4 buttons may be defined in one line) `` = name of variable to hold button state `` = text of ON state of button `` = text of OFF state of button @@ -242,6 +243,13 @@ If you define a variable with the same name as a special variable that special v `#name(param)` names a subroutine with a parameter. Subroutine is called with `=#name(param)` Subroutines end with the next `#` or `>` line or break. May be nested Parameters can be numbers or strings and on mismatch are converted +if USE_SCRIPT_SUB_COMMAND is defined a subroutine may be called via console or MQTT with the subroutines name +e.g. the subroutine +#SETLED(num) +may be called by SETLED 1 via console passing 1 in num (works also with string parameters) +it is possible to overwrite internal Tasmota commands. if the subroutine is called e.g. +#POWER1(num) the cmd POWER1 is processed in scripter in stead of Tasmota. + `=(svar)`executes a script in a string variable (dynamic or self modifying code) **For loop** (loop count must not be less than 1)