Event Reference¶
Here’s a list of all available events that may be triggered. Please be aware that only some will trigger, depending on what settings you have selected, and what plugins you have active.
Internal (core) events¶
Event |
Example |
---|---|
|
on DHT11Outside#Temperature>20 do
GPIO,2,1
endon
|
|
on TaskInit#bme do
LogEntry,'TaskInit task: %eventvalue1% result: %eventvalue2%'
endon
The first event value is the task index, the second event value is the return value of the |
|
on TaskExit#bme do
LogEntry,'TaskExit task: %eventvalue1% result: %eventvalue2%'
endon
|
|
on TaskError#bme do
LogEntry,'TaskError task: %eventvalue1% result: %eventvalue2%'
endon
The first event value is the task index, the second event value is a plugin specific indicator of the error that occured. N.B. The second event value can be a string. |
|
on System#Wake do
GPIO,15,1
endon
|
On ESP32-series only. Event is sent right before network connection is attempted. On normal boots (GPIO-0 is high), the ESP32 can record the state of a number of pins and make these available after boot in the |
on System#BootMode do
LogEntry,'Boot pins: GPIO-5: %eventvalue1%, GPIO-15: %eventvalue2%, GPIO-4: %eventvalue3%, GPIO-2: %eventvalue4%'
endon
For the classic ESP32, the event values represent the state of these pins in the following order:
The standard BootMode event will be: N.B. When pulling down GPIO-15 during boot, the ROM bootloader messages will be silenced. N.B.2 Do not pull GPIO-2 high when GPIO-0 is low for programming mode. See ‘Boot Strapping Pins’ documentation for the boot strapping pins for all ESP32-series chips. |
|
on System#Boot do
GPIO,2,1
timerSet,1,30
endon
|
|
on System#Sleep do
GPIO,2,0
endon
|
|
on http#192.168.1.2 do
if %eventvalue1%!=200
// %eventvalue1% is HTTP Code
// %eventpar% is the part of the event after the #, thus here it is the hostname
LogEntry,'HTTP error: %eventvalue1% to: %eventpar%:'
endif
endon
|
|
on MQTT#Connected do
Publish,%sysname%/status,First message!
endon
|
|
on MQTT#Disconnected do
Reboot
endon
|
|
on MQTTimport#Connected do
Publish,%sysname%/status,MQTT Import is now operational
endon
|
|
on MQTTimport#Disconnected do
Reboot
endon
|
|
on WiFi#Connected do
SendToHTTP,url.com,80,/report.php?hash=123abc456&t=[temp2#out]
endon
|
|
on WiFi#ChangedAccesspoint do
Publish,%sysname%/status,AP changed
endon
|
|
on WiFi#ChangedWiFichannel do
Publish,%sysname%/status,channel changed
endon
|
|
on WiFi#APmodeEnabled do
... // Some command
endon
|
|
on WiFi#APmodeDisabled do
Publish,%sysname%/status,AP disabled
endon
|
|
on Login#Failed do
Publish,%sysname%/warning,Intruder alert!
endon
|
|
on Time#Initialized do
Publish,%sysname%/Time,%systime%
endon
|
|
on Time#Set do
Publish,%sysname%/Time,%systime%
Publish,%sysname%/NTP,Updated time at: %systime%
endon
|
|
on Rules#Timer=1 do
GPIO,2,1
endon
|
For handling events to only be executed on weekdays (Mon..Fri), the day indicator ‘Wrk’ (work) can be used, and for weekend days (Sat, Sun), the day indicator ‘Wkd’ is available. |
on Clock#Time=All,12:00 do //will run once a day at noon
GPIO,2,1
endon
on Clock#Time=All,**:30 do //will run half past every hour
GPIO,2,1
endon
on Clock#Time=All,%sunrise% do //will run at sunrise (%sunset% is also available)
GPIO,2,1
endon
|
|
on System#Boot do
Monitor GPIO,15
endon
on GPIO#15=0 do
if [Plugin#GPIO#Pinstate#13]=0
// do something
endif
endon
on GPIO#15=1 do
if [Plugin#GPIO#Pinstate#13]=1
// do something
endif
endon
|
Plugin based events¶
Besides the internal events there’s also plugin specific events. These are listed here below.
P036 Display - OLED SSD1306/SH1106 Framed¶
Event |
Example |
---|---|
|
|
|
|
|
|
|
|
|
P053 Dust - PMSx003 / PMSx003ST¶
Event |
Example |
---|---|
A task named |
on foo#Humi do
if %eventvalue1% > 90
GPIO,2,1 //LED on
else
GPIO,2,0 //LED off
endif
endon
|
A task named |
on foo#HCHO do
if %eventvalue1% > 0.1
GPIO,2,1 //LED on
else
GPIO,2,0 //LED off
endif
endon
|
A task named |
on foo#cnt1.0 do
if %eventvalue1% > 300
GPIO,2,1 //LED on
else
GPIO,2,0 //LED off
endif
endon
|
A task named |
on foo#pm1.0 do
if %eventvalue1% > 300
GPIO,2,1 //LED on
else
GPIO,2,0 //LED off
endif
endon
|
Note
PMxx
values relate to particles less than or equal to said size, while count/100ml relates to particles of at least said size.
Except when “Split count bins” is checked, then the “count/0.1L” values represent only a single bin.
P081 Generic - CRON¶
Event |
Example |
---|---|
|
on Cron#foo do
GPIO,2,1 //LED on
endon
|
P082 Position - GPS¶
Event |
Example |
---|---|
|
on GPS#GotFix do
GPIO,2,1 //LED on
endon
|
|
on GPS#LostFix do
GPIO,2,0 //LED off
endon
|
|
on GPS#travelled do
LogEntry,'Travelled %eventvalue% meter'
endon
|
P097 Internal - Touch ESP32¶
Event |
Example |
---|---|
The regular events like in every other task. Only difference here is that you may have an event either when the touch pad is touched, released or both. |
on touch#Touch do
GPIO,2,1 //LED on
endon
|
When enabled, this event will be sent on release of the touch pad. The event variable is the time in msec the pad had been touched. |
on touch#Duration do
LogEntry,'Touch Duration %eventvalue% ms'
endon
Example in the log: 6553261 : Info : Touch : ADC2 ch5 (T5): 10
6553338 : Info : EVENT: touch#Touch=10.00
6553638 : Info : EVENT: touch#Duration=460
6553653 : Info : ACT : LogEntry,'Touch Duration 460 ms'
6553654 : Info : Command: LogEntry
6553655 : Info : Touch Duration 460 ms
|
P098 Motor - PWM Motor¶
Event |
Example |
---|---|
Limit switch A is reached |
If limit switch A is configured, then this event will be generated once the switch is reached. |
Limit switch B is reached |
If limit switch B is configured, then this event will be generated once the switch is reached. |
Requested position is reached |
After a command |
A time-out has occurred. |
The command took longer then the configured time-out duration, causing this event to be generated. |
P099 Touch - XPT2046 touchscreen on TFT display¶
Event |
Example |
---|---|
The regular events like in every other task. It is fired if the configuration is set to send events for objectnames. Has 3 eventvalues, the X, Y and Z values of the touch event. When the setting On/Off button is checked for a touchobject, then the new state (On or Off) will be sent as the only |
on System#Boot do
let,1,0
let,2,0
endon
// With debouncing in the script
on XPT2046#sun do
if %v2%=0
let,2,1
if %v1%=0
let,1,1
else
let,1,0
endif
timerSet_ms,1,300 // Debouncing timer
endif
endon
on Rules#Timer=1 do
if %v2%=1
if %v1%=1
GPIO,2,1 //LED on
else
GPIO,2,0 //LED off
endif
let,2,0
endif
endon
// Alternatively, using the On/Off button setting, the on/off state can also be inverted, if desired.
on XPT2046#sun do
GPIO,2,%eventvalue%
endon
|
When enabled, these events will be sent on touch of the touchscreen. The event variable is the current x/y/z value of the touched position. |
on XPT2046#X do
LogEntry,'Touch X position %eventvalue%'
endon
on XPT2046#Y do
LogEntry,'Touch Y position %eventvalue%'
endon
on XPT2046#Z do
LogEntry,'Touch Z pressure %eventvalue%'
endon
|
P115 Energy - MAX1704x¶
Event |
Description |
---|---|
|
Alert is triggered for a task running |
P129 Input - Shift registers (74HC165)¶
Event |
Extra information |
---|---|
<taskname>=<state>,<chip>,<port>,<pin> state : 0 or 1 .chip : range 1..16, depending on the number of chips configured.port : range 1..8.pin : range 1..128, depending on the number of chips configured. |
Generic event for each activated input pin, that is enabled in the Event configuration matrix.
Generated if Separate events per pin is unchecked/disabled.
|
<taskname>#<pin>=<state>,<chip>,<port>,<pin> state : 0 or 1 .chip : range 1..16, depending on the number of chips configured.port : range 1..8.pin : range 1..128, depending on the number of chips configured. |
Generic event for each activated input pin, that is enabled in the Event configuration matrix.
Generated if Separate events per pin is enabled.
|
<taskname>#<valuename>=[<decimalvalue>][,][<hex/binvalue>] Values provided depend on the setting Output selection.
|
The generic event per Value
State_A .. State_D , that are available, depending on the number of chips configured.Only sent if Interval is greater than 0, or an explicit
TaskRun command for this task is executed. |
P138 Power mgt - IP5306 Power management¶
Event |
Extra information |
---|---|
<taskname>#PowerChanged=<source> source : 0 (Battery power) or 1 (External / USB power). |
Event generated when the Event on PowerSource change is enabled.
|
P143 Switch input - I2C Rotary encoders¶
Event |
Extra information |
---|---|
<taskname>#Counter=<counter>,<delta> counter : Current counter value.delta : Change of counter from previous position. |
This event is generated on every change of the rotary encoder. Because the encoder can be rotated rather quick, the delta since the previous reading is calculated. If the value is below 0 the encoder is turned counter-clockwise, and when delta is positive, the rotation is clockwise.
|
<taskname>#State=<state> state : Current state value. Possible values: 0, 1, 10, 11. 0 and 1 for regulat button states, 10 and 11 for longpress states. |
This event is generated on buttonpress action. Depending on the action defined, either the button-down and button-up cause this event (Pushbutton), or when the state is changed (Toggle switch).
|