Updated Scripting Language (markdown)

Michael Ingraham 2019-09-30 08:19:13 -04:00
parent 8a25b22b59
commit 5f0803eb91
1 changed files with 28 additions and 28 deletions

@ -18,16 +18,16 @@ These features are enabled by adding the following `#define` compiler directive
| Feature | Description |
| -- | -- |
USE_WEBSEND_RESPONSE | enable receiving the response of a [`WebSend`](Commands#websend) command (received in section E)
USE_SCRIPT_JSON_EXPORT | enable `>J` section
USE_SCRIPT_WEB_DISPLAY | enable `>W` section
USE_SCRIPT_SUB_COMMAND | enables invoking named script subroutines via the Console or MQTT
SUPPORT_MQTT_EVENT | enables support for subscribe unsubscribe
USE_TOUCH_BUTTONS | enable virtual touch button support with touch displays
USE_24C256 | enables use of 24C256 I<sup>2</sup>C EEPROM to expand script buffer (defaults to 4k)
USE_SCRIPT_FATFS CS_PIN | enables SD card support (on SPI bus). Also enables 4k script buffer
USE_SCRIPT_FATFS_EXT | enables additional FS commands
SDCARD_DIR | enables support for web UI for SD card directory upload and download
USE_24C256 | enables use of 24C256 I<sup>2</sup>C EEPROM to expand script buffer (defaults to 4k)
SUPPORT_MQTT_EVENT | enables support for subscribe unsubscribe
USE_TOUCH_BUTTONS | enable virtual touch button support with touch displays
USE_WEBSEND_RESPONSE | enable receiving the response of a [`WebSend`](Commands#websend) command (received in section E)
USE_SCRIPT_WEB_DISPLAY | enable `>W` section
USE_SCRIPT_JSON_EXPORT | enable `>J` section
USE_SCRIPT_SUB_COMMAND | enables invoking named script subroutines via the Console or MQTT
<BR><BR>To enter a script, go to `Configuration` =\> `Edit script` in the Tasmota web UI menu
@ -35,8 +35,7 @@ The maximum script size is 1535 bytes (uses rule set buffers).
To save code space almost no error messages are provided. However it is taken care of that at least it should not crash on syntax errors.
<BR><BR>**Features**
<BR>**Features**
- Up to 50 variables (45 numeric and 5 strings - this may be changed by setting a compilation `#define` directive)
- Freely definable variable names (all variable names are intentionally _**case sensitive**_)
- Nested if,then,else up to a level of 8
@ -83,9 +82,8 @@ To save code space almost no error messages are provided. However it is taken ca
>`>B`
executed on BOOT time and on save script
>`>T`
Executed on [`TelePeriod`](Commands#teleperiod) time (`SENSOR` and `STATE`), only put `tele-` vars in this section
Remark: json variable names (like all others) may not contain math operators like - , you should set [`SetOption64 1`](Commands#setoption64) to replace `-` (_dash_) with `_` (_underscore_)
>`>E`
Executed when a Tasmota MQTT `RESULT` message is received, e.g., on `POWER` change
>`>F`
Executed every 100 ms
@ -93,12 +91,27 @@ Executed every 100 ms
>`>S`
Executed every second
>`>E`
Executed when a Tasmota MQTT `RESULT` message is received, e.g., on `POWER` change
>`>R`
Executed on restart. p vars are saved automatically after this call
>`>T`
Executed on [`TelePeriod`](Commands#teleperiod) time (`SENSOR` and `STATE`), only put `tele-` vars in this section
Remark: json variable names (like all others) may not contain math operators like - , you should set [`SetOption64 1`](Commands#setoption64) to replace `-` (_dash_) with `_` (_underscore_)
>`>H`
Alexa Hue interface (up to 32 virtual hue devices)
`device`,`type`,`onVars`
Remark: hue values have a range from 0-65535. Divide by 182 to assign HSBcolors hue values.
>
>`device` device name
`type` device type - `E` = extended color; `S` = switch
`onVars` assign Hue "on" extended color parameters for hue, saturation, brightness, and color temperature (hue,sat,bri,ct) to scripter variables
example:
lamp1,E,on=pwr1,hue=hue1,sat=sat1,bri=bri1,ct=ct1
>`>J`
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 `.
>`>W`
The lines in this section are displayed in the web UI main page. Requires compiling with `#define USE_SCRIPT_WEB_DISPLAY`.
>
@ -133,22 +146,9 @@ The lines in this section are displayed in the web UI main page. Requires compil
`<vn>` = name of number variable to hold number
`<txt>` = label text
>`>J`
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)
>`>H`
Alexa Hue interface (up to 32 virtual hue devices)
example:
lamp1,E,on=pwr1,hue=hue1,sat=sat1,bri=bri1,ct=ct1
>1. Name of device
>2. type of device, E=extended color, S=switch
>3. on=var1 assigns the Hue "on" variable to a scripter var (hue,sat,bri,ct) may be assigned also comma separated (for extended color)
remark on hue: hue has a range from 0-65535, simply divide it by 182 to assign it to HSBcolors hue.
If a variable does not exist, `???` is displayed for commands
If a Tasmota `SENSOR` or `STATUS` or `RESULT` message is not generated or a `Var` does not exist the destination variable is NOT updated.