mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-12 09:36:59 +00:00
It appears the events called from rules must be run immediately, but there are some use cases where it can be useful to have async events. So changed back the behavior for events called from rules, to be executed immediately. Added the new command AsyncEvent.
290 lines
6.3 KiB
Plaintext
290 lines
6.3 KiB
Plaintext
.. include:: ../Plugin/_plugin_substitutions_p00x.repl
|
|
|
|
.. csv-table::
|
|
:header: "Command", "Class", "Purpose / Syntax"
|
|
:widths: 8, 5, 30
|
|
|
|
"Debug","
|
|
:red:`Internal`","
|
|
Change Serial port debug level
|
|
|
|
``Debug,<1-4>``"
|
|
"
|
|
IP","
|
|
:red:`Internal`","
|
|
Change IP address
|
|
|
|
``IP,<IP address>``"
|
|
"
|
|
Let","
|
|
:red:`Internal`","
|
|
Set the value of n (1..16).
|
|
|
|
``Let,<n>,<value>``"
|
|
"
|
|
LogEntry","
|
|
:red:`Internal`","
|
|
Add string to log
|
|
|
|
``LogEntry,<string>``"
|
|
"
|
|
Name","
|
|
:red:`Internal`","
|
|
Set the name of the unit
|
|
|
|
``Name,<new name>``"
|
|
"
|
|
Password","
|
|
:red:`Internal`","
|
|
Set the password of the unit
|
|
|
|
``Password,<new password>``"
|
|
"
|
|
Reboot","
|
|
:red:`Internal`","
|
|
Reboot the ESP
|
|
|
|
``Reboot``"
|
|
"
|
|
Reset","
|
|
:red:`Internal`","
|
|
Reset config to factory default. Caution, all settings will be lost!
|
|
|
|
``Reset``"
|
|
"
|
|
Reset Flash Write Counter","
|
|
:red:`Internal`","
|
|
Reset flash write to zero.
|
|
|
|
``ResetFlashWriteCounter``"
|
|
"
|
|
Rules","
|
|
:red:`Internal`","
|
|
Rules enabled (1) or rules disabled (0)
|
|
|
|
``Rules,<1/0>``"
|
|
"
|
|
Save","
|
|
:red:`Internal`","
|
|
Save config to persistent flash memory
|
|
|
|
``Save``"
|
|
"
|
|
Settings","
|
|
:red:`Internal`","
|
|
Show settings on serial terminal
|
|
|
|
``Settings``"
|
|
"
|
|
TaskClear","
|
|
:red:`Internal`","
|
|
Delete the given task/device
|
|
|
|
``TaskClear,<task/device nr>``"
|
|
"
|
|
TaskClearAll","
|
|
:red:`Internal`","
|
|
Delete ALL task/device
|
|
|
|
``TaskClearAll``"
|
|
"
|
|
TaskRun","
|
|
:red:`Internal`","
|
|
Run/excecute the given task/device, use to manually force an update/read of the task.
|
|
|
|
``TaskRun,<task/device nr>``"
|
|
"
|
|
Unit","
|
|
:red:`Internal`","
|
|
Set the unit number
|
|
|
|
``Unit,<unit number>``"
|
|
"
|
|
WifiAPKey","
|
|
:red:`Internal`","
|
|
Change AP WPA key
|
|
|
|
``WifiAPKey,<WPA key>``"
|
|
"
|
|
WifiAPMode","
|
|
:red:`Internal`","
|
|
Force the unit into AP mode.
|
|
|
|
``WifiAPMode``"
|
|
"
|
|
WifiConnect","
|
|
:red:`Internal`","
|
|
Connect to configured wireless network
|
|
|
|
``WifiConnect``"
|
|
"
|
|
WifiDisconnect","
|
|
:red:`Internal`","
|
|
Disconnect from wireless network
|
|
|
|
``WifiDisconnect``"
|
|
"
|
|
WifiKey","
|
|
:red:`Internal`","
|
|
Change WPA key for primary WiFi
|
|
|
|
``WifiKey,<Wifi WPA key>``"
|
|
"
|
|
WifiKey2","
|
|
:red:`Internal`","
|
|
Change WPA key for secondary WiFi
|
|
|
|
``WifiKey2,<Wifi WPA key>``"
|
|
"
|
|
WifiScan","
|
|
:red:`Internal`","
|
|
Scan Wireless networks
|
|
|
|
``WifiScan``"
|
|
"
|
|
WifiSSID","
|
|
:red:`Internal`","
|
|
Change SSID to connect as primary WiFi
|
|
|
|
``WifiSSID,<SSID>``"
|
|
"
|
|
WifiSSID2","
|
|
:red:`Internal`","
|
|
Change SSID to connect as secondry WiFi
|
|
|
|
``WifiSSID2,<SSID>``"
|
|
"
|
|
Delay","
|
|
:green:`Rules`","
|
|
Delay rule processing
|
|
|
|
``Delay,<delay in milliSeconds>``"
|
|
"
|
|
Publish","
|
|
:green:`Rules`","
|
|
Send command using MQTT broker service
|
|
|
|
``Publish,<topic>,<value>``"
|
|
"
|
|
Subscribe","
|
|
:green:`Rules`","
|
|
Subscribes to a specific topic using MQTT broker service
|
|
|
|
``Subscribe,<topic>``"
|
|
"
|
|
SendTo","
|
|
:green:`Rules`","
|
|
Send command to other ESP (using UDP)
|
|
|
|
``SendTo,<unit nr>,<command>``"
|
|
"
|
|
SendToHTTP","
|
|
:green:`Rules`","
|
|
Send command to other network device using HTTP
|
|
|
|
``SendToHTTP,<IP address>,<Portnumber>,<command>``
|
|
|
|
``SendToHTTP,<domain>,<Portnumber>,</url>``"
|
|
"
|
|
SendToUDP","
|
|
:green:`Rules`","
|
|
Send command to other network device using UDP (non-ESP Easy units)
|
|
|
|
``SendToUDP,<IP address>,<Portnumber>,<command>``"
|
|
"
|
|
TaskValueSet","
|
|
:green:`Rules`","
|
|
Set values on a **Dummy Task** (device)
|
|
|
|
``TaskValueSet,<task/device nr>,<value nr>,<value/formula>``"
|
|
"
|
|
TimerSet","
|
|
:green:`Rules`","
|
|
Start a timed event
|
|
|
|
``TimerSet,<timernr>,<timeInSeconds>``
|
|
|
|
``TimerSet,<timernr>,0`` disables the timer"
|
|
"
|
|
Event","
|
|
:blue:`Special`","
|
|
Create an event, it's possible to send a float value along as well.
|
|
|
|
See event syntax below..."
|
|
"
|
|
AsyncEvent","
|
|
:blue:`Special`","
|
|
Schedule an event, it's possible to send a float value along as well.
|
|
|
|
This is the same as a regular event, but it will not be executed immediately.
|
|
Instead it will be added to an event queue.
|
|
|
|
Use this to keep rules execution times as short as possible.
|
|
|
|
N.B. New values sent by a task will also be of this type.
|
|
|
|
See event syntax below..."
|
|
|
|
|
|
Event command
|
|
~~~~~~~~~~~~~
|
|
|
|
The event command is a special command used to trigger an event. This event can then be acted upon from the rules.
|
|
You can send 0..4 event values along with the event.
|
|
|
|
An event will be executed immediately if its origin demands a state update.
|
|
For events which do not need to be executed immediately, we have the AsyncEvent, which is added to an event queue.
|
|
This queue is processed 10 times per second, one event at a time.
|
|
|
|
Try to use AsyncEvents where possible, to keep rules processing times low.
|
|
|
|
|
|
.. csv-table::
|
|
:header: "Event / Info"
|
|
:widths: 1
|
|
|
|
"
|
|
``Event,SingleEvent``
|
|
|
|
The event (triggered by any of the launch ways) will make the unit publish a message.
|
|
|
|
**Rules example**
|
|
|
|
.. code-block:: html
|
|
|
|
on SingleEvent do
|
|
Publish,%sysname%/Info,A single event has been triggered!
|
|
endon
|
|
"
|
|
"
|
|
``Event,SingleValue=123``
|
|
|
|
The event value ``123`` is intercepted and published.
|
|
|
|
**Rules example**
|
|
|
|
.. code-block:: html
|
|
|
|
on SingleValue do
|
|
Publish,%sysname%/Info,An event has been sent (%eventvalue%)!
|
|
endon
|
|
"
|
|
"
|
|
``Event,Multi=1,2,3,99``
|
|
|
|
The event value ``99`` (4) is intercepted and the rule ``TaskValueSet...`` is
|
|
triggered, value of task 12 value 1 is then ``1 + 2`` = ``3`` or ``1 - 2`` = ``-1``.
|
|
|
|
**Rules example**
|
|
|
|
.. code-block:: html
|
|
|
|
on Multi do
|
|
if %eventvalue4%=99
|
|
TaskValueSet,12,1,[%eventvalue1%+%eventvalue2%]
|
|
else
|
|
TaskValueSet,12,1,[%eventvalue3%-%eventvalue2%]
|
|
endif
|
|
endon
|
|
"
|