mirror of https://github.com/arendst/Tasmota.git
Debugging scripts
parent
e46ad96b4d
commit
37e4528869
|
@ -27,7 +27,10 @@ USE_TOUCH_BUTTONS | enable virtual touch button support with touch displays
|
|||
|
||||
<BR><BR>To enter a script, go to `Configuration` =\> `Edit script` in the Tasmota web UI menu
|
||||
|
||||
The maximum script size is 1535 bytes (uses rule set buffers).
|
||||
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>**Scripter Features**
|
||||
- Up to 50 variables (45 numeric and 5 strings, maybe changed by #define)
|
||||
|
@ -81,11 +84,15 @@ executed every 100 ms
|
|||
executed every second
|
||||
|
||||
>`>E`
|
||||
executed e.g. on power change and mqtt **RESULT**
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
**Special variables** (read only)
|
||||
`upsecs` = seconds since start
|
||||
`uptime` = minutes since start
|
||||
|
@ -152,15 +159,28 @@ Within commands you can replace text with variables with `%varname%`
|
|||
A single percent sign must be given as `%%`
|
||||
`->` is equivalent but doesn't send mqtt or any weblog (silent execute, usefull to reduce traffic)
|
||||
|
||||
**Special** commands:
|
||||
**Special** commands:
|
||||
`=\> print` prints to the log for debugging
|
||||
A Tasmota MQTT RESULT message invokes the script's `>E` section. Add `=\> print` statements to debug a script.
|
||||
|
||||
- Example:
|
||||
```
|
||||
slider=Dimmer
|
||||
power=POWER
|
||||
|
||||
if upd[slider]>0
|
||||
then
|
||||
=>print slider updated %slider%
|
||||
endif
|
||||
|
||||
if upd[power]>0
|
||||
then
|
||||
=>print power updated %power%
|
||||
endif
|
||||
```
|
||||
|
||||
`=\> print` prints to info log for debugging
|
||||
|
||||
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.
|
||||
If a variable does not exist, `???` is displayed for commands
|
||||
If a `SENSOR` or `STATUS` or `RESULT` message or a var does not exist the destination variable is NOT updated.
|
||||
|
||||
There are two syntax alternatives for conditional statements. You may **_NOT_** mix both methods.
|
||||
**Conditional Statements**
|
||||
There are two syntax alternatives. You may **_NOT_** mix both formats.
|
||||
```
|
||||
if a==b
|
||||
and x==y
|
||||
|
@ -177,7 +197,7 @@ if a==b
|
|||
and x==y
|
||||
or k==i {
|
||||
=> do this
|
||||
} else {**
|
||||
} else {
|
||||
=> do that
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue