Files
ESPEasy/docs/source/Plugin/P000_commands.repl
T
Gijs Noorlander 5f11850bb8 [Commands] Update docs + add task/controller enable/disable commands
Also removed ProtocolIndex from the event struct as it is redundant information which can easily be forgotten to set.

Sorted the described commands in the documentation and added a few missing commands.
2020-02-25 11:56:08 +01:00

476 lines
11 KiB
Plaintext

.. include:: ../Plugin/_plugin_substitutions_p00x.repl
**TODO** : Check commands M..Z and check for all commands whether the "class" is still valid.
.. csv-table::
:header: "Command", "Class", "Purpose / Syntax"
:widths: 8, 5, 30
"
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..."
"
AccessInfo","
:red:`Internal`","
Show allowed IP range for the web interface.
``AccessInfo``
Example output: ``Allowed IP range : 192.168.10.0 - 192.168.10.255``"
"
Build","
:red:`Internal`","
Get or set build information. This will not be stored, so only valid until reboot.
``Build``
``Build,12345``
Example output: ``Build:20104``"
"
ClearAccessBlock","
:red:`Internal`","
Clear allowed IP range for the web interface for the current session.
See also ``AccessInfo``.
``ClearAccessBlock``"
"
ClearRTCram","
:red:`Internal`","
Clear all (cached) data from the RTC memory.
This data is persistent as long as the node is powered and thus survives a reboot or crash.
``ClearRTCram``"
"
Config","
:red:`Internal`","
Remote config of a task. TODO: Describe command syntax.
``Config``"
"
ControllerDisable","
:red:`Internal`","
Disable a controller.
This will not save the settings, but if the settings get saved anyway the controller will remain disabled at reboot.
``ControllerDisable,<controller nr>``"
"
ControllerEnable","
:red:`Internal`","
Enable a controller. (Only possible when a protocol is assigned to the controller index)
This will not save the settings, but if the settings get saved anyway the controller will remain enabled at reboot.
``ControllerEnable,<controller nr>``"
"
Debug","
:red:`Internal`","
Change Serial port debug level
``Debug,<1-4>``"
"
DeepSleep","
:red:`Internal`","
Switch the node to deep sleep.
Max sleep time depends on library version and differs from roughly 71 minutes to 3h46.
``DeepSleep,<sleep time in seconds>``"
"
Delay","
:green:`Rules`","
Delay rule processing. Warning: Do not use this as it may cause all kinds of issues.
``Delay,<delay in milliSeconds>``"
"
DNS","
:red:`Internal`","
Get or set DNS configuration.
``DNS``
``DNS,8.8.8.8``
Example output: ``DNS:192.168.88.1(DHCP)``"
"
DST","
:red:`Internal`","
Get or set Daylight Saving Time.
``DST``
``DST,0`` to disable, ``DST,1`` to enable
Example output: ``DST:true``"
"
EraseSDKwifi","
:red:`Internal`","
Erase WiFi settings that may have been stored in the SDK wifi settings area.
``EraseSDKwifi``"
"
Event","
:blue:`Special`","
Create an event, it's possible to send a float value along as well.
See event syntax below..."
"
ExecuteRules","
:red:`Internal`","
Execute the rules in a specific file on the file system.
``ExecuteRules,<filename>``"
"
Gateway","
:red:`Internal`","
Get or set the gateway configuration
``Gateway``
``Gateway,192.168.1.1``
Example output: ``Gateway:192.168.10.254(DHCP)``"
"
I2Cscanner","
:red:`Internal`","
Run I2C scanner to find connected I2C chips. Output will be sent to the serial port.
``I2Cscanner``
Example output:
.. code-block:: html
4500043 : Info : Command: i2cscanner
I2C : Found 0x3c
I2C : Found 0x40
I2C : Found 0x5a
"
"
IP","
:red:`Internal`","
Get or set IP address
``IP``
``IP,<IP address>``
Example output: ``IP:192.168.10.86(DHCP)``"
"
Let","
:red:`Internal`","
Set the value of n (1..16).
``Let,<n>,<value>``"
"
Load","
:red:`Internal`","
Load (reload) the stored settings.
``Load``"
"
LogEntry","
:red:`Internal`","
Add string to log
``LogEntry,<string>``"
"
meminfo","
:red:`Internal`","
Will send summary of struct sizes to the serial port.
``meminfo``
Example output:
.. code-block:: html
4306250 : Info : Command: meminfo
SecurityStruct | 593
SettingsStruct | 1228
ExtraTaskSettingsStruct| 472
DeviceStruct | 12
"
"
meminfoDetail","
:red:`Internal`","
Will enable extra detailed information on the internal structure of the settings file.
This is displayed graphically in the system info page.
This state is not stored, so only active until reboot.
A detailed summary is also sent to the serial port.
``meminfoDetail``"
"
MessageDelay","
:red:`Internal`","
Get or set the MQTT message delay.
``MessageDelay``
``MessageDelay,<value in ms>``
Example output: ``MQTT message delay:100``"
"
Name","
:red:`Internal`","
Set the name of the unit
``Name,<new name>``"
"
Password","
:red:`Internal`","
Set the password of the unit
``Password,<new password>``"
"
Publish","
:green:`Rules`","
Send command using MQTT broker service
``Publish,<topic>,<value>``"
"
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``"
"
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>``"
"
Settings","
:red:`Internal`","
Show settings on serial terminal
``Settings``"
"
Subscribe","
:green:`Rules`","
Subscribes to a specific topic using MQTT broker service
``Subscribe,<topic>``"
"
TaskClear","
:red:`Internal`","
Delete the given task/device
``TaskClear,<task nr>``"
"
TaskClearAll","
:red:`Internal`","
Delete ALL task/device
``TaskClearAll``"
"
TaskDisable","
:red:`Internal`","
Disable a task.
This will not save the settings, but if the settings get saved anyway the task will remain disabled at reboot.
``TaskDisable,<task nr>``"
"
TaskEnable","
:red:`Internal`","
Enable a task. (only possible when a plugin is assigned to the task)
This will not save the settings, but if the settings get saved anyway the task will remain enabled at reboot.
``TaskEnable,<task nr>``"
"
TaskRun","
:red:`Internal`","
Run/excecute the given task/device, use to manually force an update/read of the task.
``TaskRun,<task nr>``"
"
TaskValueSet","
:green:`Rules`","
Set values on a **Dummy Task** (device)
``TaskValueSet,<task nr>,<value nr>,<value/formula>``"
"
TimerSet","
:green:`Rules`","
Start a timed event
``TimerSet,<timernr>,<timeInSeconds>``
``TimerSet,<timernr>,0`` disables the timer"
"
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>``"
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
"