mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-29 05:36:39 +00:00
Update scripter.md
This commit is contained in:
parent
c71b06614e
commit
1c7e013837
25
scripter.md
25
scripter.md
@ -39,7 +39,9 @@ numeric var=4 bytes, string var=lenght of string+1)
|
|||||||
**i:**vname specifies auto increment counters if >=0 (in seconds)
|
**i:**vname specifies auto increment counters if >=0 (in seconds)
|
||||||
**m:**vname specifies a median filter variable with 5 entries (for elimination of outliers)
|
**m:**vname specifies a median filter variable with 5 entries (for elimination of outliers)
|
||||||
**M:**vname specifies a moving average filter variable with 8 entries (for smoothing data)
|
**M:**vname specifies a moving average filter variable with 8 entries (for smoothing data)
|
||||||
(max 5 filters in total m+M)
|
(max 5 filters in total m+M) optional another filter lenght (1..127) can be given after the definition.
|
||||||
|
filter vars can be accessed also in indexed mode vname[x] (index = 1...N, index 0 returns current array index pointer)
|
||||||
|
by this filter vars can be used as arrays
|
||||||
|
|
||||||
>all variable names length taken together may not exceed 256 characters, so keep variable names as short as possible.
|
>all variable names length taken together may not exceed 256 characters, so keep variable names as short as possible.
|
||||||
memory is dynamically allocated as a result of the D section.
|
memory is dynamically allocated as a result of the D section.
|
||||||
@ -84,7 +86,8 @@ special variables (read only):
|
|||||||
**pow(x y)** = calculates the power of x^y
|
**pow(x y)** = calculates the power of x^y
|
||||||
**med(n x)** = calculates a 5 value median filter of x (2 filters possible n=0,1)
|
**med(n x)** = calculates a 5 value median filter of x (2 filters possible n=0,1)
|
||||||
**int(x)** = gets the integer part of x (like floor)
|
**int(x)** = gets the integer part of x (like floor)
|
||||||
**hn(x)** = converts x (0..255) zu a hex nibble string
|
**hn(x)** = converts x (0..255) to a hex nibble string
|
||||||
|
**st(svar c n)** = stringtoken gets the n th substring of svar separated by c
|
||||||
**mqtts** = state of mqtt disconnected=0, connected>0
|
**mqtts** = state of mqtt disconnected=0, connected>0
|
||||||
**wifis** = state of wifi disconnected=0, connected>0
|
**wifis** = state of wifi disconnected=0, connected>0
|
||||||
|
|
||||||
@ -225,7 +228,9 @@ tcnt=0
|
|||||||
hour=0
|
hour=0
|
||||||
state=1
|
state=1
|
||||||
m:med5=0
|
m:med5=0
|
||||||
M:movav=0
|
M:movav=0
|
||||||
|
; define array with 10 entries
|
||||||
|
m:array=0 10
|
||||||
|
|
||||||
**\>B**
|
**\>B**
|
||||||
|
|
||||||
@ -258,15 +263,14 @@ delay(100)
|
|||||||
=>power 0
|
=>power 0
|
||||||
|
|
||||||
**\>T**
|
**\>T**
|
||||||
|
|
||||||
hum=BME280#Humidity
|
hum=BME280#Humidity
|
||||||
temp=BME280#Temperature
|
temp=BME280#Temperature
|
||||||
rssi=Wifi#RSSI
|
rssi=Wifi#RSSI
|
||||||
string=SleepMode
|
string=SleepMode
|
||||||
|
|
||||||
; add to median filter
|
; add to median filter
|
||||||
median=temp
|
median=temp
|
||||||
; add to moving average filter
|
; add to moving average filter
|
||||||
movav=hum
|
movav=hum
|
||||||
|
|
||||||
; show filtered results
|
; show filtered results
|
||||||
@ -274,7 +278,7 @@ movav=hum
|
|||||||
|
|
||||||
if chg[rssi]>0
|
if chg[rssi]>0
|
||||||
then =>print rssi changed to %rssi%
|
then =>print rssi changed to %rssi%
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if temp\>30
|
if temp\>30
|
||||||
and hum\>70
|
and hum\>70
|
||||||
@ -286,6 +290,11 @@ endif
|
|||||||
; every second but not completely reliable time here
|
; every second but not completely reliable time here
|
||||||
; use upsecs and uptime or best t: for reliable timers
|
; use upsecs and uptime or best t: for reliable timers
|
||||||
|
|
||||||
|
; arrays
|
||||||
|
array[1]=4
|
||||||
|
array[2]=5
|
||||||
|
tmp=array[1]+array[2]
|
||||||
|
|
||||||
; call subrountines with parameters
|
; call subrountines with parameters
|
||||||
=#sub1("hallo")
|
=#sub1("hallo")
|
||||||
=#sub2(999)
|
=#sub2(999)
|
||||||
@ -427,6 +436,8 @@ ends
|
|||||||
**\>E**
|
**\>E**
|
||||||
=\>print event executed!
|
=\>print event executed!
|
||||||
|
|
||||||
|
; get HSBColor 1. component
|
||||||
|
tmp=st(HSBColor , 1)
|
||||||
|
|
||||||
; check if switch changed state
|
; check if switch changed state
|
||||||
sw=sw[1]
|
sw=sw[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user